Aiven-Open / myhoard

MySQL Backup and Point-in-time Recovery service
Apache License 2.0
93 stars 20 forks source link

Installation Instructions #191

Open CodeBleu opened 3 weeks ago

CodeBleu commented 3 weeks ago

@rikonen @rdunklau @aiven-amartin

What can we help you with?

How do I install this?

Where would you expect to find this information?

README

CodeBleu commented 2 weeks ago

@rikonen pretty please? I would really like to use this software, but there is no clear docs on how to actually install this (Ubuntu in my case)

rikonen commented 2 weeks ago

I'm not really working on the project anymore. There is currently no support packaging this for Ubuntu specifically unfortunately. In general the expectation is that user mysql is used to run both MyHoard and MySQL server, MySQL server is managed via systemd and the unit name is mysqld, the following is defined in sudoers

mysql   ALL=(ALL) NOPASSWD: /usr/bin/systemctl start mysqld
mysql   ALL=(ALL) NOPASSWD: /usr/bin/systemctl stop mysqld
mysql   ALL=(ALL) NOPASSWD: /usr/bin/systemctl restart mysqld
mysql   ALL=(ALL) NOPASSWD: /usr/bin/myhoard_mysql_env_update -f /etc/systemd/system/mysqld.environment -b false -g false
mysql   ALL=(ALL) NOPASSWD: /usr/bin/myhoard_mysql_env_update -f /etc/systemd/system/mysqld.environment -b false -g true
mysql   ALL=(ALL) NOPASSWD: /usr/bin/myhoard_mysql_env_update -f /etc/systemd/system/mysqld.environment -b true -g false
mysql   ALL=(ALL) NOPASSWD: /usr/bin/myhoard_mysql_env_update -f /etc/systemd/system/mysqld.environment -b true -g true

, /usb/bin/myhoard and /usr/bin/myhoard_mysql_env_update are executable files that run myhoard.py and myhoard_mysql_env_update.py python modules respectively, and the myhoard.json file is updated according to your configuration to contain appropriate parameters. The myhoard.unit file has an example of how to configure systemd service for MyHoard itself.

CodeBleu commented 2 weeks ago

@rikonen Thank you for the reply.

CodeBleu commented 2 weeks ago

@rikonen I was able to get things workong ( I believe ).

I connected as the mysql user and:

[Unit]
Description=MySQL streaming backup service

[Service]
User=mysql
Group=mysql
Type=notify
Restart=always
RestartSec=5s
Type=forking
KillMode=process
TimeoutSec=60s
ExecStart=/bin/bash -c '/var/lib/myhoard/venv/bin/myhoard --config /var/lib/myhoard/myhoard.json & echo "Service started"'
ExecStop=/bin/kill -TERM $MAINPID
ExecReload=/bin/kill -HUP $MAINPID
WorkingDirectory=/var/lib/myhoard
# Percona XtraBackup needs to keep all database tables open simultaneously and it inherits our
# nofile limit. Set to very large number to allow it to operate in large environments
LimitNOFILE=2000000

[Install]
WantedBy=multi-user.target

Now my questions are:

  1. I do not have a /etc/systemd/system/mysqld.environment file and not sure what goes in there or what it's for? My systemd service name for mysql is mysql not mysqld
  2. How can I validate the backup is good without restoring it?
  3. Is it possible to do a restore on the master mysql server?