标签:linux 数据库软件 mariadb galera cluster
OS:Centos 6.6
[root@heartbeat1 ~]# uname -a
Linux heartbeat1 2.6.32-504.el6.x86_64 #1 SMP Wed Oct 15 04:27:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
数据库软件:MariaDB Galera Cluster 10.0.20
主机配置:
Heartbeat1 10.0.0.7
Heartbeat2 10.0.0.8
Heartbeat3 10.0.0.9
关闭防火墙:
Chkconfig iptables off
sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/g‘ /etc/selinux/config
设置主机hosts
[root@heartbeat1 ~]# tail -3 /etc/hosts
10.0.0.7 heartbeat1
10.0.0.8 heartbeat2
10.0.0.9 heartbeat3
# cat /etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.0/rhel7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
# yum install MariaDB-Galera-server MariaDB-client galera
如果下载慢可以先手动下载后在安装(需要解决一下依赖关系)
http://mirrors.opencas.cn/mariadb/mariadb-10.0.20/yum/centos6-x86/rpms/
注:安装前先卸载 yum remove mysql-libs
[root@heartbeat1 ~]# mysql_install_db
# /etc/init.d/mysql start
#mysql_secure_installation
# mysql -uroot -p
MariaDB [(none)]> grant all privileges on *.* to ‘thdl‘@‘%‘ identified by ‘ldht‘ with grant option;
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> \q
#/etc/init.d/mysql stop
[root@heartbeat1 ~]# cat /etc/my.cnf.d/server.cnf
[galera] query_cache_size=0 wsrep_provider=/usr/lib/galera/libgalera_smm.so wsrep_cluster_address=gcomm://10.0.0.7,10.0.0.8,10.0.09 集群中的主机 wsrep_cluster_name=‘wap‘ wsrep_node_address=‘10.0.0.7‘ 本机的ip地址 wsrep_node_name=‘heartbeat1‘ 本机的主机名 wsrep_sst_method=rsync wsrep_sst_auth=thdl:ldht wsrep_slave_threads=2 binlog_format=row default_storage_engine=InnoDB innodb_autoinc_lock_mode=2 bind-address=0.0.0.0
在其中一台启动cluster集群 使用参数bootstrap
[root@heartbeat1 ~]# /etc/init.d/mysql
Usage: mysql {start|stop|restart|reload|force-reload|status|configtest|bootstrap} [ MySQL server options ]
/etc/init.d/mysql bootstrap
Bootstrapping the cluster.. Starting MySQL.. SUCCESS!
其他服务器执行:/etc/init.d/mysql start
启动日志:
[root@heartbeat2 mysql]# pwd
/var/lib/mysql
[root@heartbeat2 mysql]# ls
aria_log.00000001 gvwstate.dat ib_logfile0 mysql.sock
aria_log_control heartbeat2.err ib_logfile1 performance_schema
galera.cache heartbeat2.pid multi-master.info rsync_sst_complete
grastate.dat ibdata1 mysql test
[root@heartbeat2 mysql]# tailf heartbeat2.err
150803 13:53:36 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql150803 13:53:36 mysqld_safe WSREP: Running position recovery with --log_error=‘/var/lib/mysql/wsrep_recovery.pURBC1‘ --pid-file=‘/var/lib/mysql/heartbeat2-recover.pid‘150803 13:53:36 [Note] /usr/sbin/mysqld (mysqld 10.0.20-MariaDB-wsrep) starting as process 21597 ...150803 13:53:38 mysqld_safe WSREP: Recovered position 00000000-0000-0000-0000-000000000000:-1150803 13:53:38 [Note] /usr/sbin/mysqld (mysqld 10.0.20-MariaDB-wsrep) starting as process 21632 ...150803 13:53:38 [Note] WSREP: Read nil XID from storage engines, skipping position init150803 13:53:38 [Note] WSREP: wsrep_load(): loading provider library ‘/usr/lib/galera/libgalera_smm.so‘150803 13:53:38 [Note] WSREP: wsrep_load(): Galera 25.3.9(r3387) by Codership Oy <info@codership.com> loaded successfully.150803 13:53:38 [Note] WSREP: CRC-32C: using hardware acceleration.150803 13:53:38 [Warning] WSREP: Could not open saved state file for reading: /var/lib/mysql//grastate.dat150803 13:53:38 [Note] WSREP: Found saved state: 00000000-0000-0000-0000-000000000000:-1150803 13:53:38 [Note] WSREP: Passing config to GCS: base_host = 10.0.0.8; base_port = 4567; cert.log_conflicts = no; 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.size = 128M; 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 = 2147483647; gcs.recv_q_soft_limit = 0.25; gcs.sync_donor = no; gmcast.segment = 0; gmcast.version = 0; pc.announce_timeout = PT3S; pc.checksum = false; pc.ignore_quorum = false; pc.ignore_sb = false; pc.npvo = false; pc.recovery = 1; pc.ver150803 13:53:38 [Note] WSREP: Service thread queue flushed.150803 13:53:38 [Note] WSREP: Assign initial position for certification: -1, protocol version: -1150803 13:53:38 [Note] WSREP: wsrep_sst_grab()150803 13:53:38 [Note] WSREP: Start replication150803 13:53:38 [Note] WSREP: ‘wsrep-new-cluster‘ option used, bootstrapping the cluster150803 13:53:38 [Note] WSREP: Setting initial position to 00000000-0000-0000-0000-000000000000:-1150803 13:53:38 [Note] WSREP: protonet asio version 0150803 13:53:38 [Note] WSREP: Using CRC-32C for message checksums.150803 13:53:38 [Note] WSREP: backend: asio150803 13:53:38 [Warning] WSREP: access file(gvwstate.dat) failed(No such file or directory)150803 13:53:38 [Note] WSREP: restore pc from disk failed150803 13:53:38 [Note] WSREP: GMCast version 0150803 13:53:38 [Warning] WSREP: Failed to resolve tcp://10.0.09:4567150803 13:53:38 [Note] WSREP: (fcd17198, ‘tcp://0.0.0.0:4567‘) listening at tcp://0.0.0.0:4567150803 13:53:38 [Note] WSREP: (fcd17198, ‘tcp://0.0.0.0:4567‘) multicast: , ttl: 1150803 13:53:38 [Note] WSREP: EVS version 0150803 13:53:38 [Note] WSREP: gcomm: bootstrapping new group ‘wap‘150803 13:53:38 [Note] WSREP: start_prim is enabled, turn off pc_recovery150803 13:53:38 [Note] WSREP: Node fcd17198 state prim150803 13:53:38 [Note] WSREP: view(view_id(PRIM,fcd17198,1) memb {fcd17198,0} joined {} left {} partitioned {})150803 13:53:38 [Note] WSREP: save pc into disk150803 13:53:38 [Note] WSREP: discarding pending addr without UUID: tcp://10.0.0.7:4567150803 13:53:38 [Note] WSREP: discarding pending addr proto entry 0xf6c0eb00150803 13:53:38 [Note] WSREP: discarding pending addr without UUID: tcp://10.0.0.8:4567150803 13:53:38 [Note] WSREP: discarding pending addr proto entry 0xf6c0eb80150803 13:53:38 [Note] WSREP: gcomm: connected150803 13:53:38 [Note] WSREP: Changing maximum packet size to 64500, resulting msg size: 32636150803 13:53:38 [Note] WSREP: Shifting CLOSED -> OPEN (TO: 0)150803 13:53:38 [Note] WSREP: Opened channel ‘wap‘150803 13:53:38 [Note] WSREP: Waiting for SST to complete.150803 13:53:38 [Note] WSREP: New COMPONENT: primary = yes, bootstrap = no, my_idx = 0, memb_num = 1150803 13:53:38 [Note] WSREP: Starting new group from scratch: fcd75fb1-39a3-11e5-a4b2-7341b03f99e0150803 13:53:38 [Note] WSREP: STATE_EXCHANGE: sent state UUID: fcd77828-39a3-11e5-8c27-6a31fbe601da150803 13:53:38 [Note] WSREP: STATE EXCHANGE: sent state msg: fcd77828-39a3-11e5-8c27-6a31fbe601da150803 13:53:38 [Note] WSREP: STATE EXCHANGE: got state msg: fcd77828-39a3-11e5-8c27-6a31fbe601da from 0 (heartbeat2)150803 13:53:38 [Note] WSREP: Quorum results:version = 3,component = PRIMARY,conf_id = 0,members = 1/1 (joined/total),act_id = 0,last_appl. = -1,protocols = 0/7/3 (gcs/repl/appl),group UUID = fcd75fb1-39a3-11e5-a4b2-7341b03f99e0150803 13:53:38 [Note] WSREP: Flow-control interval: [16, 16]150803 13:53:38 [Note] WSREP: Restored state OPEN -> JOINED (0)150803 13:53:38 [Note] WSREP: Member 0.0 (heartbeat2) synced with group.150803 13:53:38 [Note] WSREP: Shifting JOINED -> SYNCED (TO: 0)150803 13:53:38 [Note] WSREP: New cluster view: global state: fcd75fb1-39a3-11e5-a4b2-7341b03f99e0:0, view# 1: Primary, number of nodes: 1, my index: 0, protocol version 3150803 13:53:38 [Note] WSREP: SST complete, seqno: 0150803 13:53:38 [Note] InnoDB: Using mutexes to ref count buffer pool pages150803 13:53:38 [Note] InnoDB: The InnoDB memory heap is disabled150803 13:53:38 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins150803 13:53:38 [Note] InnoDB: The InnoDB memory heap is disabled150803 13:53:38 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins150803 13:53:38 [Note] InnoDB: Memory barrier is not used150803 13:53:38 [Note] InnoDB: Compressed tables use zlib 1.2.3150803 13:53:38 [Note] InnoDB: Compressed tables use zlib 1.2.3150803 13:53:38 [Note] InnoDB: Using Linux native AIO150803 13:53:38 [Note] InnoDB: Not using CPU crc32 instructions150803 13:53:38 [Note] InnoDB: Initializing buffer pool, size = 128.0M150803 13:53:38 [Note] InnoDB: Completed initialization of buffer pool150803 13:53:39 [Note] InnoDB: Highest supported file format is Barracuda.150803 13:53:40 [Note] InnoDB: 128 rollback segment(s) are active.150803 13:53:40 [Note] InnoDB: Waiting for purge to start150803 13:53:40 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.24-72.2 started; log sequence number 1616971150803 13:53:40 [Note] Plugin ‘FEEDBACK‘ is disabled.150803 13:53:40 [Note] Server socket created on IP: ‘0.0.0.0‘.150803 13:53:40 [Note] Event Scheduler: Loaded 0 events150803 13:53:40 [Note] WSREP: wsrep_notify_cmd is not defined, skipping notification.150803 13:53:40 [Note] WSREP: REPL Protocols: 7 (3, 2)150803 13:53:40 [Note] WSREP: Service thread queue flushed.150803 13:53:40 [Note] WSREP: Assign initial position for certification: 0, protocol version: 3150803 13:53:40 [Note] WSREP: Service thread queue flushed.150803 13:53:40 [Note] WSREP: Synchronized with group, ready for connections150803 13:53:40 [Note] WSREP: wsrep_notify_cmd is not defined, skipping notification.150803 13:53:40 [Note] /usr/sbin/mysqld: ready for connections.Version: ‘10.0.20-MariaDB-wsrep‘ socket: ‘/var/lib/mysql/mysql.sock‘ port: 3306 MariaDB Server, wsrep_25.10.r4144150803 13:54:19 [Note] WSREP: (fcd17198, ‘tcp://0.0.0.0:4567‘) turning message relay requesting on, nonlive peers:150803 13:54:19 [Note] WSREP: declaring 14925073 at tcp://10.0.0.7:4567 stable150803 13:54:19 [Note] WSREP: Node fcd17198 state prim150803 13:54:19 [Note] WSREP: view(view_id(PRIM,14925073,2) memb {14925073,0fcd17198,0} joined {} left {} partitioned {})150803 13:54:19 [Note] WSREP: save pc into disk150803 13:54:19 [Note] WSREP: New COMPONENT: primary = yes, bootstrap = no, my_idx = 1, memb_num = 2150803 13:54:19 [Note] WSREP: STATE EXCHANGE: Waiting for state UUID.150803 13:54:20 [Note] WSREP: STATE EXCHANGE: sent state msg: 153c9e9f-39a4-11e5-92cb-cf751e6586af150803 13:54:20 [Note] WSREP: STATE EXCHANGE: got state msg: 153c9e9f-39a4-11e5-92cb-cf751e6586af from 0 (heartbeat1)150803 13:54:20 [Note] WSREP: STATE EXCHANGE: got state msg: 153c9e9f-39a4-11e5-92cb-cf751e6586af from 1 (heartbeat2)150803 13:54:20 [Note] WSREP: Quorum results:version = 3,component = PRIMARY,conf_id = 1,members = 1/2 (joined/total),act_id = 0,last_appl. = 0,protocols = 0/7/3 (gcs/repl/appl),group UUID = fcd75fb1-39a3-11e5-a4b2-7341b03f99e0150803 13:54:20 [Note] WSREP: Flow-control interval: [23, 23]150803 13:54:20 [Note] WSREP: New cluster view: global state: fcd75fb1-39a3-11e5-a4b2-7341b03f99e0:0, view# 2: Primary, number of nodes: 2, my index: 1, protocol version 3150803 13:54:20 [Note] WSREP: wsrep_notify_cmd is not defined, skipping notification.150803 13:54:20 [Note] WSREP: REPL Protocols: 7 (3, 2)150803 13:54:20 [Note] WSREP: Service thread queue flushed.150803 13:54:20 [Note] WSREP: Assign initial position for certification: 0, protocol version: 3150803 13:54:20 [Note] WSREP: Service thread queue flushed.150803 13:54:20 [Note] WSREP: Member 0.0 (heartbeat1) requested state transfer from ‘*any*‘. Selected 1.0 (heartbeat2)(SYNCED) as donor.150803 13:54:20 [Note] WSREP: Shifting SYNCED -> DONOR/DESYNCED (TO: 0)150803 13:54:20 [Note] WSREP: wsrep_notify_cmd is not defined, skipping notification.150803 13:54:21 [Note] WSREP: Running: ‘wsrep_sst_rsync --role ‘donor‘ --address ‘10.0.0.7:4444/rsync_sst‘ --auth ‘thdl:ldht‘ --socket ‘/var/lib/mysql/mysql.sock‘ --datadir ‘/var/lib/mysql/‘ --defaults-file ‘/etc/my.cnf‘ --defaults-group-suffix ‘‘ ‘‘ --gtid ‘fcd75fb1-39a3-11e5-a4b2-7341b03f99e0:0‘‘150803 13:54:21 [Note] WSREP: sst_donor_thread signaled with 0150803 13:54:21 [Note] WSREP: Flushing tables for SST...150803 13:54:21 [Note] WSREP: Provider paused at fcd75fb1-39a3-11e5-a4b2-7341b03f99e0:0 (5)150803 13:54:21 [Note] WSREP: Tables flushed.150803 13:54:22 [Note] WSREP: (fcd17198, ‘tcp://0.0.0.0:4567‘) turning message relay requesting off150803 13:54:32 [Note] WSREP: resuming provider at 5150803 13:54:32 [Note] WSREP: Provider resumed.150803 13:54:32 [Note] WSREP: 1.0 (heartbeat2): State transfer to 0.0 (heartbeat1) complete.150803 13:54:32 [Note] WSREP: Shifting DONOR/DESYNCED -> JOINED (TO: 0)150803 13:54:32 [Note] WSREP: Member 1.0 (heartbeat2) synced with group.150803 13:54:32 [Note] WSREP: Shifting JOINED -> SYNCED (TO: 0)150803 13:54:32 [Note] WSREP: Synchronized with group, ready for connections150803 13:54:32 [Note] WSREP: wsrep_notify_cmd is not defined, skipping notification.54:32 [Note] WSREP: wsrep_notify_cmd is not defined, skipping notification.150803 13:54:33 [Note] WSREP: 0.0 (heartbeat1): State transfer from 1.0 (heartbeat2) complete.150803 13:54:33 [Note] WSREP: Member 0.0 (heartbeat1) synced with group.150803 13:56:05 [Note] WSREP: (fcd17198, ‘tcp://0.0.0.0:4567‘) turning message relay requesting on, nonlive peers: tcp://10.0.0.9:4567150803 13:56:06 [Note] WSREP: declaring 14925073 at tcp://10.0.0.7:4567 stable150803 13:56:06 [Note] WSREP: declaring 47c7af9c at tcp://10.0.0.9:4567 stable150803 13:56:06 [Note] WSREP: Node 14925073 state prim150803 13:56:06 [Note] WSREP: view(view_id(PRIM,14925073,3) memb {14925073,047c7af9c,0fcd17198,0} joined {} left {} partitioned {})150803 13:56:06 [Note] WSREP: save pc into disk150803 13:56:06 [Note] WSREP: New COMPONENT: primary = yes, bootstrap = no, my_idx = 2, memb_num = 3150803 13:56:06 [Note] WSREP: STATE EXCHANGE: Waiting for state UUID.150803 13:56:06 [Note] WSREP: STATE EXCHANGE: sent state msg: 549645d5-39a4-11e5-9d32-971f72466c97150803 13:56:06 [Note] WSREP: STATE EXCHANGE: got state msg: 549645d5-39a4-11e5-9d32-971f72466c97 from 0 (heartbeat1)150803 13:56:06 [Note] WSREP: STATE EXCHANGE: got state msg: 549645d5-39a4-11e5-9d32-971f72466c97 from 2 (heartbeat2)150803 13:56:07 [Note] WSREP: STATE EXCHANGE: got state msg: 549645d5-39a4-11e5-9d32-971f72466c97 from 1 (heartbeat3)150803 13:56:07 [Note] WSREP: Quorum results:version = 3,component = PRIMARY,conf_id = 2,members = 2/3 (joined/total),act_id = 0,last_appl. = 0,protocols = 0/7/3 (gcs/repl/appl),group UUID = fcd75fb1-39a3-11e5-a4b2-7341b03f99e0150803 13:56:07 [Note] WSREP: Flow-control interval: [28, 28]150803 13:56:07 [Note] WSREP: New cluster view: global state: fcd75fb1-39a3-11e5-a4b2-7341b03f99e0:0, view# 3: Primary, number of nodes: 3, my index: 2, protocol version 3150803 13:56:07 [Note] WSREP: wsrep_notify_cmd is not defined, skipping notification.150803 13:56:07 [Note] WSREP: REPL Protocols: 7 (3, 2)150803 13:56:07 [Note] WSREP: Service thread queue flushed.150803 13:56:07 [Note] WSREP: Assign initial position for certification: 0, protocol version: 3150803 13:56:07 [Note] WSREP: Service thread queue flushed.150803 13:56:07 [Note] WSREP: Service thread queue flushed.150803 13:56:08 [Note] WSREP: (fcd17198, ‘tcp://0.0.0.0:4567‘) turning message relay requesting off150803 13:56:08 [Note] WSREP: Member 1.0 (heartbeat3) requested state transfer from ‘*any*‘. Selected 0.0 (heartbeat1)(SYNCED) as donor.150803 13:56:15 [Note] WSREP: 0.0 (heartbeat1): State transfer to 1.0 (heartbeat3) complete.150803 13:56:15 [Note] WSREP: Member 0.0 (heartbeat1) synced with group.150803 13:56:17 [Note] WSREP: 1.0 (heartbeat3): State transfer from 0.0 (heartbeat1) complete.150803 13:56:17 [Note] WSREP: Member 1.0 (heartbeat3) synced with group.
Mysql –uroot -p
MariaDB [mysql]> show status like ‘wsrep%‘;
+------------------------------+-------------------------------------------+
| Variable_name | Value |
+------------------------------+-------------------------------------------+
| wsrep_local_state_uuid | fcd75fb1-39a3-11e5-a4b2-7341b03f99e0 |
| wsrep_protocol_version | 7 |
| wsrep_last_committed | 0 |
| wsrep_replicated | 0 |
| wsrep_replicated_bytes | 0 |
| wsrep_repl_keys | 0 |
| wsrep_repl_keys_bytes | 0 |
| wsrep_repl_data_bytes | 0 |
| wsrep_repl_other_bytes | 0 |
| wsrep_received | 7 |
| wsrep_received_bytes | 656 |
| wsrep_local_commits | 0 |
| wsrep_local_cert_failures | 0 |
| wsrep_local_replays | 0 |
| wsrep_local_send_queue | 0 |
| wsrep_local_send_queue_max | 1 |
| wsrep_local_send_queue_min | 0 |
| wsrep_local_send_queue_avg | 0.000000 |
| wsrep_local_recv_queue | 0 |
| wsrep_local_recv_queue_max | 2 |
| wsrep_local_recv_queue_min | 0 |
| wsrep_local_recv_queue_avg | 0.285714 |
| wsrep_local_cached_downto | 18446744073709551615 |
| wsrep_flow_control_paused_ns | 0 |
| wsrep_flow_control_paused | 0.000000 |
| wsrep_flow_control_sent | 0 |
| wsrep_flow_control_recv | 0 |
| wsrep_cert_deps_distance | 0.000000 |
| wsrep_apply_oooe | 0.000000 |
| wsrep_apply_oool | 0.000000 |
| wsrep_apply_window | 0.000000 |
| wsrep_commit_oooe | 0.000000 |
| wsrep_commit_oool | 0.000000 |
| wsrep_commit_window | 0.000000 |
| wsrep_local_state | 4 |
| wsrep_local_state_comment | Synced |
| wsrep_cert_index_size | 0 |
| wsrep_causal_reads | 0 |
| wsrep_cert_interval | 0.000000 |
| wsrep_incoming_addresses | 10.0.0.7:3306,10.0.0.9:3306,10.0.0.8:3306 |
| wsrep_evs_delayed | |
| wsrep_evs_evict_list | |
| wsrep_evs_repl_latency | 0/0/0/0/0 |
| wsrep_evs_state | OPERATIONAL |
| wsrep_gcomm_uuid | fcd17198-39a3-11e5-8ae4-3be1332a622a |
| wsrep_cluster_conf_id | 3 |
| wsrep_cluster_size | 3 |
| wsrep_cluster_state_uuid | fcd75fb1-39a3-11e5-a4b2-7341b03f99e0 |
| wsrep_cluster_status | Primary |
| wsrep_connected | ON |
| wsrep_local_bf_aborts | 0 |
| wsrep_local_index | 2 |
| wsrep_provider_name | Galera |
| wsrep_provider_vendor | Codership Oy <info@codership.com> |
| wsrep_provider_version | 25.3.9(r3387) |
| wsrep_ready | ON |
| wsrep_thread_count | 3 |
+------------------------------+-------------------------------------------+
57 rows in set (0.00 sec)
关停其中一台MariaDB 查看wsrep_incoming_addresses 的状态
查看MySQL版本: mysql> SHOW GLOBAL VARIABLES LIKE ‘version‘;
查看wsrep版本: mysql> SHOW GLOBAL STATUS LIKE ‘wsrep_provider_version‘;
查看wsrep有关的所有变量: mysql> SHOW VARIABLES LIKE ‘wsrep%‘ \G
查看Galera集群状态: mysql> show status like ‘wsrep%‘;
集群完整性检查:
wsrep_cluster_state_uuid:在集群所有节点的值应该是相同的,有不同值的节点,说明其没有连接入集群.
wsrep_cluster_conf_id:正常情况下所有节点上该值是一样的.如果值不同,说明该节点被临时"分区"了.当节点之间网络连接恢复的时候应该会恢复一样的值.
wsrep_cluster_size:如果这个值跟预期的节点数一致,则所有的集群节点已经连接.
wsrep_cluster_status:集群组成的状态.如果不为"Primary",说明出现"分区"或是"split-brain"状况.
节点状态检查:
wsrep_ready: 该值为ON,则说明可以接受SQL负载.如果为Off,则需要检查wsrep_connected.
wsrep_connected: 如果该值为Off,且wsrep_ready的值也为Off,则说明该节点没有连接到集群.(可能是wsrep_cluster_address或wsrep_cluster_name等配置错造成的.具体错误需要查看错误日志)
wsrep_local_state_comment:如果wsrep_connected为On,但wsrep_ready为OFF,则可以从该项查看原因.
复制健康检查:
wsrep_flow_control_paused:表示复制停止了多长时间.即表明集群因为Slave延迟而慢的程度.值为0~1,越靠近0越好,值为1表示复制完全停止.可优化wsrep_slave_threads的值来改善.
wsrep_cert_deps_distance:有多少事务可以并行应用处理.wsrep_slave_threads设置的值不应该高出该值太多.
wsrep_flow_control_sent:表示该节点已经停止复制了多少次.
wsrep_local_recv_queue_avg:表示slave事务队列的平均长度.slave瓶颈的预兆.
最慢的节点的wsrep_flow_control_sent和wsrep_local_recv_queue_avg这两个值最高.这两个值较低的话,相对更好.
检测慢网络问题:
wsrep_local_send_queue_avg:网络瓶颈的预兆.如果这个值比较高的话,可能存在网络瓶
冲突或死锁的数目:
wsrep_last_committed:最后提交的事务数目
wsrep_local_cert_failures和wsrep_local_bf_aborts:回滚,检测到的冲突数目
本文出自 “it1693” 博客,请务必保留此出处http://it1693.blog.51cto.com/2342744/1681413
Install MariaDB Galera Cluster 10.0.20
标签:linux 数据库软件 mariadb galera cluster
原文地址:http://it1693.blog.51cto.com/2342744/1681413