Hi All,
I’ve followed numerous guides to set up a simple master slave replication on 2 Ubuntu servers running Mysql v8. I have v8 of Xtrabackup too:
xtrabackup version 8.0.35-30 based on MySQL server 8.0.35 Linux (x86_64) (revision id: 6beb4b49)
The process I did was basically:
ON MASTER:
sudo xtrabackup --backup --user=XYZ --password=ABC --target-dir=/backupfolderonmaster
sudo xtrabackup --prepare --target-dir=/backupfolderonmaster
rsync -avP /backupfolderonmaster/ USER@SLAVESERVERIP:/backupfolderonslave/
ON SLAVE:
sudo systemctl stop mysql
rm -rf /var/lib/mysql/*
sudo xtrabackup --copy-back --target-dir=/backupfolderonslave
THIS IS MY FIRST PROBLEM ==>
root@SLAVESERVER:~# sudo xtrabackup --copy-back --target-dir=/backupfolderonslave
*2024-03-26T00:30:56.407087-00:00 0 [Note] [MY-011825] [Xtrabackup] recognized client arguments: --copy-back=1 --target-dir=/backupfolderonslave *
xtrabackup version 8.0.35-30 based on MySQL server 8.0.35 Linux (x86_64) (revision id: 6beb4b49)
2024-03-26T00:30:56.407151-00:00 0 [ERROR] [MY-011825] [Xtrabackup] datadir must be specified.
So I try with:
sudo xtrabackup --copy-back --target-dir=/backupfolderonslave/ --datadir=/var/lib/mysql/
This copies files across and seems to be happy.
2024-03-26T00:00:50.418982-00:00 0 [Note] [MY-011825] [Xtrabackup] completed OK!
I then do this:
chown -R mysql:mysql /var/lib/mysql
but then MY SECOND PROBLEM ==>
root@SLAVESERVER:~# service mysql start
Job for mysql.service failed because the control process exited with error code.
See “systemctl status mysql.service” and “journalctl -xeu mysql.service” for details.
I then run the following:
root@SLAVESERVER:~# journalctl -xeu mysql.service
░░ A start job for unit mysql.service has begun execution.
*░░ *
░░ The job identifier is 45068.
Mar 26 00:50:24 SLAVESERVERIP mysql-systemd-start[2862328]: MySQL system database not found in /var/lib/mysql. Please run mysqld --initialize.
Mar 26 00:50:24 SLAVESERVERIP systemd[1]: mysql.service: Control process exited, code=exited, status=1/FAILURE
Finally I run:
root@SLAVESERVER:~# mysqld --initialize
root@SLAVESERVER:~# service mysql start
And MySQL starts on the SERVER but the server MySQL interface is asking me for my credentials.
“Warning! Webmin needs to know your MySQL administration login and password in order to manage your database. Please enter your administration username (usually root) and password below.”
Have I skipped a step or done something wrong? Just really confused why I’m being asked for MySQL details on the slave and what those details are. Is it something to do with the my.cnf file from the master?
Sorry for the potentially silly question but I have spent days trying to figure this out to no avail …
Thanks!