shell實現,利用mysqld_multi自動做多實例從庫:使用幫助
shell實現,利用mysqld_multi自動做多實例從庫
01
# sh doallslave.sh 使用幫助
02
help 查看幫助信息
03
自動做allslave從庫腳本使用幫助
04
slavename 只能是xxx_xxx這種命令例如:zq2013_test1
05
添加一個新從庫 三個參數addslave slavename ip mysql.tar-name rootpasswd
06
例子: addslave slavename 10.0.88.88 mysql.xxx.tar passwd
07
刪除一個從庫 三個參數 delslave slavename
08
例子: delslave slavename
09
使用1:添加一個新從庫
10
sh doallslave.sh addslave lqcq_t1 10.0.4.1 /usr/home/lijiuyang/41test_20130913_mysql.tar 你輸入的mysql-root密碼
11
數據放置完成!開始生成配置文件
12
/usr/doslave/confbak is have
13
my.cnf 和dblist已經修改完成!
14
zqtx-bin.000003
15
936389691
16
/usr/local/bin/mysql -uroot -p這裡會顯示你輸入的密碼 --socket=/tmp/mysql_lqcq_t1.sock
17
*************************** 1. row ***************************
18
Slave_IO_State: Waiting for master to send event
19
Master_Host: 10.0.4.1
20
Master_User: rep
21
Master_Port: 3306
22
Connect_Retry: 60
23
Master_Log_File: zqtx-bin.000003
24
Read_Master_Log_Pos: 936404021
25
Relay_Log_File: lqcq_t1-relay-bin.000002
26
Relay_Log_Pos: 11458
27
Relay_Master_Log_File: zqtx-bin.000003
28
Slave_IO_Running: Yes
29
Slave_SQL_Running: Yes
30
Replicate_Do_DB:
31
Replicate_Ignore_DB:
32
Replicate_Do_Table:
33
Replicate_Ignore_Table:
34
Replicate_Wild_Do_Table:
35
Replicate_Wild_Ignore_Table:
36
Last_Errno: 0
37
Last_Error:
38
Skip_Counter: 0
39
Exec_Master_Log_Pos: 936400915
40
Relay_Log_Space: 14564
41
Until_Condition: None
42
Until_Log_File:
43
Until_Log_Pos: 0
44
Master_SSL_Allowed: No
45
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: 308
51
服務器: 10.0.4.1 的從庫完成!請刷新並查看php從庫監控
52
使用2:刪除一個舊從庫
53
# sh doallslave.sh delslave lqcq_t1
54
刪除
55
/usr/db_backups/lqcq_t1_mysql_backup 存在!
56
mysqld140
57
140
58
已經刪除,請刷新從庫監控
59
使用的前提:
60
得檢查並修改現在allslave上的my.cnf配置,保證格式和下面這樣一樣
61
[mysqld139]
62
socket = /tmp/mysql_zq2013_s14.sock #zq2013_s14_mysql_backup
63
port = 3447 #zq2013_s14_mysql_backup
64
pid-file = /usr/db_backups/zq2013_s14_mysql_backup/zq2013_s14.pid #zq2013_s14_mysql_backup
65
datadir = /usr/db_backups/zq2013_s14_mysql_backup #zq2013_s14_mysql_backup
66
server_id = 213149 #zq2013_s14_mysql_backu