Ubuntu 22.04
Sponsored Link

MariaDB 10.6 : बैकअप2023/09/07

 
MariaDB डेटा के बैकअप और पुनर्स्थापना के लिए, [mariabackup] के साथ चलना संभव है।
[1] बैकअप टूल इंस्टॉल करें।
root@www:~#
apt -y install mariadb-backup
[2] बैकअप चलाएँ।
उदाहरण के लिए, [/home/mariadb_backup] के अंतर्गत बैकअप प्राप्त करें।
root@www:~#
mkdir /home/mariadb_backup

root@www:~#
mariabackup --backup --target-dir /home/mariadb_backup -u root


.....
.....

[00] 2022-05-13 05:02:29 All tables unlocked
[00] 2022-05-13 05:02:29 Copying ib_buffer_pool to /home/mariadb_backup/ib_buffer_pool
[00] 2022-05-13 05:02:29         ...done
[00] 2022-05-13 05:02:29 Backup created in directory '/home/mariadb_backup/'
[00] 2022-05-13 05:02:29 Writing backup-my.cnf
[00] 2022-05-13 05:02:29         ...done
[00] 2022-05-13 05:02:29 Writing xtrabackup_info
[00] 2022-05-13 05:02:29         ...done
[00] 2022-05-13 05:02:29 Redo log (from LSN 44620 to 44632) was copied.
[00] 2022-05-13 05:02:29 completed OK!

root@www:~#
ll /home/mariadb_backup

total 12744
drwxr-xr-x 6 root root     4096 May 13 05:02 ./
drwxr-xr-x 4 root root     4096 May 13 05:02 ../
-rw-r----- 1 root root   409600 May 13 05:02 aria_log.00000001
-rw-r----- 1 root root       52 May 13 05:02 aria_log_control
-rw-r----- 1 root root      297 May 13 05:02 backup-my.cnf
-rw-r----- 1 root root      962 May 13 05:02 ib_buffer_pool
-rw-r----- 1 root root     2560 May 13 05:02 ib_logfile0
-rw-r----- 1 root root 12582912 May 13 05:02 ibdata1
drwx------ 2 root root     4096 May 13 05:02 mysql/
drwx------ 2 root root     4096 May 13 05:02 performance_schema/
drwx------ 2 root root    12288 May 13 05:02 sys/
drwx------ 2 root root     4096 May 13 05:02 test_database/
-rw-r----- 1 root root       73 May 13 05:02 xtrabackup_checkpoints
-rw-r----- 1 root root      438 May 13 05:02 xtrabackup_info
[3] किसी अन्य होस्ट पर बैकअप से डेटा पुनर्स्थापित करने के लिए, निम्नानुसार चलाएँ।
पुनर्स्थापित करने से पहले, बैकअप डेटा को [rsync] या [scp] इत्यादि के साथ लक्ष्य होस्ट पर स्थानांतरित करें।
# MariaDB रोकें और मौजूदा डेटा हटा दें

root@node01:~#
systemctl stop mariadb

root@node01:~#
rm -rf /var/lib/mysql/*
# बैकअप डेटा यह स्थानांतरित किया गया था

root@node01:~#
ll mariadb_backup.tar.gz

-rw-r--r-- 1 root root 554900 May 13 05:07 mariadb_backup.tar.gz
root@node01:~#
tar zxvf mariadb_backup.tar.gz

# कार्य पुनर्स्थापित करने से पहले कार्य तैयार करें चलाएँ (ठीक है यदि [completed OK])

root@node01:~#
mariabackup --prepare --target-dir /root/mariadb_backup

[00] 2022-05-13 05:09:33 cd to /root/mariadb_backup/
[00] 2022-05-13 05:09:33 open files limit requested 0, set to 1024
[00] 2022-05-13 05:09:33 This target seems to be not prepared yet.
[00] 2022-05-13 05:09:33 mariabackup: using the following InnoDB configuration for recovery:
[00] 2022-05-13 05:09:33 innodb_data_home_dir = .
[00] 2022-05-13 05:09:33 innodb_data_file_path = ibdata1:12M:autoextend
[00] 2022-05-13 05:09:33 innodb_log_group_home_dir = .
[00] 2022-05-13 05:09:33 Starting InnoDB instance for recovery.
[00] 2022-05-13 05:09:33 mariabackup: Using 104857600 bytes for buffer pool (set by --use-memory parameter)
2022-05-13  5:09:33 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-05-13  5:09:33 0 [Note] InnoDB: Number of pools: 1
2022-05-13  5:09:33 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2022-05-13  5:09:33 0 [Note] InnoDB: Initializing buffer pool, total size = 104857600, chunk size = 104857600
2022-05-13  5:09:33 0 [Note] InnoDB: Completed initialization of buffer pool
2022-05-13  5:09:33 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=44620,44620
[00] 2022-05-13 05:09:34 Last binlog file , position 0
[00] 2022-05-13 05:09:34 completed OK!

# पुनर्स्थापना चलाएँ

root@node01:~#
mariabackup --copy-back --target-dir /root/mariadb_backup


.....
.....

[01] 2022-05-13 05:09:47         ...done
[01] 2022-05-13 05:09:47 Copying ./aria_log.00000001 to /var/lib/mysql/aria_log.00000001
[01] 2022-05-13 05:09:47         ...done
[01] 2022-05-13 05:09:47 Copying ./ib_buffer_pool to /var/lib/mysql/ib_buffer_pool
[01] 2022-05-13 05:09:47         ...done
[00] 2022-05-13 05:09:47 completed OK!

root@node01:~#
chown -R mysql. /var/lib/mysql

root@node01:~#
systemctl start mariadb

मिलान सामग्री