0

I changed the path from my mariaDB data files to /mnt/datosDRBD/mariaDB

iba@iba-master2:/$ mysql -u root -p -e "SELECT @@datadir;"
Enter password: 
+-------------------------+
| @@datadir               |
+-------------------------+
| /mnt/datosDRBD/mariaDB/ |
+-------------------------+
iba@iba-master2:/$ 

My service mariadb.service start, it's works, but show errors:

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)

I can't do:

iba@iba-master2:/$ mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
iba@iba-master2:/$ 

because I have a password for root.

I don't know if only localhost host is correct:

iba@iba-master2:/$ mysql -u root -p -e "select user,host from mysql.user;"
Enter password: 
+------+-----------+
| user | host      |
+------+-----------+
| root | localhost |
+------+-----------+
iba@iba-master2:/$

The service is started manually and works, even with errors. But it doesn't start from "pcs" (pacemaker) where it should start after mounting the filesystem.

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:/$ 

This is my constraint list, (DRBD > Filesystem > Virtual 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:/$ 

Any idea? thx a lot.

  • *I can't do .. because I have a password for root* When `-p` is not specified in the command line then server assumes that it is empty. If the password is set then you **must** add `-p` to the command line. If you don't want to enter the password manually then you may add it into the command line immediately after the option key (in this case server will use it but will report that this is not safe for security reasons). Also you may create and use another account with the privileges enough for for your task, without the password or with it. – Akina Mar 31 '21 at 09:43
  • Yes, i know, but "Version check failed" because mysqlcheck try to check version without -p, when systemctl start mariadb – Maria Paricio Blasco Mar 31 '21 at 09:56
  • *mysqlcheck try to check version without -p* https://mariadb.com/kb/en/mysqlcheck/ - `-u` and `-p` are present. mysqlcheck must know what to check when it is called - so there is according command line somewhere in some file. And it reads MariaDB options file(s) additionally. So there is at least 2 places where you may specify user/password settings. – Akina Mar 31 '21 at 10:05

1 Answers1

0

OK, I solved it, changing the resource in 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

now starts the service, i have to check how do for not start in slave node, but step by step.