![]() Otherwise, the slave databases will be mismatched or corrupted. Perform all of these actions carefully to ensure that the data dump will match the master server’s current data. Before enabling your master server to continue following the commands, dump its data.This will be needed later when completing the replication configuration. Copy down the file name and current coordinates for the master server within its binary log (see Step 10, below).Stop processing any commands on the master server.If there is information on the master server to coordinate with the slave servers before the replication process starts, take the following actions: The master server’s database must not take in any new changes during this step. To set up a new user account called replication, and allow it to connect for replication purposes from any host on the domain, execute this command on the master server: mysql> CREATE USER IDENTIFIED BY then: mysql> GRANT REPLICATION SLAVE ON *.* TO Step 9: Ensure Data on Your Servers Matchesĭuplicate the data through dumping from the master into the slave server.įlush tables must be set with a read lock. You can always find the user name and password on the account in plain text in the master repository. You can create the same account or different accounts for each slave. For this function, grant any account the replication slave privilege. We recommend establishing a dedicated account for replication. ![]() This requires you to set up a MySQL user account on the master server. To establish a connection, you need a MySQL user name and password. Step 8: Configure Server for ReplicationĮach slave server requires a way to connect to the master server. To save the firewall configuration, use the command: service iptables saveīe careful whenever opening ports to make sure you avoid hacks. This rule enables proper communication between devices. Step 7: Configure Firewall for Database AccessĪpplying the TCP Port 3306 rule adds a Firewall Policy that allows traffic on port 3306. Or, use /usr/bin/mysqladmin -u root password followed by a space and your new password and /usr/bin/mysqladmin -u root -h web01 password followed by a space and, again, your new password. To set the password, run the script for a secure installation that accompanies the MySQL package, responding with Y to all Y/n prompts. It is a good idea to set an administrative user password for MySQL. If it was, you should be able to start the service with the command: service mysqld start Step 6: Set Up MySQL Server Root Password Now, find out if MySQL was correctly installed. Set the service to run every time the system boots with the command: chkconfig mysqld on Step 5: Start MySQL Users and system administrators can update all software packages on an RPM-based Linux system with the following command: yum update Step 4: Install MySQLįor Linux systems based on the RedHat Package Manager, install the MySQL server package on both cloud servers with the command: yum install mysql-server Step 3: Update All Software Packages to their Current Version With CentOS, this is possible through the CentOS 6 base image.Ĭreate two Linux cloud servers with appropriate RAM and assign them distinct names. In this step, the privileged user needs to log into the cloud control. This command dumps the data into a file, transfers it, and restores it to the slave node. Use the mysqldump command to perform a dump-and-restore of information to the slave database. Step 1: Configure MySQL Database for Replication ![]() Meanwhile, the slave server runs as read-only. The master MySQL database runs in a read-write mode. This article assumes that you are using an RPM-based Linux distribution. Therefore, in a given command apt-get can usually replace yum.įor example, an install command is either yum install or apt-get install for the identical result. deb packages, the yum tool is generally replaced with the apt tool. Yum (Yellowdog Updater, Modified) is the package management tool for RedHat Package Manager Linux systems. ![]() Steps for Setting Up Master-Slave Database Replication in MySQL Note: The term master-slave serves to distinguish this model from master-master replication – in which any member of the group may update the information. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |