Skip to content

Backup After Installation

After the xSpace management component is installed and configured, and its operational status is confirmed to be normal, it is recommended to immediately perform a manual backup of the initial configuration data and understand the system's automatic backup mechanism.


1. Initial Full Backup

The manual backup script will back up database data and Pod running configurations. Please perform the following operations on the master node:

# Create a directory for backups
[xspace@host151 ~]$ sudo mkdir backups

# Execute the backup script (specify the backup path as the 'backups' folder in the current directory)
[xspace@host151 ~]$ sudo /opt/installation/scripts/backup_as6.sh ./backups/
......

AS6 backup operation completed. Backup data is stored in /home/xspace/backups/
Total size of this backup data: 36M

Important Operation Tip:

The completed backup data is placed in the specified directory. It is recommended to compress and package it, then copy it to an external environment for storage. The initial full backup contains the clean state of the system after installation and key Pod configurations, which is an important foundation for system disaster recovery.


2. Automatic Database Backup and Cleanup Mechanism

The system has a built-in automated operation and maintenance task (CronJob), responsible for daily scheduled database backups and thorough cleanup of expired data records.

2.1 Backup Task Execution Logic

The system starts the mongodump-cronjob task every day at 1:00 AM and the mysqldump-cronjob task at 2:00 AM, performing the following operations:

  1. Database Backup: Performs a full export of MySQL (xspace and middleware) and MongoDB.
  2. Backup File Retention Control: Automatically cleans up the local storage directory, retaining only the most recent 2 days of backup files.
  3. Logical Deletion Data Cleanup: The system scans business libraries for logically deleted records where is_deleted != 0. For data deleted more than 90 days ago, the system performs a physical deletion to free up database storage space.

2.2 Backup Task Status Monitoring

You can view the most recent execution record of the backup task using the following command (a status of Completed indicates successful execution):

[xspace@host151 ~]$ sudo kubectl -n middleware get po | grep dump
mysqldump-cronjob-29475000-6nw5l    0/3     Completed   0              6h42m
[root@host100 ~]# sudo kubectl -n mist get po | grep dump
mongodump-cronjob-29490780-44txw    0/1     Completed   0              7h42m

2.3 Viewing Backup Files

Backup files are stored in the /data/xSpace/ directory on the master node. Since the system automatically cleans up, this directory usually only retains records from the latest 2 days:

[root@host151 ~]# ls /data/xSpace/*dump* -lh
/data/xSpace/mongodump-mist:
total 13M
-rw-r--r-- 1 root root 3.2M Jan 13 01:00 mongodb-2026-01-12-17.00.02.dump
-rw-r--r-- 1 root root 3.2M Jan 14 01:00 mongodb-2026-01-13-17.00.02.dump
-rw-r--r-- 1 root root 3.2M Jan 15 01:00 mongodb-2026-01-14-17.00.01.dump
-rw-r--r-- 1 root root 3.2M Jan 16 01:00 mongodb-2026-01-15-17.00.01.dump

/data/xSpace/mysqldump-middleware:
total 68M
-rw-r--r-- 1 root root 22M Jan 14 02:00 mysql-middleware-2026-01-13-18-00-03.sql
-rw-r--r-- 1 root root 23M Jan 15 02:00 mysql-middleware-2026-01-14-18-00-03.sql
-rw-r--r-- 1 root root 24M Jan 16 02:00 mysql-middleware-2026-01-15-18-00-02.sql

/data/xSpace/mysqldump-xspace:
total 33M
-rw-r--r-- 1 root root 11M Jan 14 02:00 mysql-xspace-2026-01-13-18-00-03.sql
-rw-r--r-- 1 root root 11M Jan 15 02:00 mysql-xspace-2026-01-14-18-00-03.sql
-rw-r--r-- 1 root root 11M Jan 16 02:00 mysql-xspace-2026-01-15-18-00-02.sql

🔴 Important Note:

Since local automatic backups only retain 2 days of history, if long-term archiving or disaster recovery is required, it is crucial to regularly transfer backup files from the /data/xSpace/ directory to external storage devices using scripts or synchronization tools.