這裏顯示兩個版本的差異處。
Both sides previous revision 前次修改 下次修改 | 前次修改 | ||
database:mysql:replication1 [2014/06/04 15:52] ali88 [註 Show slave status 顯示slave數據複寫依些重要訊息] |
database:mysql:replication1 [2014/06/15 17:12] (目前版本) ali88 [Mysql Replication配置] |
||
---|---|---|---|
行 33: | 行 33: | ||
備份 Master 伺服器的資料庫。 | 備份 Master 伺服器的資料庫。 | ||
<code>mysqldump --all-databases --lock-all-tables >master.sql</code> | <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(這邊範例不打開) | ||
行 55: | 行 59: | ||
->master_log_pos=176146;</code> | ->master_log_pos=176146;</code> | ||
======註 Show slave status 顯示slave數據複寫一些重要訊息====== | ======註 Show slave status 顯示slave數據複寫一些重要訊息====== | ||
- | * **Slave_IO_Running** | + | * **Slave_IO_Running**<code>slave的I/O thread是否已經連線到Master主機。有3種值(Yes,No,Connecting)</code> |
- | * **Slave_SQL_Running** | + | * **Slave_SQL_Running**<code>Slave SQL thread 是否已經在執行(讀取relay log並執行讀取到相關SQL)</code> |
- | * **Master_Log_File** | + | * **Master_Log_File**<code>Slave I/O thread正在讀取 Master當前 Binary Log檔案名稱</code> |
- | * **Read_Master_Log_Pos** | + | * **Read_Master_Log_Pos**<code>當前Master中Binary Log已被Slave I/O thread 讀取到的位置</code> |
- | * **Relay_Log_File** | + | * **Relay_Log_File**<code>SQL thread 正在讀取當前 Relay Log 檔案名稱</code> |
- | * **Relay_Log_Position** | + | * **Relay_Log_Position**<code>Slave SQL thread 讀取並執行目前 Relay Log 的位置</code> |
- | * **Relay_Master_Log_File** | + | * **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/ | 1.MySQL Replication(Master Slave負載平衡) http://homeserver.com.tw/%E7%86%B1%E9%96%80%E6%9B%B8%E7%B1%A4/mysql-replication/ | ||
行 98: | 行 102: | ||
18. maatkit----mysql管理工具 http://diyoki.blog.51cto.com/2158750/1156627 | 18. maatkit----mysql管理工具 http://diyoki.blog.51cto.com/2158750/1156627 | ||
+ | |||
+ | 19.EffectiveMySQL-replication-techniques http://effectivemysql.com/book/replication-techniques/ |