Master-Master Replication With MySQL 5 On Fedora 8
|
Submitted by o.meyer (Contact Author) (Forums) on Sun, 2008-02-17 19:06. :: Fedora | High-Availability | MySQL
Master-Master Replication With MySQL 5 On Fedora 8Version 1.0 This document describes how to set up master-master replication with MySQL 5 on Fedora 8. Since version 5, MySQL comes with built-in support for master-master replication, solving the problem that can happen with self-generated keys. In former MySQL versions, the problem with master-master replication was that conflicts arose immediately if node A and node B both inserted an auto-incrementing key on the same table. The advantages of master-master replication over the traditional master-slave replication are that you don't have to modify your applications to make write accesses only to the master, and that it is easier to provide high-availability because if the master fails, you still have the other master. This howto is a practical guide without any warranty - it doesn't cover the theoretical backgrounds. There are many ways to set up such a system - this is the way I chose.
1 PreparationFor this howto I set up two Fedora 8 systems (minimal installation without gui etc.) with the following configuration.
1.1 System 1Hostname: server1.example.com
1.2 System 2Hostname: server2.example.com
2 MySQL2.1 Needed Packages On Both SystemsIf you haven't installed MySQL on both systems you can install it (client & server) via: yum -y install mysql mysql-server
2.2 MySQL Server Initial Start On Both SystemsStart the MySQL server. /etc/init.d/mysqld start
2.3 MySQL Root Password2.3.1 Both SystemsSet a password for the MySQL root-user on localhost. mysqladmin -u root password %sql_root_password%
2.3.2 System 1Set a password for the MySQL root-user on server1.example.com. mysqladmin -u root -h server1.example.com password %mysql_root_password%
2.3.3 System 2Set a password for the MySQL root-user on server2.example.com. mysqladmin -u root -h server2.example.com password %mysql_root_password%
2.4 MySQL Replication User2.4.1 System 1Create the replication user that System 2 will use to access the MySQL database on System 1. mysql -u root -p GRANT REPLICATION SLAVE ON *.* TO 'slave2_user'@'%' IDENTIFIED BY '%mysql_slaveuser_password%';
2.4.2 System 2Create the replication user that System 1 will use to access the MySQL database on System 2. mysql -u root -p GRANT REPLICATION SLAVE ON *.* TO 'slave1_user'@'%' IDENTIFIED BY '%mysql_slaveuser_password%';
2.5 Database On System 2I proceed on the assumption that the database exampledb is already existing on System 1 - containing tables with records. So we have to create an empty database with the same name as the existing database on System 1. mysql -u root -p CREATE DATABASE exampledb;
|
www.seamlessenterprise.com
One number. One voicemail. Seize the lead. Sprint Mobile Integration.
www.seamlessenterprise.com
One Number. One Voicemail.
Make it easier for clients to reach you. Turn your desk phone and mobile phone into one with Sprint Mobile Integration.
www.seamlessenterprise.com
One number. One voicemail. Sprint Mobile Integration.
www.seamlessenterprise.com
AT&T Synaptic Compute as a Service. Boost your power on demand.
Trial: IBM Cognos Express Reporting, Analysis & Planning
Learn benefits of Simpana software.
View the Gartner Video




print: 

Recent comments
10 hours 33 min ago
11 hours 27 min ago
14 hours 49 min ago
20 hours 9 min ago
20 hours 33 min ago
1 day 4 hours ago
1 day 4 hours ago
1 day 4 hours ago
1 day 6 hours ago
1 day 8 hours ago