MySQL database replication

后端 未结 7 1077
青春惊慌失措
青春惊慌失措 2021-02-10 17:10

This is the scenario:

  1. I have a MySQL server with a database, let\'s call it consolidateddb. This database a consolidation of several tables from v
7条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-10 18:07

    To clear up some things, let's name things accordingly to current mysql practice. A database is a database server. A schema is a database instance. A database server can have multiple schemas. Tables live within a schema.

    Replication will help you if you want to duplicate schemas or tables as they are defined on the master/production server. The replication works by shipping a binary log of all the sql statements that are run on the master to the slave which dutifully runs them as if they run sequentially on itself.

    You can choose to replicate all data, or you can choose some of the schemas or even just some of the tables.

    You can not choose tables from different schemas and have them replicated into one schema, a table belongs to a specific schema.

    By the way, important notice. A replication server can not be a slave to multiple masters. You could mimic this using federated tables, but that would never copy the data to the consolidation server, just show them as if the data from different servers were on one server.

    The bonus of replication is that your consolidation server will more or less have updated data all the time.

提交回复
热议问题