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.

519 questions
7
votes
9 answers

Monitor MySQL Replication

What is the best practice for monitoring a slave to make sure that it is a) Still running b) Not too far being the master I would like to alert by email if it is behind, happy to write a script or two to hook into command line applications.
johnwards
  • 765
  • 1
  • 9
  • 13
7
votes
1 answer

MySQL Slave stuck on a single bin log + bin log position for 17+ hours

tl;dr: Replication is stalled on a specific binlog and position, and I'm not sure why I have a MySQL Replication setup with MySQL 5.5. This replication setup has no history of ever falling behind and has always been solid. This morning, I noticed…
Jim Rubenstein
  • 1,187
  • 1
  • 10
  • 16
7
votes
1 answer

MySQL: Pacemaker cannot start the failed master as a new slave?

pacemaker-1.0.12-1 corosync-1.2.7-1.1 I'm going to setup failover for MySQL replication (1 master and 1 slave) follow this guide: https://github.com/jayjanssen/Percona-Pacemaker-Resource-Agents/blob/master/doc/PRM-setup-guide.rst Here're the…
quanta
  • 51,413
  • 19
  • 159
  • 217
7
votes
3 answers

How to sync two MySQL tables (on demand or via cron)

I have seen Cron sync mysql tables . But I cannot use replication. I used to use percona-toolkit and it worked perfectly. I could run the sync command on demand or just run it via cron. It would compare checksums on the two tables and do inserts,…
Anirudh
  • 223
  • 2
  • 3
  • 7
7
votes
3 answers

Improving MySql replication speed

i'm looking for pointers on how to improve the replication speed of a mysql slave. It is fast enough for normal production but needs a long time to catch up if it falls behind for some reason. (If the server was turned off for or replication stopped…
edorian
  • 143
  • 1
  • 1
  • 8
6
votes
2 answers

Can I put the MySQL binlogs on a slow disk?

We have only 450 GB nvme space on our master server and the binlogs are using a lot of space, even if they are kept for only two days. Does writing the MySQL binlogs to a slower disk (like a remote directory) slow down the MySQL performance?
the_nuts
  • 430
  • 6
  • 19
6
votes
1 answer

MySQL - Unable to enable binary logging

I'm trying to enable binary logging so that I can set up master-slave replication between two servers. I'm working with an existing server with lots of data and I'm trying to dump the data with the following command: mysqldump -u root -p…
Justin
  • 161
  • 1
  • 6
6
votes
4 answers

Testing MySQL Database Replication / Synchronization

I'm setting up a MySQL Master database which replicates to a few Slave databases. My question is what are the best practices to monitor and / or test that the slave databases are up-to-date, and that would alert an admin when there is an error…
6
votes
3 answers

MySQL to PostgreSQL replication

Is there way to replicate in near-realtime MySQL changes to equal PostgreSQL database?
datacompboy
  • 663
  • 2
  • 7
  • 16
6
votes
1 answer

Recover a crashed MySQL master server from the slave

we are building a simple master/slave MySQL configuration using asynchronous replication, with MySQL enterprise 5.5.17 on both servers and innoDB based tables. In case of a crash of the master server we would like to offer to our users the…
LeonardoC
  • 61
  • 1
  • 2
6
votes
2 answers

MySQL slave replication reset with no Master Downtime (using MyISAM)

Root of the issue: In all instructions for creating a slave on a running master requires flush tables with read lock. We use MyISAM, so we can't just use --single transaction to get consistent table data. A slave fails for all sorts of "normal"…
Jonathan Hendler
  • 282
  • 1
  • 4
  • 10
6
votes
3 answers

Creating a *Consistent* *Online* MySQL Backup with InnoDB AND MyISAM tables

I just spent hours building a new database server to replace 2 failed servers from a mysqldump file created a month ago, then used my server's bin-logs to bring that mysqldump up to date. Now that I have this new database server online, and have…
6
votes
6 answers

How can I centralise MySQL data between 3 or more geographically separate servers?

To explain the background to the question: We have a home-grown PHP application (for running online language-learning courses) running on a Linux server and using MySQL on localhost for saving user data (e.g. results of tests taken, marks of…
Andy Castles
  • 98
  • 1
  • 9
6
votes
2 answers

How do I add additional databases to my mysql replication slave (read-only)?

I have a mysql read-only replication slave setup and currently working for about 10 databases and I need to add 3 new databases. I cannot find any information on how to add additional information. Does anyone have some guidance on how to do…
Greg Arcara
  • 183
  • 1
  • 7
6
votes
2 answers

MySQL replication issues after a power outage

After a power outage at our data centre, the slave MySQL databases are struggling. This is in the logs for one of the slaves: 100118 10:05:56 [Note] Slave I/O thread: connected to master 'repl@db1:3306', replication started in log 'bin-log.004712'…
jabley
  • 335
  • 3
  • 9
1
2
3
34 35