pxc wsrep_sst_method均配置为xtrabackup-v2报错
启动第二节点报错:WSREP_SST: [ERROR] Error while getting data from donor node: exit codes: 137 0
本来所有节点的wsrep_sst_method均配置为xtrabackup-v2,但是添加第二个节点时报错:WSREP_SST: [ERROR] Error while getting data from donor node: exit codes: 137 0,换成了rsync后,就没有问题了,待验证是否是xtrabackup的版本问题,我之前用的是2.4.7
wsrep_sst_method = xtrabackup-v2
wsrep_sst_method = rsync
使用xtrabackup2.1.8报错:
[ERROR] The xtrabackup vexrsion is 2.1.8. Needs xtrabackup-2.4.4 or higher to perform SST
即换成xtrabackup-2.4.4,还是同样的报错:
WSREP_SST: [ERROR] Error while getting data from donor node: exit codes: 137 0
验证我这个不是xtrabackup版本问题!
在下面的检查过程中,先发现了node1节点的socat未安装,安装好后日志再次报错是sst用户权限的问题,重新授权后解决!
测试步骤:
1、node1启动集群,在node1建库建表,并插入数据;
2、node2用wsrep_sst_method = rsync启动,正常启动后同步数据完成,shutdown node2;
3、修改node2的wsrep_sst_method = xtrabackup-v2,还是正常启动;
4、node1写入数据,node2同步数据正常。
查看节点1的错误日志:
2017-07-31T03:04:03.419546Z 0 [Note] WSREP: Initiating SST/IST transfer on DONOR side (wsrep_sst_xtrabackup-v2 --role 'donor' --address '10.157.26.133:4444/xtrabackup_sst//1' --socket '/tmp/m
ysql.sock' --datadir '/data/mysql/mysql_6666/data/' --defaults-file '/etc/my.cnf' --defaults-group-suffix '' --binlog '/data/mysql/mysql_6666/logs/binlog/mysql-bin' --gtid 'ed816d86-759a-11e
7-a5c4-469a5c88e506:0')
2017-07-31T03:04:03.424705Z 2 [Note] WSREP: DONOR thread signaled with 0
which: no socat in (/usr/sbin:/sbin:/opt/mysql/Percona-XtraDB-Cluster-5.7.18-rel15-29.20.1.Linux.x86_64.ssl101/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/u
sr/bin:/root/bin:/opt/httpd/php5/bin:/usr/local/mysql_pxc/bin)
2017-07-31T03:04:03.713864Z WSREP_SST: [ERROR] ******************* FATAL ERROR **********************
2017-07-31T03:04:03.715590Z WSREP_SST: [ERROR] socat not found in path: /usr/sbin:/sbin:/opt/mysql/Percona-XtraDB-Cluster-5.7.18-rel15-29.20.1.Linux.x86_64.ssl101/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/httpd/php5/bin:/usr/local/mysql_pxc/bin
2017-07-31T03:04:03.717220Z WSREP_SST: [ERROR] ******************************************************
2017-07-31T03:04:03.717775Z 0 [ERROR] WSREP: Process completed with error: wsrep_sst_xtrabackup-v2 --role 'donor' --address '10.157.26.133:4444/xtrabackup_sst//1' --socket '/tmp/mysql.sock' -
-datadir '/data/mysql/mysql_6666/data/' --defaults-file '/etc/my.cnf' --defaults-group-suffix '' --binlog '/data/mysql/mysql_6666/logs/binlog/mysql-bin' --gtid 'ed816d86-759a-11e7-a5c4-469a5
c88e506:0': 2 (No such file or directory)
2017-07-31T03:04:03.717918Z 0 [ERROR] WSREP: Command did not run: wsrep_sst_xtrabackup-v2 --role 'donor' --address '10.157.26.133:4444/xtrabackup_sst//1' --socket '/tmp/mysql.sock' --datadir
'/data/mysql/mysql_6666/data/' --defaults-file '/etc/my.cnf' --defaults-group-suffix '' --binlog '/data/mysql/mysql_6666/logs/binlog/mysql-bin' --gtid 'ed816d86-759a-11e7-a5c4-469a5c88e506:0
'
2017-07-31T03:04:03.719442Z 0 [Warning] WSREP: 1.0 (node132): State transfer to 0.0 (node133) failed: -2 (No such file or directory)
安装socat:
tar zxvf socat-1.7.3.2.tar.gz
cd socat-1.7.3.2
./configure
make && make install
三个节点安装好socat之后,再次添加第二节点,报错:
2017-07-31T03:18:57.289292Z WSREP_SST: [ERROR] ******************* FATAL ERROR **********************
2017-07-31T03:18:57.291514Z WSREP_SST: [ERROR] xtrabackup_checkpoints missing. xtrabackup/SST failed on DONOR. Check DONOR log
2017-07-31T03:18:57.293551Z WSREP_SST: [ERROR] ******************************************************
2017-07-31T03:18:57.296400Z WSREP_SST: [ERROR] Cleanup after exit with status:2
2017-07-31T03:18:57.300659Z 0 [Warning] WSREP: 0.0 (node132): State transfer to 1.0 (node133) failed: -22 (Invalid argument)
2017-07-31T03:18:57.300706Z 0 [ERROR] WSREP: gcs/src/gcs_group.cpp:gcs_group_handle_join_msg():765: Will never receive state. Need to abort.
这时再查看第一节点的错误日志:
2017-07-31T03:18:57.274531Z 12 [Note] Access denied for user 'sst'@'localhost' (using password: YES)
2017-07-31T03:18:57.278394Z WSREP_SST: [ERROR] ******************* FATAL ERROR **********************
2017-07-31T03:18:57.281082Z WSREP_SST: [ERROR] xtrabackup finished with error: 1. Check /data/mysql/mysql_6666/data//innobackup.backup.log
--------------- innobackup.backup.log (START) --------------------
170731 11:18:57 version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;port=6666;mysql_socket=/tmp/mysql.sock' as 'sst' (using password: YES).
Character set 'utf8mb4' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file
Failed to connect to MySQL server: DBI connect(';mysql_read_default_group=xtrabackup;port=6666;mysql_socket=/tmp/mysql.sock','sst',...) failed: Can't initialize character set utf8mb4 (path: /usr/share/mysql/charsets/) at - line 1314
170731 11:18:57 Connecting to MySQL server host: localhost, user: sst, password: set, port: 6666, socket: /tmp/mysql.sock
即查看/data/mysql/mysql_6666/data/innobackup.backup.log,可以看到是用户权限问题:
[root@dpstcmsweb00 src]# cat /data/mysql/mysql_6666/data/innobackup.backup.log
170731 11:18:57 version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;port=6666;mysql_socket=/tmp/mysql.sock' as 'sst' (using password: YES).
Character set 'utf8mb4' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file
Failed to connect to MySQL server: DBI connect(';mysql_read_default_group=xtrabackup;port=6666;mysql_socket=/tmp/mysql.sock','sst',...) failed: Can't initialize character set utf8mb4 (path: /usr/share/mysql/charsets/) at - line 1314
170731 11:18:57 Connecting to MySQL server host: localhost, user: sst, password: set, port: 6666, socket: /tmp/mysql.sock
Failed to connect to MySQL server: Access denied for user 'sst'@'localhost' (using password: YES).
在第一个节点上授权:grant all privileges on *.* to 'sst'@'localhost' identified by 'sst123';
再次启动第二节点,添加成功!