Configure MySQL Server for Binary Log Replication. One or more masters and one or more slaves are configured, i.e. one or more clusters, each of one master and one or more slaves. For more information on Droid, please see droidphp.com.
The steps involved are:-
- Copy a configuration file to each host.
- Create a user on the master for replication usage by the slave(s).
- Insert information about the master into the database of the slave(s).
- Restart the slave(s) and then the master(s).
- Optionally, load data into the master(s).
- The MySQL Service is running on both master and slave.
- The MySQL Service is configured in the same fashion as the Debian mysql-server package.
- The MySQL Service on the master has not yet been running with binary logging enabled.
- All MySQL services will use the same MySQL user names and passwords.
- Master and slave will communicate through privately addressed network interfaces.
- SQL Queries will be performed using the MySQL root user account.
- A MySQL user named "repln" is created on master services, able to
connect from any host and granted the
REPLICATION SLAVE
privilege for all databases and tables. These details cannot be varied. - This module will optionally load data for a single, named database and the data file must be gzipped.
-
Two or more Inventory Hosts, having a
public_ip
. -
One or more Inventory Hosts designated as master, thus:-
my-master: private_ip: <ip_addr> variables: replication_role: "master" replication_id: <integer> # must be unique among master and its slaves replication_innodb_is_used: <boolean> # whether InnoDB will be used initial_data_dbname: <null || string> # name of a database to seed with data initial_data_path: <null || string> # path to a gzipped SQL data file
-
One or more Inventory Hosts designated as slave, thus:-
my-slave: private_ip: <ip_addr> variables: replication_role: "slave" replication_id: <integer> # must be unique among slaves and master replication_innodb_is_used: <boolean> replication_master_host: <ip_addr> # private_ip of the corresponding master
-
Password values for the following variables:-
passwords: mysql: root: <string> # For the root user repln: <string> # For the repln user
-
The path of the MySQL binary log file, used in both master and slave configuration:-
module_mysql_repln: binary_log_path: <string> # default is "/var/log/mysql/mysql-bin.log"