mariadb star replication
Hello Techrunnr subscribers, this document deals with how to set up mariadb star replication.
This type of topology requires when the application runs in a different region. And our motive is to update data in all the servers on a real-time basis.
How does it work?
So here we are choosing around 9 servers in a different location. Out of these, we have a server which is placed in the center. In the initial configuration, the central server is marked as the slave for all the servers, which retrieves all the data from all the servers which are in different locations.
So any write operation in the any of the servers will be updated to the central server.
Next setup is to setup slave on all the servers except the central server, and the master for all the edge servers will be the central server.
So whatever update happened on the server will be pushed or replicated to all the edge location server.
Basically, if any updated in any of the edge location servers first will get updated to the central server and then pushed to all the other servers in the edge location.
So let’s start the configuration.
- Running MariaDB server on all the servers
- Root access to all the servers to change the MariaDB configuration.
1. Change your my.cnf configuration accordingly.
On Central server
On Other nodes
2. Restart the MySQL service
3. Create a common user in all your outer nodes for replication
4. Once you create the user, connect all your nodes from the central node.
5. In the Central server, start the all the slave connection
6. Check the slave connection status using the following command,
7. Stop the slaves
Now you have completed multi-source slave configuration and the topology looks like this,
So let’s do the second phase of the project.
8. Now create a replication user in central Node.
9. Now connect all your nodes to the central server, where it pushes all data to other end nodes.
10. Start all the slaves in all server
11. Check the status of replication
12. Create a database called DB, check whether its getting replicating in all servers.
create database DB;
Now you have completed the star replication of MariaDB server and Database server topology looks like this.
© 2018, Techrunnr. All rights reserved.