使用者工具

網站工具


database:mysql:replication1

差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

Both sides previous revision 前次修改
下次修改
前次修改
database:mysql:replication1 [2014/05/31 10:24]
ali88 [Mysql Replication配置]
database:mysql:replication1 [2014/06/15 17:12] (目前版本)
ali88 [Mysql Replication配置]
行 31: 行 31:
 要給Slave一個帳號可以存取Master 要給Slave一個帳號可以存取Master
 <​code>​GRANT RELOAD, SUPER, REPLICATION SLAVE ON *.* TO '​backup171'​@'​192.168.0.171'​ IDENTIFIED BY '​qwedcxza'</​code>​ <​code>​GRANT RELOAD, SUPER, REPLICATION SLAVE ON *.* TO '​backup171'​@'​192.168.0.171'​ IDENTIFIED BY '​qwedcxza'</​code>​
 +備份 Master 伺服器的資料庫。
 +<​code>​mysqldump --all-databases --lock-all-tables >​master.sql</​code>​
 +記錄 Master 伺服器 binary log 的位置序號<​code>​master > SHOW MASTER STATUS;
 +File: mysql-bin.000008
 +Position: 176146
 +</​code>​
 ===Slave Mysql=== ===Slave Mysql===
   - Slave 沒有限定一定要開啟binlog(這邊範例不打開)   - Slave 沒有限定一定要開啟binlog(這邊範例不打開)
-  - 在未開始replication時,​資料庫內容要和Master 一致+  - 在未開始replication時,​資料庫內容要和Master 一致。將備份檔複製到 Slave 伺服器並且回存到 Slave 伺服器。<​code>​mysql -uroot < master.sql</​code>​
   - 設定 /etc/my.cnf (以下 基本參數是設定 Slave Replication,​不一定要寫在my.cnf設定檔 方法一)   - 設定 /etc/my.cnf (以下 基本參數是設定 Slave Replication,​不一定要寫在my.cnf設定檔 方法一)
 <​code>​ <​code>​
行 52: 行 58:
 ->​master_log_file='​mysql-bin.000008',​ ->​master_log_file='​mysql-bin.000008',​
 ->​master_log_pos=176146;</​code>​ ->​master_log_pos=176146;</​code>​
 +======註 Show slave status 顯示slave數據複寫一些重要訊息======
 +  * **Slave_IO_Running**<​code>​slave的I/​O thread是否已經連線到Master主機。有3種值(Yes,​No,​Connecting)</​code>​
 +  * **Slave_SQL_Running**<​code>​Slave SQL thread 是否已經在執行(讀取relay log並執行讀取到相關SQL)</​code>​
 +  * **Master_Log_File**<​code>​Slave I/O thread正在讀取 Master當前 Binary Log檔案名稱</​code>​
 +  * **Read_Master_Log_Pos**<​code>​當前Master中Binary Log已被Slave I/O thread 讀取到的位置</​code>​
 +  * **Relay_Log_File**<​code>​SQL thread 正在讀取當前 Relay Log 檔案名稱</​code>​
 +  * **Relay_Log_Position**<​code>​Slave SQL thread 讀取並執行目前 Relay Log 的位置</​code>​
 +  * **Relay_Master_Log_File**<​code>​記載了包含最近一個被 Slave SQL thread執行的事件的 Binary Log 位置</​code>​
 +======參考資料======
 +1.MySQL Replication(Master Slave負載平衡) http://​homeserver.com.tw/​%E7%86%B1%E9%96%80%E6%9B%B8%E7%B1%A4/​mysql-replication/​
 +
 +2.Instructions for setting up MySQL Replication(Netman) ​ http://​www.study-area.org/​tips/​mysql_replication.htm
 +
 +3.Mysql雙機備援+heartbeat http://​www.360doc.com/​content/​11/​0413/​22/​2054285_109433883.shtml
 +
 +4.MySQL 設定 Replication (Master - Slave) http://​blog.longwin.com.tw/​2008/​03/​mysql_replication_master_slave_set_2008/​
 +
 +5.[MySQL] 實做 MySQL Master-Master Replication 同步 http://​blog.wu-boy.com/​2008/​12/​mysql-%E5%AF%A6%E5%81%9A-mysql-master-master-replication-%E5%90%8C%E6%AD%A5/​
 +
 +6.MySQL Master-Master Replication Manager(1) - 簡介 http://​blog.longwin.com.tw/​2008/​10/​mysql-master-replication-manager-mmm-intro-2008/​
 +
 +7.MySQL Hierarchical Replication & Global Group IDs https://​code.google.com/​p/​google-mysql-tools/​wiki/​GlobalTransactionIds
 +
 +8.Mysql HA http://​www.360doc.com/​content/​07/​0531/​10/​15084_530610.shtml
 +
 +9.MySQL Replication同步複製的延時監控 http://​blog.csdn.net/​kronus/​article/​details/​7346248
 +
 +10.http://​www.360doc.com/​relevant/​109419362_more.shtml
 +
 +11.高性能Mysql主從架構的複製原理及配置 http://​www.360doc.com/​content/​13/​0409/​18/​891660_277200925.shtml
 +
 +12.清理 ZABBIX 的歷史數據 http://​www.bitbi.biz/​%E6%B8%85%E7%90%86-zabbix-%E7%9A%84%E5%8E%86%E5%8F%B2%E6%95%B0%E6%8D%AE-5582/#​more-5582
 +
 +13.MySQL中的複製 http://​dev.mysql.com/​doc/​refman/​5.1/​zh/​replication.html
 +
 +14.mysql Replication 原理分析 http://​zhaolinjnu.blog.sohu.com/​103459345.html
 +
 +15.Galera Cluster for MySQL Multi-master Replication http://​blog.wu-boy.com/​2013/​03/​galera-cluster-for-mysql-multi-master-replication/​
 +
 +16.mysql-mmm http://​mysql-mmm.org/​mmm1:​installation
 +
 +17.MySQL半同步Semi-sync原理介紹 http://​www.orczhou.com/​index.php/​2011/​07/​why-and-how-mysql-5-5-semi-sync-replication/​
 +
 +18. maatkit----mysql管理工具 http://​diyoki.blog.51cto.com/​2158750/​1156627
 +
 +19.EffectiveMySQL-replication-techniques http://​effectivemysql.com/​book/​replication-techniques/​
database/mysql/replication1.1401531859.txt.gz · 上一次變更: 2014/05/31 10:24 由 ali88