Data Disk Backup for UCloud's UHost
本教程适用于UCloud可用区不支持云盘快照服务的可用区,但用户在这个可用区又需要磁盘备份功能;首先用户可以通过镜像功能备份系统盘,备份数据盘可以使用US3FS工具挂载us3存储空间到云主机上,再通过rsync命令同步数据盘数据到us3对象存储上。
This tutorial is applicable to UCloud availability zones that do not support the Cloud Disk Snapshot service, but where users still require disk backup functionality. First, users can back up the system disk using the image function. For backing up the data disk, users can mount US3 storage space to the cloud server using the US3FS tool and then synchronize data disk contents to US3 object storage via the rsync command.
一、通过制作镜像方式进行系统盘备份-Perform System Disk Backup by Creating an Image
1.1、登录主机管理界面-Log in to the host management interface.
https://console.ucloud-global.com/uhost/uhost?gpu=false
1.2、先执行关机操作再点击【更多操作】-【制作镜像】
First, perform the shutdown operation, and then click More Operations > Create Image.
填下镜像名称和点击立即购买
Enter the image name and click "Purchase Now".
1.3、到镜像管理界面查看制作的镜像。
Check the created image in the Image Management interface.
https://console.ucloud-global.com/uhost/uimage
二、通过US3产品配合US3FS工具备份云主机数据盘-Backup the Cloud Server Data Disk Using the US3 Product in Conjunction with the US3FS Tool
2.1 在云主机上下载US3FS工具-Download the US3FS tool on the cloud server
curl -o us3fs https://ufile-release.cn-bj.ufileos.com/us3fs/us3fs_2.1.0
下载US3FS后,使用chmod +x us3fs增加可执行权限,如果需要直接执行,可将us3fs移动到/bin目录下。
After downloading US3FS, use the command `chmod +x us3fs` to add executable permissions. If you need to execute it directly, you can move `us3fs` to the `/bin` directory.
chmod +x us3fs
mv us3fs /bin/us3fs
2.2 配置账号访问信息-Configure Account Access Information
mkdir /etc/us3fs
vi /etc/us3fs/us3fs.yaml
access_key: *****
secret_key: *****
endpoint: internal-uae-dubai.ufileos.com
(1)账号密钥可以【账号管理】-【API密钥】获取,或者直接从以下链接获取
The account key can be obtained from **Account Management** > **API Key**, or directly from the following link:
https://console.ucloud-global.com/uaccount/api_manage
(2)endpoint可以从【控制台】-【US3】-【Bucket】-【Bucket Domain】获取内网域名,需要去掉Bucket Name,具体可以从下面链接获取。
The endpoint can be obtained from Console > US3 > Bucket > Bucket Domain by retrieving the internal domain name. The Bucket Name should be removed. The specific endpoint can be obtained from the following link:
https://console.ucloud-global.com/ufile/ufile
2.3 执行挂载命令-Execute the Mount Command
单配置文件的情况下,无需指定配置文件
In the case of a single configuration file, no configuration file needs to be specified
us3fs backupdir /backup
若有多个配置文件可以指定文件执行挂载。
If there are multiple configuration files, you can specify a file to execute the mount.
us3fs --passwd=/etc/us3fs/us3fs.yaml backupdir /backup
2.4 挂载检查-Mount Check
如果要设置开机挂载us3,则可以把上述挂载命令写入到/etc/rc.local配置文件。
To set up automatic mounting of US3 at system startup, you can add the mount command to the /etc/rc.local configuration file.
vim /etc/rc.local
us3fs --passwd=/etc/us3fs/us3fs.yaml backupdir /backup
2.5 数据同步-Data Synchronization
可以通过rsync命令同步数据盘的数据,比如这里/dev/vdb挂载目录为/data目录,可以通过以下命令进行数据备份。
Data from the data disk can be synchronized using the rsync command. For example, if /dev/vdb is mounted to the /data directory, you can use the following command to back up the data:
yum -y install rsync
rsync -avz /data/* /backup/
2.6 添加定时任务-Scheduled Synchronization
可以通过添加定时任务进行同步,比如设置每天2点进行备份。
You can set up a scheduled task to perform synchronization. For example, to back up data daily at 2 a.m., you can add a cron job as follows:
crontab -e
0 2 * * * rsync -avz /data/* /backup/ >> /var/log/rsync.log 2>&1
Browse At Random.
- 2025-01-17Tutorial for US3 Mounting on UHost
- 2025-03-05Data Disk Backup for UCloud's UHost
- 2025-01-04Tutorial for Purchasing ULightHost
- 2025-01-15Tutorials for Enabling UCloud Data Ark
- 2025-01-04Tutorial for UDTS(Transfer MYSQL from UCLoud to UCloud Global)