Skip to content

Not working on RHEL 7 based system #32

@bertalanimre

Description

@bertalanimre

Found out, while trying to restore a backup, that the script is not able to run. Most likely because the command called for stopping the mysql service is wrong.
It should look like this: systemctl restart mariadb

[root@PHPlist 20151123]# pyxtrabackup-restore --base-archive=/mnt/myrepo/20151123/INC/base_backup_20151123_1326.tar.gz --incremental-archive=/mnt/myrepo/20151123/INC/inc_4_backup_20151123_1400.tar.gz --user=root --password=########
ERROR:xtrabackup.restoration_tools:Unable to manage MySQL service.
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/xtrabackup/restoration_tools.py", line 30, in stop_service
    self.command_executor.exec_manage_service('mysql', 'stop')
  File "/usr/lib/python2.7/site-packages/xtrabackup/command_executor.py", line 68, in exec_manage_service
    self.exec_command(command)
  File "/usr/lib/python2.7/site-packages/xtrabackup/command_executor.py", line 13, in exec_command
    stderr=subprocess.STDOUT)
  File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.7/subprocess.py", line 1308, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
ERROR:xtrabackup.restoration:pyxtrabackup failed.
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/xtrabackup/restoration.py", line 65, in main
    arguments['--restart'])
  File "/usr/lib/python2.7/site-packages/xtrabackup/restoration_tools.py", line 145, in start_restoration
    self.stop_service()
  File "/usr/lib/python2.7/site-packages/xtrabackup/restoration_tools.py", line 30, in stop_service
    self.command_executor.exec_manage_service('mysql', 'stop')
  File "/usr/lib/python2.7/site-packages/xtrabackup/command_executor.py", line 68, in exec_manage_service
    self.exec_command(command)
  File "/usr/lib/python2.7/site-packages/xtrabackup/command_executor.py", line 13, in exec_command
    stderr=subprocess.STDOUT)
  File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.7/subprocess.py", line 1308, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

After the change of command_executor.py at line 67

    #command = ['/etc/init.d/' + service_name, action] (commented out)
    command = ['systemctl', action, 'mariadb'] (simple method of start/stop/restart command)

The backup seems to run fine:

[root@PHPlist]# pyxtrabackup-restore --base-archive=/mnt/myrepo/20151123/INC/base_backup_20151123_1326.tar.gz --incremental-archive=/mnt/myrepo/20151123/INC/inc_4_backup_20151123_1400.tar.gz --user=root --password=########
INFO:xtrabackup.restoration_tools:Base backup restoration time: 0:00:01.755533 - Duration: 1
INFO:xtrabackup.restoration_tools:Incremental step #1 restoration time: 0:00:02.021342 - Duration: 2
INFO:xtrabackup.restoration_tools:Incremental step #2 restoration time: 0:00:01.363370 - Duration: 1
INFO:xtrabackup.restoration_tools:Incremental step #3 restoration time: 0:00:01.158548 - Duration: 1
INFO:xtrabackup.restoration_tools:Incremental step #4 restoration time: 0:00:01.504667 - Duration: 1
INFO:xtrabackup.restoration_tools:Backup final preparation time: 0:00:05.507104 - Duration: 5

HOWEVER:
Somewhy this did not restart the mariadb service. If I try to start it manually it gives me the stranges error I've ever seen connected to mariadb:

[root@PHPlist xtrabackup]# systemctl start mariadb
Job for mariadb.service failed. See 'systemctl status mariadb.service' and 'journalctl -xn' for details.
[root@PHPlist xtrabackup]# systemctl status mariadb.service
mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled)
   Active: failed (Result: exit-code) since h 2015-11-23 16:31:03 CET; 5s ago
  Process: 19385 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=1/FAILURE)
  Process: 19384 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=0/SUCCESS)
  Process: 19357 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
 Main PID: 19384 (code=exited, status=0/SUCCESS)

nov 23 16:31:02 PHPlist systemd[1]: Starting MariaDB database server...
nov 23 16:31:02 PHPlist mysqld_safe[19384]: 151123 16:31:02 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
nov 23 16:31:02 PHPlist mysqld_safe[19384]: 151123 16:31:02 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
nov 23 16:31:03 PHPlist mysqld_safe[19384]: 151123 16:31:03 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
nov 23 16:31:03 PHPlist systemd[1]: mariadb.service: control process exited, code=exited status=1
nov 23 16:31:03 PHPlist systemd[1]: Failed to start MariaDB database server.
nov 23 16:31:03 PHPlist systemd[1]: Unit mariadb.service entered failed state.

[root@PHPlist xtrabackup]# journalctl -xn
-- Logs begin at h 2015-11-23 11:46:25 CET, end at h 2015-11-23 16:30:29 CET. --
nov 23 16:30:29 PHPlist dbus[430]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
nov 23 16:30:29 PHPlist systemd[1]: Starting Network Manager Script Dispatcher Service...
-- Subject: Unit NetworkManager-dispatcher.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit NetworkManager-dispatcher.service has begun starting up.
nov 23 16:30:29 PHPlist dhclient[453]: bound to 10.0.0.233 -- renewal in 47 seconds.
nov 23 16:30:29 PHPlist dbus-daemon[430]: dbus[430]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
nov 23 16:30:29 PHPlist dbus[430]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
nov 23 16:30:29 PHPlist systemd[1]: Started Network Manager Script Dispatcher Service.
-- Subject: Unit NetworkManager-dispatcher.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit NetworkManager-dispatcher.service has finished starting up.
-- 
-- The start-up result is done.
nov 23 16:30:29 PHPlist nm-dispatcher[19335]: Dispatching action 'dhcp4-change' for enp0s3
nov 23 16:30:29 PHPlist systemd[1]: mariadb.service: control process exited, code=exited status=1
nov 23 16:30:29 PHPlist systemd[1]: Failed to start MariaDB database server.
-- Subject: Unit mariadb.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mariadb.service has failed.
-- 
-- The result is failed.
nov 23 16:30:29 PHPlist systemd[1]: Unit mariadb.service entered failed state.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions