Mariadb

Mariadb galera 集群主節點已啟動並報告 2 個節點,但第二個節點服務說正在啟動 mariadb

  • November 28, 2020

我設法啟動了主節點 mariadb galera 集群,然後啟動了第二個節點並檢查了第一個主節點;

$ sudo mysql -u root -p -e "SHOW STATUS LIKE 'wsrep_cluster_size'"
Enter password: 
+--------------------+-------+
| Variable_name      | Value |
+--------------------+-------+
| wsrep_cluster_size | 2     |
+--------------------+-------+

但是當我檢查第二個節點時它說:

Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
  Active: activating (start) since Sat 2020-11-28 19:08:24 GMT; 11min ago
    Docs: man:mysqld(8)
          https://mariadb.com/kb/en/library/systemd/
 Process: 7659 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUC
 Process: 7660 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SU
 Process: 7662 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bi
Main PID: 7829 (mysqld)
  Status: "WSREP state transfer ongoing, current seqno: -1 waited 690.000000 secs"
   Tasks: 12 (limit: 881)
  CGroup: /system.slice/mariadb.service
          ├─ 7829 /usr/sbin/mysqld --wsrep_start_position=00000000-0000-0000-0000-000000000000:-1
          ├─ 7837 sh -c wsrep_sst_rsync --role 'joiner' --address '192.168.5.132' --datadir '/var/lib/mysql/' --pa
          ├─ 7838 /bin/bash -ue /usr//bin/wsrep_sst_rsync --role joiner --address 192.168.5.132 --datadir /var/lib
          ├─ 7890 rsync --daemon --no-detach --port 4444 --config /var/lib/mysql//rsync_sst.conf --address 192.168
          └─10407 sleep 1

Nov 28 19:08:24 raspberrypi systemd[1]: Starting MariaDB 10.3.25 database server...
Nov 28 19:08:27 raspberrypi sh[7662]: WSREP: Recovered position 00000000-0000-0000-0000-000000000000:-1
Nov 28 19:08:28 raspberrypi mysqld[7829]: 2020-11-28 19:08:28 0 [Note] /usr/sbin/mysqld (mysqld 10.3.25-MariaDB-0+d
Nov 28 19:08:28 raspberrypi mysqld[7829]: 2020-11-28 19:08:28 0 [Warning] Could not increase number of max_open_fil
Nov 28 19:08:31 raspberrypi rsyncd[7890]: rsyncd version 3.1.3 starting, listening on port 4444

這是什麼意思 ?埠 4444 在兩個節點上都打開。

我在配置 2 個節點時遇到了同樣的問題。mariadb-10-1-galera-cluster-error

使用 Galera Cluster 時,建議集群至少有 3 個節點。在雙節點集群中,當存在一對沖突的事務時,可能會導致腦裂情況。此外,當一個節點發生故障時,其餘節點將無法執行。(兩節點集群

引用自:https://dba.stackexchange.com/questions/280511