Retire with success, data as the foundation: Data backup strategy before the deactivation or deletion of the AnQiCMS project
As an experienced website operations expert, I know that each content management system carries not only text and images, but also the digital assets of corporate brand image, marketing wisdom, and even core business logic.For the familiar AnQiCMS (AnQiCMS) such an enterprise-level content management system based on Go language, which is known for its efficiency, security, and customizable, the value of the data it manages is self-evident.
When a decision is made to discontinue or completely delete an AnQiCMS project, our primary consideration is how to back up the data 'without a single failure' to prevent any unforeseen circumstances.This is not just a technical operation, but also a respect and protection for digital heritage.In the end, data is the lifeline of a website, whether it is for future data migration, compliance audits, or simply as a precious historical archive, a complete and reliable backup is crucial.
Next, let's discuss in detail how we should carry out a comprehensive data backup before the AnQiCMS project bids farewell to the stage.
The core artery: a full backup of the database
The powerful functions behind Anqi CMS are supported by the database.All the content of the website (articles, products, pages), user data, system configuration, SEO settings, category tags, comments and so on are safely stored in the database.Therefore, making a complete backup of the database is the core of the entire backup work.
AnQiCMS is usually paired with MySQL database during deployment. The most reliable way to backup MySQL is to usemysqldumpTool. This tool can export all the data, table structures, and stored procedures in a database into a single SQL file.
If you have manually deployed AnQiCMS on a Linux server and have installed MySQL directly, you can connect to the server via SSH and execute commands similar to the following:
mysqldump -u [数据库用户名] -p[数据库密码] [数据库名称] > /path/to/your/backup/anqicms_db_backup_$(date +%Y%m%d%H%M%S).sql
Be sure to set[数据库用户名]/[数据库密码]and[数据库名称]Replace with your actual information./path/to/your/backup/It is the directory where you want to store the backup files. For easy management, I am accustomed to adding a timestamp to the filename, so that I can clearly know the backup time.
If your AnQiCMS is deployed in a Docker container, such as through 1Panel or aaPanel installation, then the database usually runs in an independent Docker container. At this point, you need to find the ID or name of the MySQL container, then throughdocker execCommand to enter the container and execute backup:
- First, get the ID or name of the MySQL container:
docker ps - Then, execute the backup command (assuming the MySQL container is named
mysql):docker exec -it mysql mysqldump -u root -p[root密码] [数据库名称] > /path/to/your/backup/anqicms_db_backup_$(date +%Y%m%d%H%M%S).sql
This is something that needs to be noted,[root密码]Is the root user password you set when installing MySQL in Docker. The backup files will be saved on the host machine./path/to/your/backup/directory, not inside the container.
Chapter 2: Flesh丰满:Complete File System Copy
In addition to the database, the 'flesh' part of the AnQiCMS website - various static files and core configurations - is also indispensable.This mainly includes user-uploaded images, videos, attachments, and template files that you may have customized, as well as configuration files crucial for system operation.
- Uploaded Resources:Generally Located Under the AnQiCMS Installation Directory:
/public/uploadsThese files carry the visual and auxiliary information of the website content and are indispensable. - Website template files:Located under the AnQiCMS installation directory.
/template. If you have customized the default template, these files are the fruit of your labor. - Core configuration file:Under the installation directory,
config.jsonThe file, although many settings can be adjusted in the background, contains basic configurations such as database connections and port settings, which are crucial for system startup.
Backup these files, the most direct way is to package the entire AnQiCMS installation directory. In a Linux environment, you can usetarcommand to compress and package:
cd /path/to/your/anqicms/root/directory
tar -czvf anqicms_files_backup_$(date +%Y%m%d%H%M%S).tar.gz .
This command will package and compress all files and subdirectories under the current directory (i.e., the root directory of AnQiCMS) into one.tar.gzfile. Please make sure you run this command when,cdReached the root directory of AnQiCMS.
If you have configured external storage, such as cloud storage services, through the 'Resource Storage and Backup Management' feature of the AnQiCMS backend, then the website's images and other resources may already be stored remotely.In this case, you need to confirm whether the data in these external storage has also been safely backed up, or whether it is independent of the AnQiCMS project lifecycle.But even so, the local template file andconfig.jsonStill need to backup separately.
III. Special considerations in multi-site environments.
AnQiCMS is a major highlight with its powerful multi-site management capabilities.If you have built and managed multiple sites on an AnQiCMS instance, you need to be particularly careful when making backups.
According to the document, AnQiCMS multi-site deployment allows each site to have an independent database name and site root directory (for example/app/dev_anqicms.com)。This means:
- Independent database backup:Each sub-site has its own database. You need to perform a database backup for each sub-site individually, just like backing up a single AnQiCMS project.
- Independent site directory backup:Although the core program files may be shared, the specific data of each child site (such as cache, possibly existing independent configuration, or uploaded files) will be stored in its dedicated directory.You need to make sure that the files in these specific directories are also packed and backed up.For example, in the Docker multi-site configuration, the document mentions that the site root directory will be set to
/app/Starting with the domain name replaced by underscores, such as/app/dev_anqicms.com.
Be sure to back up the data and files for each "independent operation" sub-site under a multi-site environment, ensuring that they are retained completely and independently.
The, verification and storage after backup
Just executing the backup command does not mean that you can rest easy. The validity of the backup file is crucial, and a proper storage strategy is also important.
- Backup file verification:After the backup is completed, I strongly recommend that you perform a simple verification of the backup file.For example, try to unzip the package and check if it contains the expected database files and directory structure.If conditions permit, even try to recover some data in an independent, temporary environment to ensure the integrity and availability of the backup.
- Multi-regional storage strategy:Avoid putting all your eggs in one basket. Store backup files in at least two different physical locations: one can be stored on another hard disk or network storage on the server (for quick recovery), and the other should be downloaded to a local computer or uploaded to a reliable cloud storage service (such as OSS, cloud disk, etc.).For extremely important data, offline storage can even be considered.Encrypting backup files can further enhance data security.
Conclusion
Stop or delete an AnQiCMS project, marking the end of a stage.At this significant point, a complete and reliable data backup is the best monument to our past efforts and a valuable asset left for future needs.It can not only help you avoid potential data loss risks, but also give you a sense of security and peace when the project is successfully completed.Let us develop good backup habits so that the value of digital assets can be sustained forever.
Frequently Asked Questions (FAQ)
Q1: Does the AnQiCMS backend have the 'Resource Storage and Backup Management' feature, is it sufficient to meet the complete backup needs before project suspension?
A1:The "Resource Storage and Backup Management" feature of AnQiCMS backend focuses on the storage configuration of website runtime resources and the backup and recovery of system data, which is very useful for data recovery and preventing data loss in daily operations.But for the "absolutely reliable" backup before the complete shutdown or deletion of the project, I suggest that you still combine manual backup of the database and the entire file system method.The background function may focus on content data and some settings, but manually packaging the entire installation directory can provide a more comprehensive protection, such as custom templates, server-level configurations, or certain log files.Manual backup gives you complete control and integrity over your data.
Q2: If I only need to backup the content of AnQiCMS articles, can I directly copy the tables in the database?archivesIs that okay?
A2:Technically speaking, you can directly copyarchivesThe table can indeed retrieve the content of the article. However, the content management of AnQiCMS is highly integrated. The article may be associated withcategories(Categories),tags(Tags),images(Image resources) and multiple tables. In addition, the image path in the article content usually points to/public/uploadsfiles in the directory. If you only copyarchivesThe table, without also backing up the associated category, tag data, and actual image files, the article is likely to be incomplete and missing images after recovery. Therefore, it is strongly recommended to follow the above method for the integrity of the content.