Kinton Database replication
Install MariaDB on replica server
Install the same MariaDB server package that Abiquo API server is using on the replica server.
On the replica server, Install your
abiquo-release package
Install MariaDB with this command
yum -y install MariaDB-server MariaDB-client
Â
Configure DB replication on the main DB server
On the main DB server, create the replication configuration file
cat <<EOF >/etc/my.cnf.d/replication.cnf [server] log-basename=master log-bin binlog-format=row server_id=1 EOF
Â
Restart the mysql service
service mysql restart
Â
Create a replicator user and grant it replication permissions by executing the query below on DB prompt. Replace
REPLICA_USER
,REPLICA_PASS,
andREPLICA_SERVER
with values for your environment.
Â
Configure DB replication on replica DB server
Create the replication configuration file in Maria DB replica server.
Restart the
mysql
service.
To use multiple replica servers, in /etc/my.cnf.d/replication.cnf
for each replica server, you must define a different server_id
, and it must be greater than the server_id
of the main server.
Perform initial replication
To perform the initial replication, get the current status of the main DB, including the file and the current position in the log, and then perform a dump of the database with the following steps
Open a new session on the main DB server at the
mysql
promptRun the following commands to get the file and current position
Leave this session open and don’t make any changes until replication is completed.
On the MariaDB main server, open another session and dump the
kinton
andkinton_accounting
databases using--single-transaction
option
Â
Â
Configure slave replication point
Copy
dump.sql
from the previous step from the main DB server to the replica DB server.When the copy finishes, import it into replica DB server. If this is a new installation you may need to create the
kinton
databases.When the import finishes, configure replica DB server replication. On the replica DB server, go to the
mysql
prompt and run the change master command belowReplace
MAIN_SERVER
,REPLICA_USER
andREPLICA_PASS
.ReplaceÂ
MASTER_LOG_FILE
andMASTER_LOG_POS
from the show master status aboveFor example, using the values from above ofÂ
master-bin.000001
andÂ3712878
On the replica server, at the
mysql
prompt, start replica DB replicationÂ
To check replication status, run the following command on the replica DB
When Slave_IO_State is
Waiting for master to send event
, replication is finishedRelease locks by closing the first session on master DB server where locks were set and the master status was requested, and you are done!
References
https://mariadb.com/kb/en/setting-up-replication/