HP OSMS Blueprint: Database Server on HP Server Platforms with MySQL and RHEL5
+-----------------------+-----------+-------------------+------------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+-----------------------+-----------+-------------------+------------------------+
| mysql-bin.000001 | 1678 | | |
+-----------------------+-----------+-------------------+------------------------+
1 row in set (0.00 sec)
This output shows that the MySQL server is using mysql-bin.000001 as its binary log
file. The current log position in the log file is 1678. The values of Binlog_Do_DB and
Binlog_Ignore_DB are not configured. Record the name of the binary log file and the
current position because these values are needed when you configure the slave servers.
4. Start the MySQL command-line client by entering the following command:
# mysql –u root –p
At the prompt, enter the database password.
5. Create a replication user on the master server that has the privileges needed to connect and
change mastership to the master server. The slave server uses this account to connect and
configure the master/slave relationship.
If the osmusr user account does not already exist, to create it, issue the following command:
mysql> create user 'osmusr'@'slave.test' identified by 'osmpass';
6. Next, grant the necessary privileges to allow the MySQL slave servers to connect to the
master server and establish replication:
mysql> grant replication slave on *.* to ‘osmusr’@’slave.test’ \
identified by ‘osmpass’;
The master server is now ready for the slave servers’ connection.
Configuring the Slave Servers
NOTE: The following procedure must be run on both slave servers.
1. Change the server-id parameter in the /etc/my.cnf file as follows:
[mysqld]
server-id=2
If you are setting up multiple slave servers, each one must have a unique server-id value
that differs from that of the master server and from each of the other slave servers.
2. Verify that the MySQL server on the slave server can be restarted correctly by entering the
following command:
# /etc/init.d/mysql restart
3. The following SQL commands are used to set the master server information on the slave
server:
mysql> CHANGE MASTER TO
-> MASTER_HOST='master_host_name',
-> MASTER_USER='replication_user_name',
-> MASTER_PASSWORD='replication_password',
-> MASTER_LOG_FILE='recorded_log_file_name',
-> MASTER_LOG_POS=recorded_log_position;
For this example, enter the following commands:
mysql> CHANGE MASTER TO
-> MASTER_HOST='master.test',
-> MASTER_USER='osmusr',
-> MASTER_PASSWORD='osmpass',
18