Domanda

Can I give for each database in master server a different type of replication ?? For example: there are two databases( DB 1, DB 2) in the same MySQL server .. I need to give DB 1 -> statement-based replication and DB 2 -> row-based replication.

PS : I tried to use mixed replication .. but I have some problems with.. because there are many triggers (so I need statement-based) and I need row-based in some cases.

È stato utile?

Soluzione

You can't have such settings for database level, this setting works at Server level only and you have to specify in my.cnf file.

Advantages of Statement based replication

  • Less data written to log files. When updates or deletes affect many rows, this results in much less storage space required for log files. This also means that taking and restoring from backups can be accomplished more quickly.

  • Log files contain all statements that made any changes, so they can be used to audit the database.

Advantages of row based replication

  • All changes can be replicated. This is the safest form of replication.

For MySQL versions earlier than 5.1.14, DDL (Data Definition Language) statements such as CREATE TABLE are replicated using statement-based replication, while DML statements, as well as GRANT and REVOKE statements, are replicated using row-based replication.

  • In MySQL 5.1.14 and later, the mysql database is not replicated. The mysql database is instead seen as a node-specific database. Row-based replication is not supported on tables in this database. Instead, statements that would normally update this information—such as GRANT, REVOKE and the manipulation of triggers, stored routines (including stored procedures), and views—are all replicated to slaves using statement-based replication.
  • For statements such as CREATE TABLE ... SELECT, a CREATE statement is generated from the table definition and replicated using statement-based format, while the row insertions are replicated using row-based format.
  • The technology is the same as in most other database management systems; knowledge about other systems transfers to MySQL.
  • Fewer row locks are required on the master, which thus achieves higher concurrency, for the following types of statements: INSERT ... SELECT INSERT statements with AUTO_INCREMENT UPDATE or DELETE statements with WHERE clauses that do not use keys or do not change most of the examined rows. Fewer row locks are required on the slave for any INSERT, UPDATE, or DELETE statement.

For more information refer : http://dev.mysql.com/doc/refman/5.1/en/replication-sbr-rbr.html

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top