我在mariaDB(最新:10.1.8)上有几个复制设置。请确保我使用的是Multiple replication
而不是旧版的Single replication
。
我使用CHANGE MASTER "blah" TO
命令添加了一些设置。现在,我想从show all slaves status
中删除其中一个。
mysql -e "show all slaves status\G;" | grep "Connection_name\|Running"
Connection_name:
Slave_IO_Running: No
Slave_SQL_Running: Yes
Connection_name: asi.exapmle.com
Slave_IO_Running: Connecting
Slave_SQL_Running: Yes
Connection_name: bee.exapmle.com
Slave_IO_Running: Connecting
Slave_SQL_Running: Yes
Connection_name: dild.exapmle.com
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Connection_name: datr.exapmle.com
Slave_IO_Running: Connecting
Slave_SQL_Running: Yes
Connection_name: db.exapmle.com
Slave_IO_Running: Connecting
Slave_SQL_Running: Yes
Connection_name: nop.exapmle.com
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
如何从此复制列表中仅删除
db.exapmle.com
,而不影响其他复制? 最佳答案
终于找到了解决方案!RESET SLAVE 'Connection_name' all
是我想要的。
不只是RESET SLAVE
,还需要在最后添加ALL
。
https://mariadb.com/kb/en/mariadb/reset-slave-connection_name/
[root@maria ~]# mysql -e "show all slaves status\G;" | grep "Connection_name\|Running"
Connection_name: # <- empty name and wanna remove
Slave_IO_Running: No
Slave_SQL_Running: Yes
Connection_name: wanna-remove-db # <- wanna remove
Slave_IO_Running: No
Slave_SQL_Running: Yes
Connection_name: wanna-keep-db # <- don't wanna remove '
Slave_IO_Running: Connecting
Slave_SQL_Running: Yes
[root@maria ~]# mysql -e "STOP SLAVE 'wanna-remove-db';"
[root@maria ~]# mysql -e "RESET SLAVE 'wanna-remove-db' all;"
[root@maria ~]# mysql -e "show all slaves status\G;" | grep "Connection_name\|Running"
Connection_name:
Slave_IO_Running: No
Slave_SQL_Running: Yes
Connection_name: wanna-keep-db
Slave_IO_Running: Connecting
Slave_SQL_Running: Yes
[root@maria ~]# mysql -e "STOP SLAVE ''"
[root@maria ~]# mysql -e "RESET SLAVE '' all;"
[root@maria ~]# mysql -e "show all slaves status\G;" | grep "Connection_name\|Running"
Connection_name: wanna-keep-db
Slave_IO_Running: Connecting
Slave_SQL_Running: Yes