shell實現,利用mysqld_multi自動做多執行個體從庫:使用協助 shell實現,利用mysqld_multi自動做多執行個體從庫 01# sh doallslave.sh 使用協助02 help 查看協助資訊03 自動做allslave從庫指令碼使用協助04 slavename 只能是xxx_xxx這種命令例如:zq2013_test105 添加一個新從庫 三個參數addslave slavename ip mysql.tar-name rootpasswd06 例子: addslave slavename 10.0.88.88 mysql.xxx.tar passwd 07 刪除一個從庫 三個參數 delslave slavename08 例子: delslave slavename09使用1:添加一個新從庫10sh doallslave.sh addslave lqcq_t1 10.0.4.1 /usr/home/lijiuyang/41test_20130913_mysql.tar 你輸入的mysql-root密碼11資料放置完成!開始組建組態檔案12/usr/doslave/confbak is have13my.cnf 和dblist已經修改完成!14zqtx-bin.0000031593638969116/usr/local/bin/mysql -uroot -p這裡會顯示你輸入的密碼 --socket=/tmp/mysql_lqcq_t1.sock17*************************** 1. row ***************************18 Slave_IO_State: Waiting for master to send event19 Master_Host: 10.0.4.120 Master_User: rep21 Master_Port: 330622 Connect_Retry: 6023 Master_Log_File: zqtx-bin.00000324 Read_Master_Log_Pos: 93640402125 Relay_Log_File: lqcq_t1-relay-bin.00000226 Relay_Log_Pos: 1145827 Relay_Master_Log_File: zqtx-bin.00000328 Slave_IO_Running: Yes29 Slave_SQL_Running: Yes30 Replicate_Do_DB:31 Replicate_Ignore_DB:32 Replicate_Do_Table:33 Replicate_Ignore_Table:34 Replicate_Wild_Do_Table:35Replicate_Wild_Ignore_Table:36 Last_Errno: 037 Last_Error:38 Skip_Counter: 039 Exec_Master_Log_Pos: 93640091540 Relay_Log_Space: 1456441 Until_Condition: None42 Until_Log_File:43 Until_Log_Pos: 044 Master_SSL_Allowed: No45 Master_SSL_CA_File:46 Master_SSL_CA_Path:47 Master_SSL_Cert:48 Master_SSL_Cipher:49 Master_SSL_Key:50 Seconds_Behind_Master: 30851伺服器: 10.0.4.1 的從庫完成!請重新整理並查看php從庫監控52使用2:刪除一箇舊從庫53# sh doallslave.sh delslave lqcq_t154刪除55/usr/db_backups/lqcq_t1_mysql_backup 存在!56mysqld1405714058已經刪除,請重新整理從庫監控59使用的前提:60得檢查並修改現在allslave上的my.cnf配置,保證格式和下面這樣一樣61[mysqld139]62socket = /tmp/mysql_zq2013_s14.sock #zq2013_s14_mysql_backup63port = 3447 #zq2013_s14_mysql_backup64pid-file = /usr/db_backups/zq2013_s14_mysql_backup/zq2013_s14.pid #zq2013_s14_mysql_backup65datadir = /usr/db_backups/zq2013_s14_mysql_backup #zq2013_s14_mysql_backup66server_id = 213149 #zq2013_s14_mysql_backu