Due to business adjustment, the server of small program should be migrated from Ali cloud to Tencent cloud, and the complete process of migration is recorded here

The domain name transfer

Considering the compatibility of the old version of the small program, can not be directly changed into a new domain name, here needs to do a compatibility.

Buy the new domain name resolution to the new server, online will be the old domain name to the new domain name, and in the new version of the small program will interface domain name into the new domain name.

Nodejs service migration

Nodejs installation and Nginx configuration are required for server migration.

Master server: small program server, high configuration, only to do small program services.

Secondary server: management background and other projects.

Directing a migration

Test library migration once

The formal reservoir divides into tables that do not change, tables that only add data, and tables that may be updated

Unchanged: Project configuration table, official data table (can be migrated directly)

Add: user post table, user comment table (can be migrated in advance, the new data will be imported before online)

Update: can only be online before migration (may need to stop the service in the middle of the night when there are few users to do data migration)

Step pit: because it is from Ali cloud to Tencent cloud, before the company’s operation and maintenance help configuration, this is to myself, so encountered a big pit.

The cloud database MongoDB purchased by Tencent Cloud can only be connected to the internal network due to the security policy. There is no problem when it is deployed normally, but if you want to view the data of the cloud database locally, it will not work.

Solution:

1) I bought a server and built MongoDB by myself. Since I am not professional in operation and maintenance, I had to give up for the stability of online business.

2) Buy a cloud host, access the cloud host, and then cut the traffic to the database server. In this way, the external network can connect to the internal database. Due to the unfamiliar operation and maintenance, the specific implementation process is also a snot a tear 😭. Finally really not line, request Tencent cloud technology support to help.

Redis migration

Use Tencent Cloud Redis migration tool for migration

Interface document migration

Install Yapi on the secondary server

Git migration

Install Gitlab on the server

Monitoring the related

Install Prometheus and Grafana on the secondary machine

Log-related services

Install ELK(Elasticsearch, Logstash, Kibana) on secondary machine

Tencent cloud OSS

Connect to Tencent cloud OSS

Automated deployment

Install Jenkins on the secondary machine

Station capture server

Purchase a separate capture server