You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
YltProject/操作文档/6、MongoDB数据库下载与还原.md

94 lines
1.3 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

## Mongodb备份
> 还原办法:
> https://blog.csdn.net/w13511069150/article/details/133687350
#### 下载
```shell
percona-xtrabackup-2.4.29-Linux-x86_64.glibc2.17-minimal.tar.gz
```
#### 安装
```shell
cd /usr/local
gunzip percona-xtrabackup-2.4.29-Linux-x86_64.glibc2.17-minimal.tar.gz
tar -xvf percona-xtrabackup-2.4.29-Linux-x86_64.glibc2.17-minimal.tar
mv percona-xtrabackup-2.4.29-Linux-x86_64.glibc2.17-minimal /usr/local/xtrabackup
```
#### 创建软连接
```
ln -sf /usr/local/xtrabackup/bin/* /usr/bin/
```
#### 下载$qpress$
```shell
rz -be
选择qpress-11-linux-x64.tar
tar -xf qpress-11-linux-x64.tar
cp -a qpress /usr/bin/
```
#### 查看版本
```shell
xtrabackup --version
```
#### 查看位置
```shell
which xtrabackup
```
#### 解包
```shell
cd /usr/local/mongodb/db
rz -be
选择 hins15335287_data_20240814061706_qp.xb
cat hins15335287_data_20240814061706_qp.xb | xbstream -x -v
innobackupex --decompress --remove-original /usr/local/mongodb/db
rm -rf hins15335287_data_20240814061706_qp.xb
```
#### 启动$MongoDB$
```
cd /usr/local/mongodb
chmod 777 db
chmod 777 log
cd /usr/local/mongodb
./bin/mongod -f ./mongodb.conf
```