In the dynamic journey of website operation, technological iteration and upgrading is the norm.How to ensure that the data of the old website can be seamlessly migrated to the new environment when you decide to stop the current AnQiCMS project and plan to deploy a brand new, more powerful version, while minimizing business disruption, 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 of this smooth migration based on the characteristics of AnQiCMS and relevant documents.
Understand the data structure of AnQiCMS: 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 is articles, products, categories, tags, or user data, system configuration, mainly inMySQL databaseChinese. In addition, the images, attachments, and other static resources of the website are stored in the file system of the server, usually located in the AnQiCMS installation directory.public/uploadsFolder. While the operation configuration of AnQiCMS itself, such as port, database connection information, etc., is stored in its root directory.config.jsonIn the file. Understanding this is the foundation of the smooth migration strategy.
The core strategy and steps of smooth migration.
Data migration is never as simple as copying and pasting files. It requires a thorough 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 backup the old system before any migrationFull backup.
- Database backup:This is the most important step. Log in to your database management tool (such as phpMyAdmin, Navicat, or directly using the command line) and export all the databases used by your old AnQiCMS project.Make sure to export as
.sqlFormat, including all table structures and data. - File system backup:Compress all files and folders under the old AnQiCMS project deployment directory, especially
public/uploadsDirectory (including all images, attachments, and other resources uploaded by users) and any customizations you may have madetemplateTemplate files under the directory. Don't forget to back up the project as wellconfig.jsonFile that may contain your unique configuration information. - Record key configuration: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 in detail 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 properly stored, you need to stop the old version of AnQiCMS service in the most stable way to ensure that all pending transactions in the database are completed before stopping, to avoid data corruption.
- If you deploy through Baota panel, you can enter the "Website" -> "Go project" or "Other project" to stop the corresponding project, or delete its scheduled task.
- If you are deploying via command line, run the script in the project root directory.
./stop.shJust do it. - If you are deploying via Docker, then through
docker stopStop the management interface of command or 1Panel/aaPanel.
The goal of this step is.Completely terminate the old version of AnQiCMS process.Relieve its occupied ports and resources to prepare for the new version.
3. Deploy a new AnQiCMS environment: a clean starting point.
Now, we will deploy the new AnQiCMS version. It is recommended to install it in abrand new, independent directoryornew Docker containerThis avoids problems caused by file conflicts and provides convenience for future rollback of failures.
- Please select 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. Regardless of the method chosen, please follow the official installation tutorial for the new version of AnQiCMS, but please noteDo not perform initial installation(That is, do not access the website front end, let it trigger the creation of a new database and files).
- Allocate independent resources:If you are deploying on the same server, make sure to use one version of the new AnQiCMSDifferent from the old versionThe runtime port (for example, old version 8001, new version 8002), and create aNew, empty MySQL databaseIf it is Docker, the internal port of 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 smooth data migration, we will import the old version of the data into the new environment.
- Restore database data:Import the old version of the database that you backed up in the first step
.sqlFile, import to the one that is configured in the new version of AnQiCMSNew, empty MySQL database.