您的位置:首页 > 数据库 > MySQL

Galera Cluster for MySQL启动不了,一直不停的自动重启!

2017-08-26 18:58 1131 查看
现象:

服务不停的自动重启,查看进程,如下:

[root@CentOS data]# systemctl start mysqld
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
[root@CentOS data]# ps aux|grep mysql
root      9386  0.0  0.0 113120  1488 ?        Ss   14:55   0:00 /bin/bash /usr/bin/mysqld_pre_systemd --pre
mysql     9403 93.0  3.6 9669728 1202632 ?  
  Sl   14:55   0:00 /usr/sbin/mysqld --datadir=/data/mysql-data --user=mysql --wsrep_recover
root      9433  0.0  0.0 112664   972 pts/0    S+   14:55   0:00 grep --color=auto mysql
[root@CentOS data]#

日志中会有[Warning] WSREP: Read non-wsrep XID from storage engines.内容?

原因:
你可能修改了MySQL的log-error参数,MySQL5.7版本官网说错误日志的变量为log_error(改成下划线)

因为,systemctl start mysqld.service调用的脚本ExecStartPre=/usr/bin/mysqld_pre_systemd --pre中已固定写死为log-error名,否则他还是取的默认日志路径名(/var/log/mysql.log)而这个文件永远为空,所以服务不能重启成功!!!

这个语句:log=$(get_option mysqld log-error "/var/log/mysql${instance:+-$instance}.log" $instance)

而这个ExecStartPre=/usr/bin/mysqld_pre_systemd --pre语句的作用就是提取你上次离开的同步位置,再次启动时会以此位置再次同步数据

如果是首次创建节点,Galera Cluster会向日志文件中输出如下内容:

2017-08-26T06:55:04.456278Z 0 [Note] InnoDB: File './ibtmp1'
size is now 12 MB.
2017-08-26T06:55:04.458452Z 0 [Note] InnoDB: 96 redo rollback
segment(s) found. 96 redo rollback segment(s) are active.
2017-08-26T06:55:04.458484Z 0 [Note] InnoDB: 32 non-redo
rollback segment(s) are active.
2017-08-26T06:55:04.459012Z 0 [Note] InnoDB: Waiting for
purge to start
2017-08-26T06:55:04.509259Z 0 [Note] InnoDB: 5.7.18 started;
log sequence number 1317084
2017-08-26T06:55:04.510537Z 0 [Note] Plugin 'FEDERATED'
is disabled.
2017-08-26T06:55:04.591685Z 0 [Note] WSREP:
Recovered position: 00000000-0000-0000-0000-000000000000:-1
2017-08-26T06:55:04.591737Z 0 [Note] Binlog end
2017-08-26T06:55:04.593055Z 0 [Note] Shutting down plugin
'validate_password'
2017-08-26T06:55:04.593117Z 0 [Note] Shutting down plugin
'ngram'
2017-08-26T06:55:04.593127Z 0 [Note] Shutting down plugin
'ARCHIVE'
2017-08-26T06:55:04.593134Z 0 [Note] Shutting down plugin
'BLACKHOLE'
2017-08-26T06:55:04.593143Z 0 [Note] Shutting down plugin
'partition'

其中WSREP: Recovered position: 00000000-0000-0000-0000-000000000000:-1就是表示新创建的节点,而mysqld_pre_systemd脚本就会提取最后的位置信息(他会搜索WSREP:
Recovered position这个关键字内容[grep  然后再tail -n 1])

解决办法:
变量名必须为:log-error
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: