There are database A and database B on the same server.
I want to make the contents of database B exactly the same as database A on a regular basis (here every other week). (A → B synchronization)
B → A synchronization is not required.
There may be changes in B only, but there is no problem even if all changes disappear at the timing of synchronization.
I thought it would be possible to use cron every other week, mysqldump with the –add-drop-table option, and then restore.
However, I feel that this method is too primitive. In addition, since other than the difference is also synchronized, I think that the CPU will be used quite wastefully.
I think it's a common requirement, but I couldn't find any information that would be a good idea even if I looked it up. You can use tools and scripts.
Answer # 1
As long as you see, the difference is acceptable for a week, right?
If it is such a loose operating condition, I think that you can dump and restore.
(Although it can be accepted because the writing frequency is low and the difference is small even in one week, that is, it can be regarded that there are many updates equivalent to the same data as a dump)
Separately, as a requirement ↓ I am interested here.
There may be changes only in B, but there is no problem even if all changes disappear at the timing of synchronization.
Would you like to synchronize (same) or allow different? Is there a guarantee that a row in a table that has been changed only on B is also changed on the A side at the timing of synchronization? If not, applying only the difference on the A side will leave the change unattended. When will it be changed, which one will come? Is it possible to allow the difference so long term? If it is unacceptable, the B side rollback work is also required. If you think about it, I think that dumping and restoring are all right, so I answered the previous question.
Answer # 2
If you timestamp each record with a modified column
I think it ’s not difficult to get the difference.
- how to create a database with mysql
- Method for implementing performance test of MySQL database by sysbench tool
- Python remote connection to MySQL database
- Database backup (postgresql, mysql) example code in docker environment
- Go language integration mysql driver, call database, query data operation examples
- Solve the problem when MySQL database encounters Syn Flooding
- PHP uses PDO to create a MySQL database, table, and insert multiple data operations example
- C ++ connect mysql database in Eclipse
- MySQL database installation and Navicat for MySQL tutorial
- Method to convert mysql database data to json data using python
- Mysql solve database N + 1 query problem
- Python Django switch MySQL database instance
- django mysql database and image upload interface
- Mysql database monitoring binlog startup steps
- Detailed explanation of mysql database addition, deletion and modification
- How to import Excel files into MySQL database
- SSM implements mysql database account password cipher text login function
- Detailed explanation of MYSQL database table structure optimization method
- How to install mysql database in ubuntu
- Use of pymysql module to connect to mysql database using python
- mysql - sql update statement
- php - can't connect to mamp mysql
- mysql - sql count statement condition specification
- php - which is the transaction or the table lock first?
- php - rollback doesn't work in mysql and only some tables are updated (wordpress)
- mysql - i want to make the column set as "primary key and foreign key" only "foreign key"
- mysql - i want to do a full text search
- mysql ranking table design
- php - processing of delete function with laravel
- how to reference numbers from multiple tables in mysql