Next, log in to the MariaDB shell with the following command: mysql -u root -p Next, add the following lines at the end of the file: server-id = 2 Next, log in to the slave server and open the file /etc/mysql//50-server.cnf: nano /etc/mysql//50-server.cnfįind the line bind-address and change the value to 0.0.0.0 as shown below: bind-address = 0.0.0.0 You will need these values when configuring the slave server. Note: Please remember the File and Position details from the above output. Next, exit from the MariaDB shell with the following command: EXIT | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | You should get the following output: +-+-+-+-+ Next, check the master server status with the following command: show master status Next, grant the replication slave privilege to this user with the following command: GRANT REPLICATION SLAVE ON *.* TO flush the privileges with the following command: FLUSH PRIVILEGES Provide your root password when prompted, then create a user with the following command: CREATE USER identified by 'your-password' The slave server will use this user to log into the master server and request binary logs.įirst, log in to MariaDB shell with the following command: mysql -u root -p Next, you will need to create a replication user. Then, restart the MariaDB service to implement the changes: systemctl restart mariadb Save and close the file when you are finished. Relay_log_index = /var/log/mysql/mysql-relay-bin.index Relay_log = /var/log/mysql/mysql-relay-bin Next, add the following lines at the end of the file: server-id = 1 To do so, open the file /etc/mysql//50-server.cnf with your preferred text editor: nano /etc/mysql//50-server.cnfįind the line bind-address and change the value to 0.0.0.0 to allow inbound connections. Next, you will need to enable binary logging and replication on the master server. Remove test database and access to it? YĪt this point, you have installed and secured both MariaDB servers. You can install it by running the following command: apt-get install mariadb-server mariadb-client -yĪfter installing MariaDB, run the following command to secure the MariaDB installation: mysql_secure_installationĪnswer all the questions as shown below: Enter current password for root (enter for none): Press Enter apt-get update -y Step 2 – Install MariaDB on Both Serversįirst, you will need to install MariaDB on both servers. Once you are logged into your Ubuntu 18.04 server, run the following command to update your base system with the latest available packages. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page. Create a new server, choosing Ubuntu 18.04 as the operating system with at least 2GB RAM. Step 1 – Create an Atlantic.Net Cloud Serverįirst, log in to your Atlantic.Net Cloud Server. A static root password configured on both servers.Two fresh Ubuntu 18.04 VPS on the Atlantic.Net Cloud Platform.In this tutorial, we will show you how to set up MariaDB master-slave replication on Ubuntu 18.04 server. You can use MariaDB master-slave replication for several purposes some of these are listed below: If the master server goes down, you can still recover your data from the slave server. If you change the data on the slave server, it will not be replicated to the master server. In master-slave replication, data is replicated one-way only. In the master-slave topology, one server acts as the master and other servers act as slaves. Replication is the process of copying data from one master database server to another slave database server. MariaDB is a free, open-source relational database management system, and is one of the most popular options.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |