pxc增刪節點

刪除節點

直接停掉一個就可以了,比如停掉23之後

user_3306.sock>show status like 'wsrep_incoming_addresses';

+--------------------------+---------------------------------------+
| Variable_name            | Value                                 |
+--------------------------+---------------------------------------+
| wsrep_incoming_addresses | 192.168.56.22:3306,192.168.56.21:3306 |
+--------------------------+---------------------------------------+
1 row in set (0.00 sec)

如果以後不用23,其它節點可以更改/etc/my.cnf中的參數

[root@pxc21 user_3306]# cat /etc/my.cnf | grep 23
wsrep_cluster_address=gcomm://192.168.56.21,192.168.56.22,192.168.56.23 #cluster 中的節點i

去掉裏面的192.168.56.23,不需要重啓21和22


增加節點

要確認各機子中安裝了xtrabackup和socat


yum install percona-xtrabackup-2.2.6-5042.el6.x86_64.rpm

yum install socat-1.7.2.4-1.el6.rf.x86_64.rpm 

不然會報錯(當pxc中的一臺主機停止後重新與其它主機同步時也需要這兩個工具)

WSREP_SST: [ERROR] innobackupex not in path: /usr/sbin:/sbin:/usr/local/Percona-XtraDB-Cluster-5.5.39-rel36.0-25.11.828.Linux.x86_64//bin:/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/Percona-XtraDB-Cluster-5.5.39-rel36.0-25.11.828.Linux.x86_64/bin (20150314 00:29:50.433)


WSREP_SST: [ERROR] socat not found in path: /usr/sbin:/sbin:/usr/local/Percona-XtraDB-Cluster-5.5.39-rel36.0-25.11.828.Linux.x86_64//bin:/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/Percona-XtraDB-Cluster-5.5.39-rel36.0-25.11.828.Linux.x86_64/bin (20150314 00:36:42.763)


以上工具都有了後,直接更改新機的my.cnf,並啓動就可以了

[root@oel64 user_3306]# cat /etc/my.cnf | grep 22
wsrep_cluster_address=gcomm://192.168.56.21,192.168.56.22,192.168.56.24 #cluster 中的節點ip 
21與22兩臺機子只需要更改my.cnf不用重啓,直接啓動24就可以

會自動把21與22的數據複製過來,包括用戶
啓動後可以看到參數變了

user_3306.sock>show status like 'wsrep_incoming_addresses';
+--------------------------+----------------------------------------------------------+
| Variable_name            | Value                                                    |
+--------------------------+----------------------------------------------------------+
| wsrep_incoming_addresses | 192.168.56.24:3306,192.168.56.22:3306,192.168.56.21:3306 |
+--------------------------+----------------------------------------------------------+
1 row in set (0.00 sec)

登錄24檢查裏面的數據,可以看到21與22裏的數據在24也有了


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章