ubuntu 22.04 server 安装 xtrabackup 2.4 qpress LTS

ubuntu 22.04 server 安装 xtrabackup 2.4 qpress LTS

注意

xtrabackup --version

xtrabackup 还原时候使用的版本 一定要与 备份时候 使用的 版本,保持一致。
不然 有可能 会出现以下问题

InnoDB: Page [page id: space=0, page number=2] log sequence number 859937 is in the future! Current system log sequence number 823765.
InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html for information about forcing recovery.

保持一致的方法

https://www.percona.com/downloads

在这里插入图片描述
https://downloads.percona.com/downloads/Percona-XtraBackup-2.4/Percona-XtraBackup-2.4.26/binary/debian/jammy/x86_64/percona-xtrabackup-24_2.4.26-1.jammy_amd64.deb

Installing Percona XtraBackup using downloaded deb packages¶
Download the packages of the desired series for your architecture from the download page. Following example downloads the Percona XtraBackup 2.4.28 release package for Debian 10.0:

$ wget https://downloads.percona.com/downloads/Percona-XtraBackup-2.4/Percona-XtraBackup-2.4.28/
\binary/debian/buster/x86_64/percona-xtrabackup-dbg-24_2.4.28-1.buster_amd64.deb
Now you can install Percona XtraBackup by running:

$ sudo dpkg -i percona-xtrabackup-24_2.4.28-1.buster_amd64.deb

参考

https://docs.percona.com/percona-xtrabackup/innovation-release/apt-repo.html

https://www.ubuntuupdates.org/ppa/percona_server_with_xtradb?dist=jammy

centos7 xtrabackup mysql(8)压缩 增量备份(3)
https://blog.youkuaiyun.com/wowocpp/article/details/141162887

https://docs.percona.com/percona-xtrabackup/innovation-release/compile-xtrabackup.html

流程

Debian packages from Percona are signed with a key. Before using the repository, you should add the key to APT. To do that, run the following commands as a root user:

# gpg --keyserver  hkp://keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A
... [some output removed] ...
gpg:               imported: 1

# gpg -a --export CD2EFD2A | apt-key add -

sudo sh -c ‘echo “deb http://repo.percona.com/apt jammy main” >> /etc/apt/sources.list.d/percona.list’

Install with an APT repository

wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb

11

Install the downloaded package with dpkg. To do that, run the following commands as root or with sudo: dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb

Once you install this package the Percona repositories should be added. You can check the repository setup in the /etc/apt/sources.list.d/percona-release.list file.

22
Refresh the local cache to update the package information:

$ sudo apt update

Install the percona-xtrabackup-24 package:

$ sudo apt install percona-xtrabackup-24

qpress

wget “http://docs-aliyun.cn-hangzhou.oss.aliyun-inc.com/assets/attach/183466/cn_zh/1608011575185/qpress-11-linux-x64.tar”
tar xvf qpress-11-linux-x64.tar
chmod 775 qpress
sudo cp qpress /usr/bin

sudo systemctl stop mysqld
sudo cp -r /opt/datadir/mysql /opt/datadir/bak_mysql

1

https://docs.percona.com/percona-xtrabackup/2.4/installation/apt_repo.html#update-the-curl-utility-in-debian-10

2

这个命令是用于删除名为percona-xtrabackup-24的软件包。这个软件包是Percona的XtraBackup,它是一个用于MySQL和MariaDB数据库的热备份和点入式备份工具。

如果你运行这个命令,它会从你的系统中移除这个软件包。这个命令的输出会告诉你这个软件包是否还有依赖,如果有,它们也会被移除。

如果你想保留配置文件,可以使用–purge选项,这样会同时删除与该软件包关联的配置文件。

例如:

sudo apt remove --purge percona-xtrabackup-24
如果你想查看将要被移除的软件包列表,可以使用–dry-run选项,这样命令会显示将要执行的操作,但实际上并不执行移除动作。

例如:

sudo apt remove --dry-run percona-xtrabackup-24
如果你想在移除软件包之前自动删除所有不再需要的依赖,可以添加–auto-remove选项。

例如:

sudo apt remove --auto-remove percona-xtrabackup-24
如果你想同时移除所有与该软件包相关的依赖和配置文件,可以组合使用–purge和–auto-remove选项。

例如:

sudo apt remove --purge --auto-remove percona-xtrabackup-24
以上就是移除Percona XtraBackup的一些常用命令。

3

Linux上安装percona-xtrabackup-24(innobackupex工具)
Centos:

# wget https://www.percona.com/redir/downloads/percona-release/redhat/0.1-4/percona-release-0.1-4.noarch.rpm
# rpm -ivh percona-release-0.1-4.noarch.rpm
# yum -y --nogpgcheck install percona-xtrabackup-24.x86_64 

Ubuntu:

$ wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
$ sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
$ sudo apt-get update
$ sudo apt-get install percona-xtrabackup-24

参考:

https://www.percona.com/doc/percona-xtrabackup/2.4/installation/yum_repo.html

https://www.percona.com/doc/percona-xtrabackup/2.4/installation/apt_repo.html

1

5

第一步
打开终端并输入以下代码(作用是将字符串 “deb Index of /ubuntu focal-security main” 添加到 Ubuntu 系统的软件源配置中。echo 命令用于输出字符串,| 管道符将 echo 的输出传递给 sudo tee 命令,sudo tee 命令用于将数据写入文件。)

echo “deb http://security.ubuntu.com/ubuntu focal-security main” | sudo tee /etc/apt/sources.list.d/focal-security.list
第二步
输入以下代码(更新本地软件包列表的命令)

sudo apt-get update
第三步
输入以下代码(下载libssl1.1)

sudo apt-get install libssl1.1
完成这三步就安装完成了

6

jack@ubuntu2204:~$ sudo apt-get install libssl1.1
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
The following NEW packages will be installed:
libssl1.1
0 upgraded, 1 newly installed, 0 to remove and 22 not upgraded.
Need to get 1,323 kB of archives.
After this operation, 4,131 kB of additional disk space will be used.
Get:1 http://security.ubuntu.com/ubuntu focal-security/main amd64 libssl1.1 amd64 1.1.1f-1ubuntu2.23 [1,323 kB]
Fetched 1,323 kB in 3s (481 kB/s)
Preconfiguring packages …
Selecting previously unselected package libssl1.1:amd64.
(Reading database … 111003 files and directories currently installed.)
Preparing to unpack …/libssl1.1_1.1.1f-1ubuntu2.23_amd64.deb …
Unpacking libssl1.1:amd64 (1.1.1f-1ubuntu2.23) …
Setting up libssl1.1:amd64 (1.1.1f-1ubuntu2.23) …
Processing triggers for libc-bin (2.35-0ubuntu3.8) …
Scanning processes…
Scanning linux images…

Running kernel seems to be up-to-date.

No services need to be restarted.

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.
jack@ubuntu2204:~$ sudo apt-get install percona-xtrabackup-24
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
The following additional packages will be installed:
libcurl4-openssl-dev libdbd-mysql-perl libdbi-perl libev4 libmysqlclient21
Suggested packages:
libcurl4-doc libidn11-dev libkrb5-dev libldap2-dev librtmp-dev libssh2-1-dev libssl-dev pkg-config zlib1g-dev libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl
The following NEW packages will be installed:
libcurl4-openssl-dev libdbd-mysql-perl libdbi-perl libev4 libmysqlclient21 percona-xtrabackup-24
0 upgraded, 6 newly installed, 0 to remove and 22 not upgraded.
Need to get 14.6 MB of archives.
After this operation, 47.7 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 https://mirrors.aliyun.com/ubuntu jammy-security/main amd64 libcurl4-openssl-dev amd64 7.81.0-1ubuntu1.19 [386 kB]
Get:2 https://mirrors.aliyun.com/ubuntu jammy/main amd64 libdbi-perl amd64 1.643-3build3 [741 kB]
Get:3 https://mirrors.aliyun.com/ubuntu jammy-security/main amd64 libmysqlclient21 amd64 8.0.40-0ubuntu0.22.04.1 [1,308 kB]
Get:4 http://repo.percona.com/apt focal/main amd64 percona-xtrabackup-24 amd64 2.4.29-1.focal [12.1 MB]
Get:5 https://mirrors.aliyun.com/ubuntu jammy-security/universe amd64 libdbd-mysql-perl amd64 4.050-5ubuntu0.22.04.1 [87.6 kB]
Get:6 https://mirrors.aliyun.com/ubuntu jammy/universe amd64 libev4 amd64 1:4.33-1 [29.4 kB]
Fetched 14.6 MB in 11min 14s (21.7 kB/s)
Selecting previously unselected package libcurl4-openssl-dev:amd64.
(Reading database … 111013 files and directories currently installed.)
Preparing to unpack …/0-libcurl4-openssl-dev_7.81.0-1ubuntu1.19_amd64.deb …
Unpacking libcurl4-openssl-dev:amd64 (7.81.0-1ubuntu1.19) …
Selecting previously unselected package libdbi-perl:amd64.
Preparing to unpack …/1-libdbi-perl_1.643-3build3_amd64.deb …
Unpacking libdbi-perl:amd64 (1.643-3build3) …
Selecting previously unselected package libmysqlclient21:amd64.
Preparing to unpack …/2-libmysqlclient21_8.0.40-0ubuntu0.22.04.1_amd64.deb …
Unpacking libmysqlclient21:amd64 (8.0.40-0ubuntu0.22.04.1) …
Selecting previously unselected package libdbd-mysql-perl:amd64.
Preparing to unpack …/3-libdbd-mysql-perl_4.050-5ubuntu0.22.04.1_amd64.deb …
Unpacking libdbd-mysql-perl:amd64 (4.050-5ubuntu0.22.04.1) …
Selecting previously unselected package libev4:amd64.
Preparing to unpack …/4-libev4_1%3a4.33-1_amd64.deb …
Unpacking libev4:amd64 (1:4.33-1) …
Selecting previously unselected package percona-xtrabackup-24.
Preparing to unpack …/5-percona-xtrabackup-24_2.4.29-1.focal_amd64.deb …
Unpacking percona-xtrabackup-24 (2.4.29-1.focal) …
Setting up libmysqlclient21:amd64 (8.0.40-0ubuntu0.22.04.1) …
Setting up libev4:amd64 (1:4.33-1) …
Setting up libcurl4-openssl-dev:amd64 (7.81.0-1ubuntu1.19) …
Setting up libdbi-perl:amd64 (1.643-3build3) …
Setting up libdbd-mysql-perl:amd64 (4.050-5ubuntu0.22.04.1) …
Setting up percona-xtrabackup-24 (2.4.29-1.focal) …
Processing triggers for man-db (2.10.2-1) …
Processing triggers for libc-bin (2.35-0ubuntu3.8) …
Scanning processes…
Scanning linux images…

Running kernel seems to be up-to-date.

No services need to be restarted.

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.

jack@ubuntu2204:~$ xtrabackup --version
xtrabackup: recognized server arguments: --datadir=/var/lib/mysql
xtrabackup version 2.4.29 based on MySQL server 5.7.44 Linux (x86_64) (revision id: 2e6c0951)

7

jack@ubuntu2204:~$ sudo apt remove --dry-run percona-xtrabackup-24
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
The following packages were automatically installed and are no longer required:
libcurl4-openssl-dev libdbd-mysql-perl libdbi-perl libev4 libmysqlclient21
Use ‘sudo apt autoremove’ to remove them.
The following packages will be REMOVED:
percona-xtrabackup-24
0 upgraded, 0 newly installed, 1 to remove and 22 not upgraded.
Remv percona-xtrabackup-24 [2.4.29-1.focal]

1

Uninstalling Percona XtraBackup¶
To uninstall Percona XtraBackup you’ll need to remove all the installed packages.

Remove the packages

$ sudo apt remove percona-xtrabackup-24

8

jack@ubuntu2204:~$ sudo apt remove percona-xtrabackup-24
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
The following packages were automatically installed and are no longer required:
libcurl4-openssl-dev libdbd-mysql-perl libdbi-perl libev4 libmysqlclient21
Use ‘sudo apt autoremove’ to remove them.
The following packages will be REMOVED:
percona-xtrabackup-24
0 upgraded, 0 newly installed, 1 to remove and 22 not upgraded.
After this operation, 36.6 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database … 111226 files and directories currently installed.)
Removing percona-xtrabackup-24 (2.4.29-1.focal) …
Processing triggers for man-db (2.10.2-1) …

<think>我们参考引用[1]和引用[2]中关于在Ubuntu系统上安装XtraBackup的信息。虽然引用中提供的是针对Red Hat系统的安装步骤,但我们可以根据Ubuntu的特性进行调整。 引用[1]显示在Ubuntu 22.04安装xtrabackup 2.4版本,引用[2]则提供了在Red Hat上安装2.4.10版本的步骤(使用rpm包)。由于Ubuntu使用deb包,我们需要找到对应的deb包或使用Percona的APT仓库。 根据Percona官方文档,推荐使用APT仓库安装。以下是步骤: 1. 添加Percona的APT仓库 2. 安装percona-release包(用于管理仓库) 3. 启用仓库 4. 安装XtraBackup 注意:XtraBackup 2.4版本适用于MySQL 5.7,而XtraBackup 8.0适用于MySQL 8.0。请根据你的MySQL版本选择。 假设用户需要安装与MySQL 5.7兼容的XtraBackup(即2.4版本),我们可以按照以下步骤: 步骤1:安装percona-release包 步骤2:启用特定仓库(这里启用xtrabackup 2.4的仓库) 步骤3:安装XtraBackup 但是,请注意,在Ubuntu 22.04上,Percona可能已经提供了适用于该系统的包。 具体步骤: 1. 下载percona-release的deb包并安装 2. 更新包列表 3. 安装XtraBackup-24(即2.4版本) 另外,引用[2]中提到需要安装一些依赖,在Ubuntu上我们同样需要安装必要的依赖。 以下是详细步骤:</think>### 在 Ubuntu 22.04 Server安装 XtraBackup 的步骤 #### 1. **添加 Percona APT 仓库** Percona 官方提供了专用仓库,确保安装最新兼容版本: ```bash sudo apt update sudo apt install -y gnupg2 curl curl -O https://repo.percona.com/apt/percona-release_latest.generic_all.deb sudo dpkg -i percona-release_latest.generic_all.deb sudo percona-release enable-only tools release # 启用工具仓库 ``` #### 2. **安装 XtraBackup 2.4** 该版本兼容 MySQL 5.7(Ubuntu 22.04 默认 MySQL 版本): ```bash sudo apt update sudo apt install -y percona-xtrabackup-24 ``` #### 3. **验证安装** 检查版本及依赖是否完整: ```bash xtrabackup --version # 预期输出类似:xtrabackup version 2.4.xx based on MySQL server 5.7.xx ``` #### 4. **安装必要依赖** 解决常见依赖问题(如引用[2]提到的 Perl 依赖): ```bash sudo apt install -y libdbi-perl libev4 libaio1 libdbd-mysql-perl ``` #### 5. **配置 MySQL 权限** 为备份用户授权(在 MySQL 中执行): ```sql CREATE USER 'bkpuser'@'localhost' IDENTIFIED BY 'your_password'; GRANT RELOAD, LOCK TABLES, PROCESS, REPLICATION CLIENT ON *.* TO 'bkpuser'@'localhost'; FLUSH PRIVILEGES; ``` #### 故障排查提示 - **依赖错误**:若出现 `libev.so.4` 缺失,运行 `sudo apt install -y libev4` - **版本冲突**:如需兼容 MySQL 8.0,需安装 `percona-xtrabackup-80` 包 - **仓库问题**:确认仓库启用状态 `ls /etc/apt/sources.list.d/percona*` > 关键参考: > - 安装流程基于 Percona 官方仓库的标准化部署(引用[1][^1]) > - 权限配置参考了生产环境备份账户的最小权限原则(引用[2][^2]) --- ### 相关问题 1. **如何验证 XtraBackup 备份的完整性?** 2. **XtraBackup 增量备份的实现步骤是什么?** 3. **Ubuntu 22.04 上如何配置 XtraBackup 的定时全量备份任务?** 4. **XtraBackup 8.0 与 2.4 版本的主要区别是什么?** [^1]: 引用自 Ubuntu 22.04 环境下的 XtraBackup 版本验证记录 [^2]: 参考自备份账户权限配置及依赖安装实践
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值