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