mariadb galera cluster 简单初步安装及sst报错排查


1,安装

  配置mariadb  dbgalera cluster   安装yum源,同时其他yum源也需要安装,以解决依赖问题,可能需要的依赖有perl-DBD-mysql 及boost-program-options,可以查看报错解决。

1 [root@test73 /etc/yum.repos.d] $ cat  galera.repo 
2 [galera]
3 name=garela
4 baseurl=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-5.5.64/yum/centos7-amd64/
5 gpgcheck=0

清空yum缓存,重建数据并安装

1 yum  clean all 
2 yum  makecache 
3 yum  -y install   MariaDB-Galera-server

2,配置文件

配置文件这里只是添加节点信息,如下:

1 vim /etc/my.cnf.d/server.cnf
2  [galera]
3 wsrep_provider = /usr/lib64/galera/libgalera_smm.so
4 wsrep_cluster_address="gcomm://192.168.36.72,192.168.36.73,192.168.36.74"
5 binlog_format=row

然后将该配置文件复制到其他节点下同样位置。

3,启动服务

对于第一节点(72),需要使用命令进行初始化。

注意:初始化之前需要对所有的节点关闭防火墙及SELINUX,防止节点之间无法建立正常连接。

/etc/init.d/mysql start --wsrep-new-cluster

正常情况下如下显示

[root@test72 /etc/yum.repos.d] $ /etc/init.d/mysql start --wsrep-new-cluster
Starting MariaDB....                                       [  OK  ]

 

第一节点启动成功后,其他节点(73,74)依次执行如下命令开始加入集群,复制数据。

service mysql start

正常情况下如下显示

[root@test73 /data] $ service  mysql  start 
Starting MariaDB.190510 09:14:58 mysqld_safe Logging to '/var/lib/mysql/test73.example.com.err'.
190510 09:14:58 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
........SST in progress, setting sleep higher......        [  OK  ]

4,登陆查看

进入 show status 看到  :

wsrep_incoming_addresses                 | 172.22.145.75:3306,192.168.36.73:3306,172.22.144.

因为我的节点都是两只网卡,一个桥接,一个vmnet1自定义,而配置文件中使用自定义网卡地址,这种情况不太了解。

5,报错

没有关闭防火墙及SELINUX 服务无法正常启动。

第一次做实验时节点2无法正常启动,进度卡在sst 复制失败,有如下报错。

  1 190509 21:06:49 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
  2 190509 21:06:49 mysqld_safe WSREP: Running position recovery with --log_error='/var/lib/mysql/wsrep_recovery.ppVf2T' --pid-file='/var/lib/mysql/test73.example.com-recover.pid'
  3 190509 21:06:49 [Note] /usr/sbin/mysqld (mysqld 5.5.63-MariaDB-wsrep) starting as process 1693 ...
  4 190509 21:06:51 mysqld_safe WSREP: Recovered position 00000000-0000-0000-0000-000000000000:-1
  5 190509 21:06:51 [Note] WSREP: Read nil XID from storage engines, skipping position init
  6 190509 21:06:51 [Note] WSREP: wsrep_load(): loading provider library '/usr/lib64/galera/libgalera_smm.so'
  7 190509 21:06:51 [Note] WSREP: wsrep_start_position var submitted: '00000000-0000-0000-0000-000000000000:-1'
  8 190509 21:06:51 [Note] /usr/sbin/mysqld (mysqld 5.5.63-MariaDB-wsrep) starting as process 1737 ...
  9 190509 21:06:51 [Note] WSREP: wsrep_load(): Galera 25.3.26(r3857) by Codership Oy <info@codership.com> loaded successfully.
 10 190509 21:06:51 [Note] WSREP: CRC-32C: using hardware acceleration.
 11 190509 21:06:51 [Warning] WSREP: Could not open state file for reading: '/var/lib/mysql//grastate.dat'
 12 190509 21:06:51 [Note] WSREP: Found saved state: 00000000-0000-0000-0000-000000000000:-1, safe_to_bootstrap: 1
 13 190509 21:06:51 [Note] WSREP: Passing config to GCS: base_dir = /var/lib/mysql/; base_host = 172.22.149.233; base_port = 4567; cert.log_conflicts = no; cert.optimistic_pa = yes; debug = no; evs.auto_evict = 0; evs.delay_margin = PT1S; evs.delayed_keep_period = PT30S; evs.inactive_check_period = PT0.5S; evs.inactive_timeout = PT15S; evs.join_retrans_period = PT1S; evs.max_install_timeouts = 3; evs.send_window = 4; evs.stats_report_period = PT1M; evs.suspect_timeout = PT5S; evs.user_send_window = 2; evs.view_forget_timeout = PT24H; gcache.dir = /var/lib/mysql/; gcache.keep_pages_size = 0; gcache.mem_size = 0; gcache.name = /var/lib/mysql//galera.cache; gcache.page_size = 128M; gcache.recover = no; gcache.size = 128M; gcomm.thread_prio = ; gcs.fc_debug = 0; gcs.fc_factor = 1.0; gcs.fc_limit = 16; gcs.fc_master_slave = no; gcs.max_packet_size = 64500; gcs.max_throttle = 0.25; gcs.recv_q_hard_limit = 9223372036854775807; gcs.recv_q_soft_limit = 0.25; gcs.sync_donor = no; gmcast.segment = 0; gmcast.version = 0; pc.announce_timeout = PT3
 14 190509 21:06:51 [Note] WSREP: GCache history reset: 00000000-0000-0000-0000-000000000000:0 -> 00000000-0000-0000-0000-000000000000:-1
 15 190509 21:06:51 [Note] WSREP: Assign initial position for certification: -1, protocol version: -1
 16 190509 21:06:51 [Note] WSREP: wsrep_sst_grab()
 17 190509 21:06:51 [Note] WSREP: Start replication
 18 190509 21:06:51 [Note] WSREP: Setting initial position to 00000000-0000-0000-0000-000000000000:-1
 19 190509 21:06:51 [Note] WSREP: protonet asio version 0
 20 190509 21:06:51 [Note] WSREP: Using CRC-32C for message checksums.
 21 190509 21:06:51 [Note] WSREP: backend: asio
 22 190509 21:06:51 [Note] WSREP: gcomm thread scheduling priority set to other:0 
 23 190509 21:06:51 [Warning] WSREP: access file(/var/lib/mysql//gvwstate.dat) failed(No such file or directory)
 24 190509 21:06:51 [Note] WSREP: restore pc from disk failed
 25 190509 21:06:51 [Note] WSREP: GMCast version 0
 26 190509 21:06:51 [Note] WSREP: (4fe1a74c, 'tcp://0.0.0.0:4567') listening at tcp://0.0.0.0:4567
 27 190509 21:06:51 [Note] WSREP: (4fe1a74c, 'tcp://0.0.0.0:4567') multicast: , ttl: 1
 28 190509 21:06:51 [Note] WSREP: EVS version 0
 29 190509 21:06:51 [Note] WSREP: gcomm: connecting to group 'my_wsrep_cluster', peer '192.168.36.72:,192.168.36.73:,192.168.36.74:'
 30 190509 21:06:51 [Note] WSREP: (4fe1a74c, 'tcp://0.0.0.0:4567') connection established to 4fe1a74c tcp://192.168.36.73:4567
 31 190509 21:06:51 [Warning] WSREP: (4fe1a74c, 'tcp://0.0.0.0:4567') address 'tcp://192.168.36.73:4567' points to own listening address, blacklisting
 32 190509 21:06:51 [Note] WSREP: (4fe1a74c, 'tcp://0.0.0.0:4567') connection established to 96ba28fc tcp://192.168.36.72:4567
 33 190509 21:06:51 [Note] WSREP: (4fe1a74c, 'tcp://0.0.0.0:4567') turning message relay requesting on, nonlive peers: 
 34 190509 21:06:51 [Note] WSREP: (4fe1a74c, 'tcp://0.0.0.0:4567') connection established to d2db0a42 tcp://192.168.36.74:4567
 35 190509 21:06:52 [Note] WSREP: declaring 96ba28fc at tcp://192.168.36.72:4567 stable
 36 190509 21:06:52 [Note] WSREP: declaring d2db0a42 at tcp://192.168.36.74:4567 stable
 37 190509 21:06:52 [Note] WSREP: Node 96ba28fc state prim
 38 190509 21:06:52 [Note] WSREP: view(view_id(PRIM,4fe1a74c,13) memb {
 39         4fe1a74c,0
 40         96ba28fc,0
 41         d2db0a42,0
 42 } joined {
 43 } left {
 44 } partitioned {
 45 })
 46 190509 21:06:52 [Note] WSREP: save pc into disk
 47 190509 21:06:52 [Note] WSREP: gcomm: connected
 48 190509 21:06:52 [Note] WSREP: Changing maximum packet size to 64500, resulting msg size: 32636
 49 190509 21:06:52 [Note] WSREP: Shifting CLOSED -> OPEN (TO: 0)
 50 190509 21:06:52 [Note] WSREP: Opened channel 'my_wsrep_cluster'
 51 190509 21:06:52 [Note] WSREP: Waiting for SST to complete.
 52 190509 21:06:52 [Note] WSREP: New COMPONENT: primary = yes, bootstrap = no, my_idx = 0, memb_num = 3
 53 190509 21:06:52 [Note] WSREP: STATE_EXCHANGE: sent state UUID: 507abb30-725b-11e9-b82f-7eda461c3175
 54 190509 21:06:52 [Note] WSREP: STATE EXCHANGE: sent state msg: 507abb30-725b-11e9-b82f-7eda461c3175
 55 190509 21:06:52 [Note] WSREP: STATE EXCHANGE: got state msg: 507abb30-725b-11e9-b82f-7eda461c3175 from 1 (test72.example.com)
 56 190509 21:06:52 [Note] WSREP: STATE EXCHANGE: got state msg: 507abb30-725b-11e9-b82f-7eda461c3175 from 2 (74.example.com)
 57 190509 21:06:52 [Note] WSREP: STATE EXCHANGE: got state msg: 507abb30-725b-11e9-b82f-7eda461c3175 from 0 (test73.example.com)
 58 190509 21:06:52 [Note] WSREP: Quorum results:
 59         version    = 4,
 60         component  = PRIMARY,
 61         conf_id    = 12,
 62         members    = 2/3 (joined/total),
 63         act_id     = 0,
 64         last_appl. = -1,
 65         protocols  = 0/9/3 (gcs/repl/appl),
 66         group UUID = 96ba92a2-7258-11e9-a3c5-5744510bc813
 67 190509 21:06:52 [Note] WSREP: Flow-control interval: [28, 28]
 68 190509 21:06:52 [Note] WSREP: Trying to continue unpaused monitor
 69 190509 21:06:52 [Note] WSREP: Shifting OPEN -> PRIMARY (TO: 0)
 70 190509 21:06:52 [Note] WSREP: State transfer required: 
 71         Group state: 96ba92a2-7258-11e9-a3c5-5744510bc813:0
 72         Local state: 00000000-0000-0000-0000-000000000000:-1
 73 190509 21:06:52 [Note] WSREP: New cluster view: global state: 96ba92a2-7258-11e9-a3c5-5744510bc813:0, view# 13: Primary, number of nodes: 3, my index: 0, protocol version 3
 74 190509 21:06:52 [Warning] WSREP: Gap in state sequence. Need state transfer.
 75 190509 21:06:52 [Note] WSREP: Running: 'wsrep_sst_rsync --role 'joiner' --address '172.22.149.233' --datadir '/var/lib/mysql/' --defaults-file '/etc/my.cnf' --parent '1737''
 76 190509 21:06:52 [Note] WSREP: Prepared SST request: rsync|172.22.149.233:4444/rsync_sst
 77 190509 21:06:52 [Note] WSREP: wsrep_notify_cmd is not defined, skipping notification.
 78 190509 21:06:52 [Note] WSREP: REPL Protocols: 9 (4, 2)
 79 190509 21:06:52 [Note] WSREP: Assign initial position for certification: 0, protocol version: 4
 80 190509 21:06:52 [Note] WSREP: Service thread queue flushed.
 81 190509 21:06:52 [Warning] WSREP: Failed to prepare for incremental state transfer: Local state UUID (00000000-0000-0000-0000-000000000000) does not match group state UUID (96ba92a2-7258-11e9-a3c5-5744510bc813): 1 (Operation not permitted)
 82          at galera/src/replicator_str.cpp:prepare_for_IST():482. IST will be unavailable.
 83 190509 21:06:52 [Note] WSREP: Member 0.0 (test73.example.com) requested state transfer from '*any*'. Selected 1.0 (test72.example.com)(SYNCED) as donor.
 84 190509 21:06:52 [Note] WSREP: Shifting PRIMARY -> JOINER (TO: 0)
 85 190509 21:06:52 [Note] WSREP: Requesting state transfer: success, donor: 1
 86 190509 21:06:52 [Note] WSREP: GCache history reset: 00000000-0000-0000-0000-000000000000:0 -> 96ba92a2-7258-11e9-a3c5-5744510bc813:0
 87 190509 21:06:53 [Warning] WSREP: 1.0 (test72.example.com): State transfer to 0.0 (test73.example.com) failed: -71 (Protocol error)
 88 190509 21:06:53 [ERROR] WSREP: gcs/src/gcs_group.cpp:gcs_group_handle_join_msg():737: Will never receive state. Need to abort.
 89 190509 21:06:53 [Note] WSREP: gcomm: terminating thread
 90 190509 21:06:53 [Note] WSREP: gcomm: joining thread
 91 190509 21:06:53 [Note] WSREP: gcomm: closing backend
 92 190509 21:06:53 [Note] WSREP: view(view_id(NON_PRIM,4fe1a74c,13) memb {
 93         4fe1a74c,0
 94 } joined {
 95 } left {
 96 } partitioned {
 97         96ba28fc,0
 98         d2db0a42,0
 99 })
100 190509 21:06:53 [Note] WSREP: view((empty))
101 190509 21:06:53 [Note] WSREP: gcomm: closed
102 190509 21:06:53 [Note] WSREP: /usr/sbin/mysqld: Terminated.
103 190509 21:06:53 mysqld_safe mysqld from pid file /var/lib/mysql/test73.example.com.pid ended
104 WSREP_SST: [ERROR] Parent mysqld process (PID:1737) terminated unexpectedly. (20190509 21:06:53.990)
105 WSREP_SST: [INFO] Joiner cleanup. rsync PID: 1782 (20190509 21:06:53.992)
106 WSREP_SST: [INFO] Joiner cleanup done. (20190509 21:06:54.497)
107 190509 21:13:24 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
108 190509 21:13:24 mysqld_safe WSREP: Running position recovery with --log_error='/var/lib/mysql/wsrep_recovery.QY33xx' --pid-file='/var/lib/mysql/test73.example.com-recover.pid'
109 190509 21:13:24 [Note] /usr/sbin/mysqld (mysqld 5.5.63-MariaDB-wsrep) starting as process 2068 ...
110 190509 21:13:26 mysqld_safe WSREP: Recovered position 00000000-0000-0000-0000-000000000000:-1
111 190509 21:13:26 [Note] WSREP: wsrep_start_position var submitted: '00000000-0000-0000-0000-000000000000:-1'
112 190509 21:13:26 [Note] /usr/sbin/mysqld (mysqld 5.5.63-MariaDB-wsrep) starting as process 2113 ...
113 190509 21:13:26 [Note] WSREP: Read nil XID from storage engines, skipping position init
114 190509 21:13:26 [Note] WSREP: wsrep_load(): loading provider library '/usr/lib64/galera/libgalera_smm.so'
115 190509 21:13:26 [Note] WSREP: wsrep_load(): Galera 25.3.26(r3857) by Codership Oy <info@codership.com> loaded successfully.
116 190509 21:13:26 [Note] WSREP: CRC-32C: using hardware acceleration.
117 190509 21:13:26 [Warning] WSREP: Could not open state file for reading: '/var/lib/mysql//grastate.dat'
118 190509 21:13:26 [Note] WSREP: Found saved state: 00000000-0000-0000-0000-000000000000:-1, safe_to_bootstrap: 1
119 190509 21:13:26 [Note] WSREP: Passing config to GCS: base_dir = /var/lib/mysql/; base_host = 172.22.149.233; base_port = 4567; cert.log_conflicts = no; cert.optimistic_pa = yes; debug = no; evs.auto_evict = 0; evs.delay_margin = PT1S; evs.delayed_keep_period = PT30S; evs.inactive_check_period = PT0.5S; evs.inactive_timeout = PT15S; evs.join_retrans_period = PT1S; evs.max_install_timeouts = 3; evs.send_window = 4; evs.stats_report_period = PT1M; evs.suspect_timeout = PT5S; evs.user_send_window = 2; evs.view_forget_timeout = PT24H; gcache.dir = /var/lib/mysql/; gcache.keep_pages_size = 0; gcache.mem_size = 0; gcache.name = /var/lib/mysql//galera.cache; gcache.page_size = 128M; gcache.recover = no; gcache.size = 128M; gcomm.thread_prio = ; gcs.fc_debug = 0; gcs.fc_factor = 1.0; gcs.fc_limit = 16; gcs.fc_master_slave = no; gcs.max_packet_size = 64500; gcs.max_throttle = 0.25; gcs.recv_q_hard_limit = 9223372036854775807; gcs.recv_q_soft_limit = 0.25; gcs.sync_donor = no; gmcast.segment = 0; gmcast.version = 0; pc.announce_timeout = PT3
120 190509 21:13:26 [Note] WSREP: GCache history reset: 96ba92a2-7258-11e9-a3c5-5744510bc813:0 -> 00000000-0000-0000-0000-000000000000:-1
121 190509 21:13:26 [Note] WSREP: Assign initial position for certification: -1, protocol version: -1
122 190509 21:13:26 [Note] WSREP: wsrep_sst_grab()
123 190509 21:13:26 [Note] WSREP: Start replication
124 190509 21:13:26 [Note] WSREP: Setting initial position to 00000000-0000-0000-0000-000000000000:-1
125 190509 21:13:26 [Note] WSREP: protonet asio version 0
126 190509 21:13:26 [Note] WSREP: Using CRC-32C for message checksums.
127 190509 21:13:26 [Note] WSREP: backend: asio
128 190509 21:13:26 [Note] WSREP: gcomm thread scheduling priority set to other:0 
129 190509 21:13:26 [Warning] WSREP: access file(/var/lib/mysql//gvwstate.dat) failed(No such file or directory)
130 190509 21:13:26 [Note] WSREP: restore pc from disk failed
131 190509 21:13:26 [Note] WSREP: GMCast version 0
132 190509 21:13:26 [Note] WSREP: (3b4df1b3, 'tcp://0.0.0.0:4567') listening at tcp://0.0.0.0:4567
133 190509 21:13:26 [Note] WSREP: (3b4df1b3, 'tcp://0.0.0.0:4567') multicast: , ttl: 1
134 190509 21:13:26 [Note] WSREP: EVS version 0
135 190509 21:13:26 [Note] WSREP: gcomm: connecting to group 'my_wsrep_cluster', peer '192.168.36.72:,192.168.36.73:,192.168.36.74:'
136 190509 21:13:26 [Note] WSREP: (3b4df1b3, 'tcp://0.0.0.0:4567') connection established to 3b4df1b3 tcp://192.168.36.73:4567
137 190509 21:13:26 [Warning] WSREP: (3b4df1b3, 'tcp://0.0.0.0:4567') address 'tcp://192.168.36.73:4567' points to own listening address, blacklisting
138 190509 21:13:26 [Note] WSREP: (3b4df1b3, 'tcp://0.0.0.0:4567') connection established to 96ba28fc tcp://192.168.36.72:4567
139 190509 21:13:26 [Note] WSREP: (3b4df1b3, 'tcp://0.0.0.0:4567') turning message relay requesting on, nonlive peers: 
140 190509 21:13:26 [Note] WSREP: (3b4df1b3, 'tcp://0.0.0.0:4567') connection established to d2db0a42 tcp://192.168.36.74:4567
141 190509 21:13:27 [Note] WSREP: declaring 96ba28fc at tcp://192.168.36.72:4567 stable
142 190509 21:13:27 [Note] WSREP: declaring d2db0a42 at tcp://192.168.36.74:4567 stable
143 190509 21:13:27 [Note] WSREP: Node 96ba28fc state prim
144 190509 21:13:27 [Note] WSREP: view(view_id(PRIM,3b4df1b3,15) memb {
145         3b4df1b3,0
146         96ba28fc,0
147         d2db0a42,0
148 } joined {
149 } left {
150 } partitioned {
151 })
152 190509 21:13:27 [Note] WSREP: save pc into disk
153 190509 21:13:27 [Note] WSREP: gcomm: connected
154 190509 21:13:27 [Note] WSREP: Changing maximum packet size to 64500, resulting msg size: 32636
155 190509 21:13:27 [Note] WSREP: Shifting CLOSED -> OPEN (TO: 0)
156 190509 21:13:27 [Note] WSREP: Opened channel 'my_wsrep_cluster'
157 190509 21:13:27 [Note] WSREP: Waiting for SST to complete.
158 190509 21:13:27 [Note] WSREP: New COMPONENT: primary = yes, bootstrap = no, my_idx = 0, memb_num = 3
159 190509 21:13:27 [Note] WSREP: STATE_EXCHANGE: sent state UUID: 3b9adff6-725c-11e9-b593-164bacf8edad
160 190509 21:13:27 [Note] WSREP: STATE EXCHANGE: sent state msg: 3b9adff6-725c-11e9-b593-164bacf8edad
161 190509 21:13:27 [Note] WSREP: STATE EXCHANGE: got state msg: 3b9adff6-725c-11e9-b593-164bacf8edad from 0 (test73.example.com)
162 190509 21:13:27 [Note] WSREP: STATE EXCHANGE: got state msg: 3b9adff6-725c-11e9-b593-164bacf8edad from 1 (test72.example.com)
163 190509 21:13:27 [Note] WSREP: STATE EXCHANGE: got state msg: 3b9adff6-725c-11e9-b593-164bacf8edad from 2 (74.example.com)
164 190509 21:13:27 [Note] WSREP: Quorum results:
165         version    = 4,
166         component  = PRIMARY,
167         conf_id    = 14,
168         members    = 2/3 (joined/total),
169         act_id     = 0,
170         last_appl. = -1,
171         protocols  = 0/9/3 (gcs/repl/appl),
172         group UUID = 96ba92a2-7258-11e9-a3c5-5744510bc813
173 190509 21:13:27 [Note] WSREP: Flow-control interval: [28, 28]
174 190509 21:13:27 [Note] WSREP: Trying to continue unpaused monitor
175 190509 21:13:27 [Note] WSREP: Shifting OPEN -> PRIMARY (TO: 0)
176 190509 21:13:27 [Note] WSREP: State transfer required: 
177         Group state: 96ba92a2-7258-11e9-a3c5-5744510bc813:0
178         Local state: 00000000-0000-0000-0000-000000000000:-1
179 190509 21:13:27 [Note] WSREP: New cluster view: global state: 96ba92a2-7258-11e9-a3c5-5744510bc813:0, view# 15: Primary, number of nodes: 3, my index: 0, protocol version 3
180 190509 21:13:27 [Warning] WSREP: Gap in state sequence. Need state transfer.
181 190509 21:13:27 [Note] WSREP: Running: 'wsrep_sst_rsync --role 'joiner' --address '172.22.149.233' --datadir '/var/lib/mysql/' --defaults-file '/etc/my.cnf' --parent '2113''
182 190509 21:13:27 [Note] WSREP: Prepared SST request: rsync|172.22.149.233:4444/rsync_sst
183 190509 21:13:27 [Note] WSREP: wsrep_notify_cmd is not defined, skipping notification.
184 190509 21:13:27 [Note] WSREP: REPL Protocols: 9 (4, 2)
185 190509 21:13:27 [Note] WSREP: Assign initial position for certification: 0, protocol version: 4
186 190509 21:13:27 [Note] WSREP: Service thread queue flushed.
187 190509 21:13:27 [Warning] WSREP: Failed to prepare for incremental state transfer: Local state UUID (00000000-0000-0000-0000-000000000000) does not match group state UUID (96ba92a2-7258-11e9-a3c5-5744510bc813): 1 (Operation not permitted)
188          at galera/src/replicator_str.cpp:prepare_for_IST():482. IST will be unavailable.
189 190509 21:13:27 [Note] WSREP: Member 0.0 (test73.example.com) requested state transfer from '*any*'. Selected 1.0 (test72.example.com)(SYNCED) as donor.
190 190509 21:13:27 [Note] WSREP: Shifting PRIMARY -> JOINER (TO: 0)
191 190509 21:13:27 [Note] WSREP: Requesting state transfer: success, donor: 1
192 190509 21:13:27 [Note] WSREP: GCache history reset: 00000000-0000-0000-0000-000000000000:0 -> 96ba92a2-7258-11e9-a3c5-5744510bc813:0
193 190509 21:13:27 [Warning] WSREP: 1.0 (test72.example.com): State transfer to 0.0 (test73.example.com) failed: -71 (Protocol error)
194 190509 21:13:27 [ERROR] WSREP: gcs/src/gcs_group.cpp:gcs_group_handle_join_msg():737: Will never receive state. Need to abort.
195 190509 21:13:27 [Note] WSREP: gcomm: terminating thread
196 190509 21:13:27 [Note] WSREP: gcomm: joining thread
197 190509 21:13:27 [Note] WSREP: gcomm: closing backend
198 190509 21:13:27 [Note] WSREP: view(view_id(NON_PRIM,3b4df1b3,15) memb {
199         3b4df1b3,0
200 } joined {
201 } left {
202 } partitioned {
203         96ba28fc,0
204         d2db0a42,0
205 })
206 190509 21:13:27 [Note] WSREP: view((empty))
207 190509 21:13:27 [Note] WSREP: gcomm: closed
208 190509 21:13:27 [Note] WSREP: /usr/sbin/mysqld: Terminated.
209 190509 21:13:27 mysqld_safe mysqld from pid file /var/lib/mysql/test73.example.com.pid ended
210 WSREP_SST: [ERROR] Parent mysqld process (PID:2113) terminated unexpectedly. (20190509 21:13:28.465)
211 WSREP_SST: [INFO] Joiner cleanup. rsync PID: 2154 (20190509 21:13:28.467)
212 WSREP_SST: [INFO] Joiner cleanup done. (20190509 21:13:28.976)

 网上有人说清除 galera.cache , grastate.dat  文件,试下不起作用,突然想到将桥接ip关掉,启动成功。后来重新做了一遍,安装配置后没有改变任何操作就启动成功。

 

后续研究再补

 补:

看的人不少,有个简单的方法,摘自如下:

https://jumpserver.readthedocs.io/zh/master/distributed_03.html

系统  centos 7 
TCP	Mariadb-01	192.168.100.10	3306	 
TCP	Mariadb-02	192.168.100.11	3306	 
TCP	Mariadb-03	192.168.100.12	3306	 
#1三台服务器分别执行
yum upgrade -y
vi /etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = http://mirrors.ustc.edu.cn/mariadb/yum/10.1/centos7-amd64
gpgkey=http://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1
#2安装 
yum install -y mariadb mariadb-server mariadb-shared mariadb-common galera rsync
可以配置防火墙
      # 设置 Firewalld 和 Selinux
      $ firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.100.0/24" port protocol="tcp" port="3306" accept"
      $ firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.100.0/24" port protocol="tcp" port="4567" accept"
      $ firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.100.0/24" port protocol="tcp" port="4568" accept"
      $ firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.100.0/24" port protocol="tcp" port="4444" accept"
      $ firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.100.0/24" port protocol="udp" port="4567" accept"
      # 192.168.100.0/24 为整个 Jumpserver 网络网段, 这里就偷懒了, 自己根据实际情况修改即可
      $ firewall-cmd --reload
      $ setenforce 0
      $ sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
#3,在192.168.100.10上执行
systemctl start mariadb
mysql_secure_installation
systemctl stop mariadb
#4在192.168.100.10
vi /etc/my.cnf.d/server.cnf
[galera]
wsrep_on=ON
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
wsrep_cluster_name=galera_cluster
wsrep_cluster_address="gcomm://192.168.100.10,192.168.100.11,192.168.100.12"
wsrep_node_name=Mariadb-01   # 注意这里改成本机 hostname
wsrep_node_address=192.168.100.10   # 注意这里改成本机 ip
binlog_format=row
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
#5 192.168.100.11 
vi /etc/my.cnf.d/server.cnf
[galera]
wsrep_on=ON
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
wsrep_cluster_name=galera_cluster
wsrep_cluster_address="gcomm://192.168.100.10,192.168.100.11,192.168.100.12"
wsrep_node_name=Mariadb-02   # 注意这里改成本机 hostname
wsrep_node_address=192.168.100.11   # 注意这里改成本机 ip
binlog_format=row
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2

#6 192.168.100.12 
[galera]
wsrep_on=ON
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
wsrep_cluster_name=galera_cluster
wsrep_cluster_address="gcomm://192.168.100.10,192.168.100.11,192.168.100.12"
wsrep_node_name=Mariadb-03   # 注意这里改成本机 hostname
wsrep_node_address=192.168.100.12   # 注意这里改成本机 ip
binlog_format=row
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
#7 在 192.168.100.10 上执行以下命令
$ sudo -u mysql /usr/sbin/mysqld --wsrep-new-cluster &> /tmp/wsrep_new_cluster.log &
$ disown $!
$ tail -f /tmp/wsrep_new_cluster.log  # 如果出现 ready for connections, 表示启动成功

#8 在 192.168.100.11 和 192.168.100.12 启动 mariadb 服务
$ systemctl start mariadb
#9 回到第一台服务器
$ ps -ef | grep mysqld | grep -v grep | awk '{print $2}' | xargs kill -9
$ systemctl start mariadb
#10 在任意数据库服务器执行以下命令验证 MariaDB Galera Cluster
$ mysql -uroot -p -e "show status like 'wsrep_cluster_size'"  # 这里应该显示集群里有3个节点
$ mysql -uroot -p -e "show status like 'wsrep_connected'"  # 这里应该显示ON
$ mysql -uroot -p -e "show status like 'wsrep_incoming_addresses'"  # 这里应该显示3个ip
$ mysql -uroot -p -e "show status like 'wsrep_local_state_comment'"  # 这里显示节点的同步状态

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM