我在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

10-08 00:28