Mysql

Ubuntu 上的 MariaDB 10.1.16 無法啟動:WSREP 無法恢復位置

  • August 12, 2016

我正在使用10.110.1.16-MariaDB-1~xenial官方 MariaDB apt 儲存庫$$ stable $$,通過德克薩斯大學的鏡子

我在 3 台 Ubuntu 16.04 伺服器上設置了一個執行良好的 MariaDB Galera 集群。

然後我升級了它們。現在我什麼都沒有了。

升級到 10.1.16 失敗,很快就把整個集群搞垮了。我沒有輸出,但 dpkg 設置mariadb-servermariadb-server-10.1.

我有備份,所以我從我的伺服器中清除了 MariaDB/MySQL/Galera 的所有痕跡(包括刪除/var/lib/mysql//etc/mysql//var/log/mysql/)並重新開始。但是,現在,在每台伺服器上進行全新安裝後,標準系統啟動腳本都不起作用。我懷疑這也是升級過程apt失敗的原因。

我在第一個節點上嘗試了以下各項:

galera_new_cluster
service mysql bootstrap
service mysql bootstrap --wsrep-new-cluster
service mysql bootstrap --wsrep-cluster-address="gcomm://"
service mysql start
service mysql start --wsrep-new-cluster
service mysql start --wsrep-cluster-address="gcomm://"
systemctl start mariadb
systemctl start mariadb --wsrep-new-cluster
systemctl start mariadb --wsrep-cluster-address="gcomm://"

每一個都給我相同的輸出:

Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details.

systemctl status mariadb.service:

● mariadb.service - MariaDB database server
  Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
 Drop-In: /etc/systemd/system/mariadb.service.d
          └─migrated-from-my.cnf-settings.conf
  Active: failed (Result: exit-code) since Fri 2016-07-22 13:29:45 CDT; 42s ago
 Process: 10799 ExecStartPre=/bin/sh -c VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ] &&   systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=1/FAILURE)
 Process: 10794 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Main PID: 16865 (code=exited, status=0/SUCCESS)

Jul 22 13:29:41 sql2 systemd[1]: Starting MariaDB database server...
Jul 22 13:29:45 sql2 mysqld[10799]: WSREP: Failed to recover position: '2016-07-22 13:29:41 140110745778432 [Note] /usr/sbin/mysqld (mysqld 10.1.16-MariaDB-1~xenial) starting as process 11080 ...'
Jul 22 13:29:45 sql2 systemd[1]: mariadb.service: Control process exited, code=exited status=1
Jul 22 13:29:45 sql2 systemd[1]: Failed to start MariaDB database server.
Jul 22 13:29:45 sql2 systemd[1]: mariadb.service: Unit entered failed state.
Jul 22 13:29:45 sql2 systemd[1]: mariadb.service: Failed with result 'exit-code'.

我現在可以啟動伺服器的唯一方法是手動執行:

sudo -u mysql mysqld --wsrep-cluster-address='gcomm://'

在第一個節點上,然後:

sudo -u mysql mysqld --wsrep-cluster-address='gcomm://ip1,ip2,ip3'

在其他兩個節點上。那行得通,我又有了一個工作集群。但是現在,systemd/systemctl 不知道該服務正在執行。似乎 systemd 啟動腳本根本無法使用wsrep-cluster-address我的配置文件中的設置。將其指定為servicesystemctl命令行也不起作用。

我應該如何啟動mariadb?

galera_recovery.sh 腳本中存在錯誤。 https://jira.mariadb.org/browse/MDEV-10396

我已經能夠通過降級到 10.1.14 暫時緩解我的問題:

wget https://downloads.mariadb.com/files/MariaDB/mariadb-10.1.14/repo/ubuntu/pool/main/m/mariadb-10.1/mariadb-server-10.1_10.1.14+maria-1~xenial_amd64.deb
wget https://downloads.mariadb.com/files/MariaDB/mariadb-10.1.14/repo/ubuntu/pool/main/m/mariadb-10.1/libmariadbclient18_10.1.14+maria-1~xenial_amd64.deb
wget https://downloads.mariadb.com/files/MariaDB/mariadb-10.1.14/repo/ubuntu/pool/main/m/mariadb-10.1/libmysqlclient18_10.1.14+maria-1~xenial_amd64.deb
wget https://downloads.mariadb.com/files/MariaDB/mariadb-10.1.14/repo/ubuntu/pool/main/m/mariadb-10.1/mariadb-client-10.1_10.1.14+maria-1~xenial_amd64.deb
wget https://downloads.mariadb.com/files/MariaDB/mariadb-10.1.14/repo/ubuntu/pool/main/m/mariadb-10.1/mariadb-client-core-10.1_10.1.14+maria-1~xenial_amd64.deb
wget https://downloads.mariadb.com/files/MariaDB/mariadb-10.1.14/repo/ubuntu/pool/main/m/mariadb-10.1/mariadb-common_10.1.14+maria-1~xenial_all.deb
wget https://downloads.mariadb.com/files/MariaDB/mariadb-10.1.14/repo/ubuntu/pool/main/m/mariadb-10.1/mariadb-server-core-10.1_10.1.14+maria-1~xenial_amd64.deb
wget https://downloads.mariadb.com/files/MariaDB/mariadb-10.1.14/repo/ubuntu/pool/main/m/mariadb-10.1/mysql-common_10.1.14+maria-1~xenial_all.deb
wget https://downloads.mariadb.com/files/MariaDB/mariadb-10.1.14/repo/ubuntu/pool/main/g/galera-3/galera-3_25.3.15-xenial_amd64.deb
apt purge mariadb-server
apt autoremove --purge
apt clean
rm -rf /etc/mysql/
rm -rf /var/lib/mysql/
rm -rf /var/log/mysql/
rm -f /var/log/mysql.*
rm -f /etc/systemd/system/mysql.service
rm -f /etc/systemd/system/mysqld.service
rm -f /etc/rc0.d/K03mysql
rm -f /etc/rc1.d/K03mysql
rm -f /etc/rc2.d/S03mysql
rm -f /etc/rc3.d/S03mysql
rm -f /etc/rc4.d/S03mysql
rm -f /etc/rc5.d/S03mysql
rm -f /etc/rc6.d/K03mysql
rm -f /var/lib/systemd/deb-systemd-helper-enabled/mysql.service
rm -f /var/lib/systemd/deb-systemd-helper-enabled/mysqld.service
rm -f /etc/apparmor.d/abstractions/mysql
rm -f /etc/apparmor.d/cache/usr.sbin.mysqld
rm -rf /etc/systemd/system/mariadb.service.d
rm -f /etc/systemd/system/multi-user.target.wants/mariadb.service
rm -f /var/lib/systemd/deb-systemd-helper-enabled/mariadb.service.dsh-also
rm -f /var/lib/systemd/deb-systemd-helper-enabled/multi-user.target.wants/mariadb.service
rm -f /var/lib/systemd/deb-systemd-helper-enabled/mysql.service
rm -f /var/lib/systemd/deb-systemd-helper-enabled/mysqld.service
rm -rf /var/lib/apt/lists/*
apt update
apt install iproute libaio1 libcgi-fast-perl libcgi-pm-perl libdbd-mysql-perl libdbi-perl libencode-locale-perl libfcgi-perl libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl libjemalloc1 liblwp-mediatypes-perl libtimedate-perl liburi-perl socat
dpkg -i mysql-common_10.1.14+maria-1~xenial_all.deb 
dpkg -i mariadb-common_10.1.14+maria-1~xenial_all.deb 
dpkg -i libmariadbclient18_10.1.14+maria-1~xenial_amd64.deb libmysqlclient18_10.1.14+maria-1~xenial_amd64.deb mariadb-client-10.1_10.1.14+maria-1~xenial_amd64.deb mariadb-client-core-10.1_10.1.14+maria-1~xenial_amd64.deb mariadb-server-10.1_10.1.14+maria-1~xenial_amd64.deb mariadb-server-core-10.1_10.1.14+maria-1~xenial_amd64.deb galera-3_25.3.15-xenial_amd64.deb 

現在,我可以galera_new_cluster使用service mysql start.

10.1.16 中的 systemd/systemctl 腳本一定有 bug。

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