In the dynamic journey of website operation, technological iteration and upgrade is the norm.When you decide to stop the current AnQiCMS project and plan to deploy a brand new, more powerful version, how to ensure that the data of the old website can be 'seamlessly' migrated to the new environment, while minimizing business interruption, is a key challenge that every operator must face.As an experienced website operation expert, I am well aware of the importance of data. Next, I will elaborate on the strategy and steps for this smooth migration based on the characteristics and relevant documents of AnQiCMS.
Understanding AnQiCMS's data flow: Basic cognition before migration
Before starting the data migration, we first need to clarify the core data storage mechanism of AnQiCMS. AnQiCMS, as an enterprise-level content management system developed based on the Go language, stores all site content, whether it's articles, products, categories, tags, or user data, system configurations, mainly inMySQL databaseautopublic/uploadsFolder. And the running configuration of AnQiCMS itself, such as port, database connection information, etc., is stored in its root directory.config.jsonFile understanding. It is the cornerstone of a smooth migration strategy.
The core strategy and steps of smooth migration
Data migration is never just a simple copy and paste of files. It requires a comprehensive and rigorous plan to ensure data integrity and service continuity.
1. Foolproof preparation: Backup, backup, and backup again!
This is the golden rule for any data operation. Be sure to performFull backup.
- Database backup:This is the most important part.Log in to your database management tool (such as phpMyAdmin, Navicat, or use the command line directly), and export all the databases used by your old AnQiCMS project.
.sqlFormat, including all table structures and data. - Filesystem backup:Compress and package all files and folders under the old AnQiCMS project deployment directory, particularly
public/uploadsThe catalog (including all user-uploaded images, attachments, and other resources) and any customizations you may have madetemplateThe template files in the catalog. Do not forget to back up the project.config.jsonFile, which may contain your unique configuration information. - Record key configuration:Detailedly record the current Nginx or Apache reverse proxy configuration, domain binding, SSL certificate path, the running port of the old version of AnQiCMS (default 8001), and the administrator account password, etc., for reference when configuring the new version.
2. Smoothly pause old service: Make way for the new version
After you confirm that all backups have been stored properly, you need to stop the old version of AnQiCMS service in the most stable way to ensure that all pending transactions in the database can be completed before stopping, to avoid data corruption.
- If you deploy through the Baota panel, you can enter “Website”->“Go project” or “Other project” to stop the corresponding project, or delete its scheduled task.
- If you are deploying via command line, execute the script in the root directory of the project.
./stop.shscript. - If you are deploying with Docker, then through
docker stopCommand or 1Panel/aaPanel management interface to stop.
The goal of this step isCompletely terminate the old version of AnQiCMS processRelease the occupied ports and resources, prepare for the new version.
3. Deploy a new AnQiCMS environment: a clean starting point
Now, we will deploy the brand new AnQiCMS version. It is recommended to install it into aa brand new, independent directoryora new Docker containerThis avoids conflicts with the existing version and provides convenience for subsequent fault rollback.
- Choose the deployment method:AnQiCMS supports various deployment methods, such as Go projects on Baota panel, Docker (1Panel/aaPanel/Baota Docker App Store), or command line deployment. No matter which method you choose, please follow the official installation tutorial of the new version of AnQiCMS, but please note暂时不要进行初始化安装(即不要访问网站前端,让它触发创建新的数据库和文件)。
- 分配独立资源:If you are deploying on the same server, make sure the new version of AnQiCMS uses oneDifferent from the old versionThe running port (for example, old version 8001, new version 8002), and create onea new, empty MySQL databaseIf it is Docker, the port inside the container can still be 8001, but the port mapped to the host should be different.
4. Core Data Migration: Inject old data into the new version.
This is the core link of data smooth migration, we will import the old version of data into the new environment.
- Restore database data:The old version of the database you backed up in the first step
.sqlFile, import to the one configured in the new version of AnQiCMSa new, empty MySQL database.