What requirements to restore an old backup

Xtrabackup is a whole new thing to me and the task i was assigned needs me to put that into that,
anyway, how can i start restoring it, I have tried several different approaches to different backups
a. installed xtrabackup 2.4 with mysql 57 > succeeded
b. tried the whole same steps and nothing happened, knowing that the problem here is mysql server didn’t work

my question is, how can i know what requirement should i install to restore the backup, and is there any different approach,
thanks in advance

Hello @uellla ,

If you tried to repeat the restore process, then this is expected. Once you run xtrabackup --prepare, you cannot run that command again, as the backup has already been prepared.

Info:
xtrabackup --backup --stream=xbstream --compress --parallel 4 >full_backup.xbs
This will create a full backup in a single, compressed, archive file. Copy this file to your backup vault, where you store backups. Do not store backups on the same machine as MySQL as if you lose this server, you have also lost the backups.

For restore, you will restore the entire database, which means you must start with an empty, and non-running MySQL:

  1. systemctl stop mysql
  2. rm -rf /var/lib/mysql/*
  3. (Extract the archive) xbstream -C /var/lib/mysql/ -vx <full_backup.xbs
  4. (Decompress the backup) xtrabackup --decompress --target-dir /var/lib/mysql --remove-original --compress-threads 4 --parallel 4
  5. (Prepare backup) xtrabackup --prepare --target-dir /var/lib/mysql --use-memory 4G
  6. (Fix permissions) chown -R mysql:mysql /var/lib/mysql
  7. (Start mysql) systemctl start mysql

That’s pretty much the process in 98% of cases. There is LOTS of documentation to read with many examples.

Hello,
THANK YOU for replying so fast . didn’t expect a reply so soon that’s why i reply late,
anyway i did everything in order as you mention and this is what popped up after starting mysql

root@lab:/mnt/e# systemctl start mysql
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 run

Linux lab5.15.167.4-microsoft-standard-WSL2 #1 SMP Tue Nov 5 00:21:55 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
xtrabackup version 8.0.35-31 based on MySQL server 8.0.35 Linux (x86_64) (revision id: 55ec21d7)

&&

mysql  Ver 14.14 Distrib 5.7.42, for Linux (x86_64) using  EditLine wrapper

No. You cannot run Xtrabackup 8.0.35 against MySQL 5.7. You need to install Xtrabackup 2.4.

i got this after running xtrabackup --prepare --target-dir /var/lib/mysql --use-memory 4G

xtrabackup version 2.4.29 based on MySQL server 5.7.44 Linux (x86_64) (revision id: 2e6c0951)
xtrabackup: cd to /var/lib/mysql/
xtrabackup: This target seems to be not prepared yet.
InnoDB: Number of pools: 1
xtrabackup: No valid checkpoint found.
xtrabackup: Error: xtrabackup_init_temp_log() failed.

You must take the backup of 5.7 using PXB 2.4. You can’t take a backup of 5.7 using PXB 8. Show the command from PXB 2.4 taking a backup of 5.7. Include the last 50 lines of the output.

I didn’t make the backup myself, the previous technician did, and there is no way to find him or his logs.
so for me it’s a guessing game with your help.
can you please tell me how to proceed?

This is an error with the original backup. Without the checkpoints file, this backup is useless. Check the original backup archive and see if xtrabackup_checkpoints file is there. If not, then you might as well delete the backup and just start a new backup process.

this what i have here

root@lab:/mnt/e# ls /var/lib/mysql
__recycle_bin__   mysql.ibd                       xtrabackup_checkpoints
backup-my.cnf     performance_schema              xtrabackup_info
crm              rds_table_info_json_122894.log  xtrabackup_logfile
ibdata1           sys                             xtrabackup_slave_info
mysql             undo_001                        xtrabackup_tablespaces
mysql-bin.000865  undo_002
mysql-bin.index   xtrabackup_binlog_info

xtrabackup_checkpoints

root@lab:/var/lib/mysql# cat xtrabackup_checkpoints
backup_type = full-backuped
from_lsn = 0
to_lsn = 1099701219646
last_lsn = 1094352835424
flushed_lsn = 0

The problem i am facing at the moment is that the system is damaged and this is the only backup we have

I hope you made a copy of the backup before you ran any commands. Anytime you need to restore, you should be operating on a copy of the backup, and not the backup itself.

I do see the xtrabackup_checkpoints file in your list. Try enabling verbose/debug logs on PXB and see if there is additional information.

Yes i’m working on a copy of the backup compressed file, and this PXB world is totally new to me, could you assist me with this?
i spent 7 days with this and i already lost it

Hello @uellla,
If you need immediate assistance with some 1:1 time, you can contact our support department. If that isn’t something you need, I recommend reading over our extensive documentation on PXB 2.4. Be sure to look at the HOWTO and Recipes sections for real-world examples.

1 Like

Thank you for your replies so far, i will keep digging maybe i will find something somewhere.

Hello @matthewb,
i was just looking around and i opened the xtrabackup_info file
i found this

tool_version = 8.0.8
ibbackup_version = 8.0.8
server_version = 8.0.18-X-Cluster-1.0.8

do i need to use the same version to restore the backup?
can you kindly help me out

Yes, use the same PXB version.

how can i do such thing?

Install via our repos.

Excuse my lack of technical knowledge, but in order to install the same versions of pxb and ps i need to know how?
nowhere to find a clue to install that version

I’m sorry after a bit of concentration i found what i was looking for

You can use your operating system’s package manager and our repo to install the same versions of PS and PXB. You’ll need to find documentation on your OS’s package manager on how to install specific versions.

1 Like