看了官网的配置说明 跟实际有点不一样(centos7),经过一番摸索,把这个配置过程记录下来
1.下载MariaDB-Galera-server xinetd,官网的文档写的是mariadb-galera-server,搜索后只有MariaDB-Galera-server,而且安装它以后,之前的mariadb会被替换掉;
a.mariadb.repo
b.yum --enablerepo=mariadb.repo install -y MariaDB-Galera-server xinetd
2.配置clustercheck和galera参见http://docs.openstack.org/zh_CN/high-availability-guide/content/ha-aa-db-mariadb-galera-rh.html
(第一个node启动的命令有点不同,文档上是/usr/libexec/mysqld,我用的是/usr/sbin/mysqld,这个搜下mysqld的位置来确定)
3.安装完毕后出现一个问题,除了第一个node,其他两个都启不来mysql.service:
151020 15:30:01 [Note] WSREP: New cluster view: global state: 969b16ae-77a4-11e5-98d9-eea35bd653ec:5857, view# 12: Primary, number of nodes: 2, my index: 0, protocol version 3
151020 15:30:01 [Warning] WSREP: Gap in state sequence. Need state transfer.
151020 15:30:01 [Note] WSREP: Running: ‘wsrep_sst_rsync --role ‘joiner‘ --address ‘172.16.5.74‘ --auth ‘‘ --datadir ‘/var/lib/mysql/‘ --defaults-file ‘/etc/my.cnf‘ --defaults-group-suffix ‘‘ --parent ‘30117‘ ‘‘ ‘
151020 15:30:01 [ERROR] WSREP: Failed to read ‘ready <addr>‘ from: wsrep_sst_rsync --role ‘joiner‘ --address ‘172.16.5.74‘ --auth ‘‘ --datadir ‘/var/lib/mysql/‘ --defaults-file ‘/etc/my.cnf‘ --defaults-group-suffix ‘‘ --parent ‘30117‘ ‘‘
Read: ‘(null)‘
151020 15:30:01 [ERROR] WSREP: Process completed with error: wsrep_sst_rsync --role ‘joiner‘ --address ‘172.16.5.74‘ --auth ‘‘ --datadir ‘/var/lib/mysql/‘ --defaults-file ‘/etc/my.cnf‘ --defaults-group-suffix ‘‘ --parent ‘30117‘ ‘‘ : 2 (No such file or directory)
151020 15:30:01 [ERROR] WSREP: Failed to prepare for ‘rsync‘ SST. Unrecoverable.
151020 15:30:01 [ERROR] Aborting
151020 15:30:03 [Note] WSREP: Closing send monitor...
151020 15:30:03 [Note] WSREP: Closed send monitor.
151020 15:30:03 [Note] WSREP: gcomm: terminating thread
151020 15:30:03 [Note] WSREP: gcomm: joining thread
151020 15:30:03 [Note] WSREP: gcomm: closing backend
151020 15:30:04 [Note] WSREP: (5c8fd4fd, ‘tcp://0.0.0.0:4567‘) turning message relay requesting off
151020 15:30:05 [Note] WSREP: view(view_id(NON_PRIM,5c8fd4fd,26) memb {
5c8fd4fd,0
} joined {
} left {
} partitioned {
9e2b15dd,0
})
151020 15:30:05 [Note] WSREP: view((empty))
151020 15:30:05 [Note] WSREP: gcomm: closed
151020 15:30:05 [Note] WSREP: New COMPONENT: primary = no, bootstrap = no, my_idx = 0, memb_num = 1
151020 15:30:05 [Note] WSREP: Flow-control interval: [16, 16]
151020 15:30:05 [Note] WSREP: Received NON-PRIMARY.
151020 15:30:05 [Note] WSREP: Shifting PRIMARY -> OPEN (TO: 5858)
151020 15:30:05 [Note] WSREP: Received self-leave message.
151020 15:30:05 [Note] WSREP: Flow-control interval: [0, 0]
151020 15:30:05 [Note] WSREP: Received SELF-LEAVE. Closing connection.
151020 15:30:05 [Note] WSREP: Shifting OPEN -> CLOSED (TO: 5858)
151020 15:30:05 [Note] WSREP: RECV thread exiting 0: Success
151020 15:30:05 [Note] WSREP: recv_thread() joined.
151020 15:30:05 [Note] WSREP: Closing replication queue.
151020 15:30:05 [Note] WSREP: Closing slave action queue.
151020 15:30:05 [Note] WSREP: Service disconnected.
151020 15:30:05 [Note] WSREP: rollbacker thread exiting
151020 15:30:06 [Note] WSREP: Some threads may fail to exit.
151020 15:30:06 [Note] /usr/sbin/mysqld: Shutdown complete
Error in my_thread_global_end(): 1 threads didn‘t exit
151020 15:30:11 mysqld_safe mysqld from pid file /var/lib/mysql/mysql4.pid ended
之前以为安装的过程有问题,所以重装了几次,发现该问题仍存在,那么就不是偶然事件了,搜了N久的谷歌也没搜到,后来改了/etc/my.cnf中feedback的配置,重启后就好了-.-
[mysqld]
feedback=ON