Questions tagged [mysql-replication]

Replication enables data from one MySQL database server (the master) to be replicated to one or more MySQL database servers (the slaves).

Replication enables data from one MySQL database server (the master) to be replicated to one or more MySQL database servers (the slaves). Replication is asynchronous - slaves need not be connected permanently to receive updates from the master. This means that updates can occur over long-distance connections and even over temporary or intermittent connections such as a dial-up service. Depending on the configuration, you can replicate all databases, selected databases, or even selected tables within a database.

The target uses for replication in MySQL include:

  • Scale-out solutions - spreading the load among multiple slaves to improve performance. In this environment, all writes and updates must take place on the master server. Reads, however, may take place on one or more slaves. This model can improve the performance of writes (since the master is dedicated to updates), while dramatically increasing read speed across an increasing number of slaves.

  • Data security - because data is replicated to the slave, and the slave can pause the replication process, it is possible to run backup services on the slave without corrupting the corresponding master data.

  • Analytics - live data can be created on the master, while the analysis of the information can take place on the slave without affecting the performance of the master.

  • Long-distance data distribution - if a branch office would like to work with a copy of your main data, you can use replication to create a local copy of the data for their use without requiring permanent access to the master.

514 questions
97
votes
11 answers

How can I export the privileges from MySQL and then import to a new server?

I know how to export/import the databases using mysqldump & that's fine but how do I get the privileges into the new server. For extra points, there are a couple of existing databases on the new one already, how do I import the old servers…
Gareth
  • 8,413
  • 13
  • 43
  • 44
20
votes
5 answers

Can a MySQL slave be a master at the same time?

I am in the process of migrating 2 DB servers (Master & Slave) to two new DB Servers (Master and Slave) DB1 - Master (production) DB2 - Slave (production) DB3 - New Master DB4 - New Slave Currently I have the replication set up as: DB1 -> DB2 DB3…
mmattax
  • 1,284
  • 7
  • 19
  • 30
17
votes
4 answers

MySQL Master-Master Replication of ALL databases. How?

Background: I have two MySQL 5.1 servers setup in Master-Master row-based-replication (RBR) following this excellent guide. I want all databases replicated, and will be adding new databases regularly. Goal: I would like to be able to add new…
Andrew Ensley
  • 912
  • 2
  • 16
  • 30
15
votes
2 answers

Is it ok to replicate the `mysql` database?

When I originally set up my master-to-master replication, I used: binlog-ignore-db=mysql and have been syncing the user accounts and grants manually. This is simply how it was done in the how-to I was using at the time. But is there any reason…
dlo
  • 451
  • 1
  • 4
  • 14
14
votes
6 answers

What causes the MySQL error 1062 - duplicate entry when starting slave?

MySQL Master version: 5.5.16-1 MySQL Slave version: 5.5.18-1 The master's snapshot is created by: mysql> FLUSH TABLES WITH READ LOCK; shell> mysqldump --all-databases --master-data > dbname_`date +%F`.sql This dump file is imported on the slave…
quanta
  • 50,327
  • 19
  • 152
  • 213
14
votes
3 answers

How to setup MySQL replication with minimal downtime

Basically we have a large MySQL database and we're looking to do replication to a slave (master slave setup). Do you guys have any step-by-step guide on how to do this with MINIMAL downtime on the database? Backing up the database and transferring…
Patrick
  • 455
  • 1
  • 7
  • 10
14
votes
5 answers

Prevent non-replication writes to MySQL slave?

We have some MySQL database servers set up with row-based replication, for performance. The software writes to the master, and reads from either the master or the slave. Everything's working great, for the most part. It's my understanding that…
Ken
12
votes
3 answers

Slave replication stops with Last_SQL_Errno: 1032

I have added an extra Slave server to an existing MySQL Replication. The Master server and the old Slave server are working fine without any issue, but the newly added server is stoping with the following error: Last_SQL_Errno: 1032 …
adminz
  • 397
  • 2
  • 4
  • 19
12
votes
5 answers

Can I run mysqld on top of glusterfs?

I have been playing with glusterfs recently. What I want to try is to run mysqld on top of the glusterfs in a similar way as it is possible to run MySQL on top of DRBD. I am familiar with MySQL replication and the advantages of using that instead…
Richard Holloway
  • 7,256
  • 2
  • 24
  • 30
11
votes
3 answers

MySQL replication across geographically separate servers

My organisation has been looking into how to spread our servers around geographically while keeping backups very up to date, and ideally spreading the load. The initial thing I have in mind is Rails on MySQL. The write rate isn't too high…
Hamish Downer
  • 9,142
  • 6
  • 36
  • 49
10
votes
1 answer

Slave_SQL_Running: No: MySQL replication stopped working

Replication on my slave database (MySQL 5.7.12) stopped working suddenly. When I run SHOW SLAVE STATUS\G I see the following error: Last_Errno: 1396 Last_Error: Error 'Operation CREATE USER failed for 'user'@'ip'' on query. Default database: ''.…
tptcat
  • 217
  • 1
  • 2
  • 7
10
votes
2 answers

Restart mysql replication after sql_error

I have two mysql servers, one master and one slave. Someone went on to the slave and created a table, then subsequently went on to the master and created the same table. Of course this DDL statement was replicated to the slave, causing an error,…
ʞɔıu
  • 259
  • 1
  • 4
  • 9
9
votes
1 answer

max_binlog_size & log-bin size

I have a problem with full disk -rw-rw---- 1 mysql mysql 1073741982 2012-07-03 18:14 mysql-bin.000034 -rw-rw---- 1 mysql mysql 1073741890 2012-07-04 14:39 mysql-bin.000035 -rw-rw---- 1 mysql mysql 1073741988 2012-07-05 09:16…
jmp
  • 187
  • 1
  • 1
  • 6
9
votes
1 answer

Which binlog format to use for MySQL Replication?

Just about to start using MySQL replication and I'm wondering what kind of binlog format is the best to use? There's Row, Statement and Mixed. I'm going to be using 5.1.49. Row is winning at the moment but I'm just wondering why I should use mixed…
delenda
  • 91
  • 1
  • 1
  • 2
8
votes
1 answer

Recovery strategy for Master-Master replication

I have implemented a HA solution for mysql based on master-master replication. There is a mechanism on the front end part which guarantees that only one db will be read/written to at a given time (i.e. we only use replication for HA). I have…
1
2 3
34 35