What is the process for updating websites (including databases? The project and database need to be updated recently. if the changes are large. So how to operate it?
For example
Do I need to stop the service before the update?
What should I pay attention to during the update process?
How often is the update better?
How to update the database? Because the local test data is different from the server data. It is impossible to directly overwrite data.
....
The younger brother has no practical experience and is more theoretical. As we all know, the database of a site is the soul of the site and the fortune of the enterprise. Any data issue may cause troublesome consequences.
I hope to share with experienced people !!!
If you can talk about database backup, restoration, database operation log generation, and other experience, it would be better!
Thank you.
Reply to discussion (solution)
This is a general question. If the architecture of your website changes with the database structure, you can back up the old site, import data to a new database and then directly deploy and release a new website. If it is just a part, let's take a look at the actual situation...
The common practice is to suspend the service for a certain period of time, and then perform various data import, export, and replacement functions...
It's still possible to stop services in the dark wind! ~
1: Backup --
To update projects and databases, you must back up the data in advance.
2: partial update --
If a large part of data needs to be updated, we recommend that you use the multipart update method. after all, it is easier to operate on small data volumes.
3: database segmentation --
The principle is the same as above. if there are a large number of update and delete operations, they must be divided into several small parts for execution.
Sample code:
Where (1 ){
// Delete 1000 entries each time
Mysql_query ("delete from users where xx> 0 limit 1000 ");
If (mysql_affected_rows = 0)
Break;
// Rest for a period of time
Usleep (50000 );
}
Thank you for your suggestions!