MariaDB 服务处于活动状态但有错误,不适用于起搏器
MariaDB service active but with errors, does not work with pacemaker
我将我的 mariaDB 数据文件的路径更改为 /mnt/datosDRBD/mariaDB
iba@iba-master2:/$ mysql -u root -p -e "SELECT @@datadir;"
Enter password:
+-------------------------+
| @@datadir |
+-------------------------+
| /mnt/datosDRBD/mariaDB/ |
+-------------------------+
iba@iba-master2:/$
我的服务 mariadb.service 启动,它可以工作,但显示错误:
iba@iba-master2:/$ sudo systemctl status mariadb.service
● mariadb.service - MariaDB 10.3.25 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; disabled; vendor preset: enabled)
Active: active (running) since Wed 2021-03-31 10:31:25 CEST; 7min ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 13304 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Process: 13312 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 13315 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl se>
Process: 13394 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 13396 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
Main PID: 13362 (mysqld)
Status: "Taking your SQL requests now..."
Tasks: 31 (limit: 18726)
Memory: 67.8M
CGroup: /system.slice/mariadb.service
└─13362 /usr/sbin/mysqld
mar 31 10:31:24 iba-master2 mysqld[13362]: 2021-03-31 10:31:24 0 [Warning] Could not increase number of max_open_files to more than 16384 (request: 32198)
mar 31 10:31:25 iba-master2 systemd[1]: Started MariaDB 10.3.25 database server.
mar 31 10:31:25 iba-master2 /etc/mysql/debian-start[13398]: Upgrading MySQL tables if necessary.
mar 31 10:31:25 iba-master2 /etc/mysql/debian-start[13401]: Looking for 'mysql' as: /usr/bin/mysql
mar 31 10:31:25 iba-master2 /etc/mysql/debian-start[13401]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
mar 31 10:31:25 iba-master2 /etc/mysql/debian-start[13401]: Version check failed. Got the following error when calling the 'mysql' command line client
mar 31 10:31:25 iba-master2 /etc/mysql/debian-start[13401]: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
mar 31 10:31:25 iba-master2 /etc/mysql/debian-start[13401]: FATAL ERROR: Upgrade failed
mar 31 10:31:25 iba-master2 /etc/mysql/debian-start[13411]: Checking for insecure root accounts.
mar 31 10:31:25 iba-master2 debian-start[13414]: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
lines 1-27/27 (END)
我做不到:
iba@iba-master2:/$ mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
iba@iba-master2:/$
因为我有root密码
不知道只有localhost主机是否正确:
iba@iba-master2:/$ mysql -u root -p -e "select user,host from mysql.user;"
Enter password:
+------+-----------+
| user | host |
+------+-----------+
| root | localhost |
+------+-----------+
iba@iba-master2:/$
该服务是手动启动的,即使出现错误也能正常工作。但它不是从“pcs”(起搏器)开始的,它应该在安装文件系统后开始。
iba@iba-master2:/$ sudo pcs status
[sudo] password for iba:
Cluster name: cluster_iba
Cluster Summary:
* Stack: corosync
* Current DC: iba-master2 (version 2.0.3-4b1f869f0f) - partition with quorum
* Last updated: Wed Mar 31 10:57:22 2021
* Last change: Tue Mar 30 16:49:47 2021 by root via cibadmin on iba-master2
* 2 nodes configured
* 6 resource instances configured
Node List:
* Online: [ iba-master1 iba-master2 ]
Full List of Resources:
* virtual_ip (ocf::heartbeat:IPaddr2): Started iba-master2
* Clone Set: DrbdData-clone [DrbdData] (promotable):
* Masters: [ iba-master2 ]
* Slaves: [ iba-master1 ]
* DrbdFS (ocf::heartbeat:Filesystem): Started iba-master2
* WebServer (ocf::heartbeat:apache): Started iba-master2
* Maria (ocf::heartbeat:mysql): Stopped
Failed Resource Actions:
* Maria_start_0 on iba-master2 'error' (1): call=33, status='complete', exitreason='MySQL server failed to start (pid=3132) (rc=0), please check your installation', last-rc-change='2021-03-31 10:01:47 +02:00', queued=0ms, exec=4686ms
* Maria_start_0 on iba-master1 'error' (1): call=27, status='complete', exitreason='MySQL server failed to start (pid=2776) (rc=0), please check your installation', last-rc-change='2021-03-31 10:01:33 +02:00', queued=0ms, exec=13545ms
Daemon Status:
corosync: active/enabled
pacemaker: active/enabled
pcsd: active/enabled
iba@iba-master2:/$
这是我的约束列表,(DRBD > 文件系统 > 虚拟 IP > Apache > MariaDB)
iba@iba-master2:/$ sudo pcs constraint list --full
Location Constraints:
Ordering Constraints:
promote DrbdData-clone then start DrbdFS (kind:Mandatory) (id:order-DrbdData-clone-DrbdFS-mandatory)
start DrbdFS then start virtual_ip (kind:Mandatory) (id:order-DrbdFS-virtual_ip-mandatory)
start virtual_ip then start WebServer (kind:Mandatory) (id:order-virtual_ip-WebServer-mandatory)
start WebServer then start Maria (kind:Mandatory) (id:order-WebServer-Maria-mandatory)
Colocation Constraints:
DrbdFS with DrbdData-clone (score:INFINITY) (with-rsc-role:Master) (id:colocation-DrbdFS-DrbdData-clone-INFINITY)
virtual_ip with DrbdFS (score:INFINITY) (id:colocation-virtual_ip-DrbdFS-INFINITY)
WebServer with virtual_ip (score:INFINITY) (id:colocation-WebServer-virtual_ip-INFINITY)
Maria with WebServer (score:INFINITY) (with-rsc-role:Master) (id:colocation-Maria-WebServer-INFINITY)
Ticket Constraints:
iba@iba-master2:/$
有什么想法吗?非常感谢。
好的,我解决了,更改pacemaker中的资源。
sudo pcs cluster cib MariaDB_cfg
sudo pcs -f MariaDB_cfg resource create Maria ocf:heartbeat:mysql \
binary="/usr/bin/mysqld_safe" config="/etc/mysql/my.cnf" \
datadir="/mnt/datosDRBD/mariaDB" pid="/run/mysqld/mysqld.pid" \
socket="/run/mysqld/mysqld.sock" \
additional_parameters="--bind-address=0.0.0.0" op start timeout=60s \
op stop timeout=60s op monitor interval=20s timeout=30s \
on-fail=standby
sudo pcs -f MariaDB_cfg constraint colocation add Maria with WebServer INFINITY with-rsc-role=Master
sudo pcs -f MariaDB_cfg constraint order WebServer then Maria
sudo pcs cluster cib-push MariaDB_cfg
现在启动服务,我必须检查如何不在从节点启动,而是逐步进行。
我将我的 mariaDB 数据文件的路径更改为 /mnt/datosDRBD/mariaDB
iba@iba-master2:/$ mysql -u root -p -e "SELECT @@datadir;"
Enter password:
+-------------------------+
| @@datadir |
+-------------------------+
| /mnt/datosDRBD/mariaDB/ |
+-------------------------+
iba@iba-master2:/$
我的服务 mariadb.service 启动,它可以工作,但显示错误:
iba@iba-master2:/$ sudo systemctl status mariadb.service
● mariadb.service - MariaDB 10.3.25 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; disabled; vendor preset: enabled)
Active: active (running) since Wed 2021-03-31 10:31:25 CEST; 7min ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 13304 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Process: 13312 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 13315 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl se>
Process: 13394 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 13396 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
Main PID: 13362 (mysqld)
Status: "Taking your SQL requests now..."
Tasks: 31 (limit: 18726)
Memory: 67.8M
CGroup: /system.slice/mariadb.service
└─13362 /usr/sbin/mysqld
mar 31 10:31:24 iba-master2 mysqld[13362]: 2021-03-31 10:31:24 0 [Warning] Could not increase number of max_open_files to more than 16384 (request: 32198)
mar 31 10:31:25 iba-master2 systemd[1]: Started MariaDB 10.3.25 database server.
mar 31 10:31:25 iba-master2 /etc/mysql/debian-start[13398]: Upgrading MySQL tables if necessary.
mar 31 10:31:25 iba-master2 /etc/mysql/debian-start[13401]: Looking for 'mysql' as: /usr/bin/mysql
mar 31 10:31:25 iba-master2 /etc/mysql/debian-start[13401]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
mar 31 10:31:25 iba-master2 /etc/mysql/debian-start[13401]: Version check failed. Got the following error when calling the 'mysql' command line client
mar 31 10:31:25 iba-master2 /etc/mysql/debian-start[13401]: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
mar 31 10:31:25 iba-master2 /etc/mysql/debian-start[13401]: FATAL ERROR: Upgrade failed
mar 31 10:31:25 iba-master2 /etc/mysql/debian-start[13411]: Checking for insecure root accounts.
mar 31 10:31:25 iba-master2 debian-start[13414]: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
lines 1-27/27 (END)
我做不到:
iba@iba-master2:/$ mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
iba@iba-master2:/$
因为我有root密码
不知道只有localhost主机是否正确:
iba@iba-master2:/$ mysql -u root -p -e "select user,host from mysql.user;"
Enter password:
+------+-----------+
| user | host |
+------+-----------+
| root | localhost |
+------+-----------+
iba@iba-master2:/$
该服务是手动启动的,即使出现错误也能正常工作。但它不是从“pcs”(起搏器)开始的,它应该在安装文件系统后开始。
iba@iba-master2:/$ sudo pcs status
[sudo] password for iba:
Cluster name: cluster_iba
Cluster Summary:
* Stack: corosync
* Current DC: iba-master2 (version 2.0.3-4b1f869f0f) - partition with quorum
* Last updated: Wed Mar 31 10:57:22 2021
* Last change: Tue Mar 30 16:49:47 2021 by root via cibadmin on iba-master2
* 2 nodes configured
* 6 resource instances configured
Node List:
* Online: [ iba-master1 iba-master2 ]
Full List of Resources:
* virtual_ip (ocf::heartbeat:IPaddr2): Started iba-master2
* Clone Set: DrbdData-clone [DrbdData] (promotable):
* Masters: [ iba-master2 ]
* Slaves: [ iba-master1 ]
* DrbdFS (ocf::heartbeat:Filesystem): Started iba-master2
* WebServer (ocf::heartbeat:apache): Started iba-master2
* Maria (ocf::heartbeat:mysql): Stopped
Failed Resource Actions:
* Maria_start_0 on iba-master2 'error' (1): call=33, status='complete', exitreason='MySQL server failed to start (pid=3132) (rc=0), please check your installation', last-rc-change='2021-03-31 10:01:47 +02:00', queued=0ms, exec=4686ms
* Maria_start_0 on iba-master1 'error' (1): call=27, status='complete', exitreason='MySQL server failed to start (pid=2776) (rc=0), please check your installation', last-rc-change='2021-03-31 10:01:33 +02:00', queued=0ms, exec=13545ms
Daemon Status:
corosync: active/enabled
pacemaker: active/enabled
pcsd: active/enabled
iba@iba-master2:/$
这是我的约束列表,(DRBD > 文件系统 > 虚拟 IP > Apache > MariaDB)
iba@iba-master2:/$ sudo pcs constraint list --full
Location Constraints:
Ordering Constraints:
promote DrbdData-clone then start DrbdFS (kind:Mandatory) (id:order-DrbdData-clone-DrbdFS-mandatory)
start DrbdFS then start virtual_ip (kind:Mandatory) (id:order-DrbdFS-virtual_ip-mandatory)
start virtual_ip then start WebServer (kind:Mandatory) (id:order-virtual_ip-WebServer-mandatory)
start WebServer then start Maria (kind:Mandatory) (id:order-WebServer-Maria-mandatory)
Colocation Constraints:
DrbdFS with DrbdData-clone (score:INFINITY) (with-rsc-role:Master) (id:colocation-DrbdFS-DrbdData-clone-INFINITY)
virtual_ip with DrbdFS (score:INFINITY) (id:colocation-virtual_ip-DrbdFS-INFINITY)
WebServer with virtual_ip (score:INFINITY) (id:colocation-WebServer-virtual_ip-INFINITY)
Maria with WebServer (score:INFINITY) (with-rsc-role:Master) (id:colocation-Maria-WebServer-INFINITY)
Ticket Constraints:
iba@iba-master2:/$
有什么想法吗?非常感谢。
好的,我解决了,更改pacemaker中的资源。
sudo pcs cluster cib MariaDB_cfg
sudo pcs -f MariaDB_cfg resource create Maria ocf:heartbeat:mysql \
binary="/usr/bin/mysqld_safe" config="/etc/mysql/my.cnf" \
datadir="/mnt/datosDRBD/mariaDB" pid="/run/mysqld/mysqld.pid" \
socket="/run/mysqld/mysqld.sock" \
additional_parameters="--bind-address=0.0.0.0" op start timeout=60s \
op stop timeout=60s op monitor interval=20s timeout=30s \
on-fail=standby
sudo pcs -f MariaDB_cfg constraint colocation add Maria with WebServer INFINITY with-rsc-role=Master
sudo pcs -f MariaDB_cfg constraint order WebServer then Maria
sudo pcs cluster cib-push MariaDB_cfg
现在启动服务,我必须检查如何不在从节点启动,而是逐步进行。