...
Install in the replica server the same MariaDB server package that Abiquo API server is using. This can be achieve by installing the corresponding abiquo-release package on the replica server and executing the command below:
Code Block |
---|
# yum -y install MariaDB-server MariaDB-client |
Warning |
---|
Current reporting design has a problem with concurrent generation of the same report for the same enterprise, please visit Jasper concurrency for a workaround to this issue. |
Configure
...
DB replication
...
on master server
...
Create a new file under the replication configuration file in Maria DB master server:
Code Block |
---|
cat <<EOF >/etc/my.cnf.d/replication.cnf |
...
Code Block |
---|
[server] log-basename=master log-bin binlog-format=row server_id=1 EOF |
Restart mysql service:
Code Block |
---|
# service mysql restart |
Grant permissions to replicator user
Execute this query on the master server mysql prompt, changing <slave_ip> for the slave server, and setting a real secret password.Create a replicator user and grant it replication permissions by executing the query below on DB prompt. Replace SLAVE_IP and PASSWORD accordingly:
Code Block |
---|
GRANT REPLICATION SLAVE ON *.* TO 'replicator'@'<slaveSLAVE_ip>IP' IDENTIFIED BY 's3cr3tPASSWORD'; |
...
Configure DB replication on slave server
...
Create a new file under the replication configuration file in Maria DB slave server:
Code Block |
---|
cat <<EOF >/etc/my.cnf.d/replication.cnf |
...
Code Block |
---|
[server] server_id=2 EOF |
Restart mysql service:
Code Block |
---|
# service mysql restart |
Initial replication
Get master binlog position
Flush and lock tables
On master's mysql prompt execute, is importat to keep this terminal Open a new session on Maria DB master server and execute the command below in MySQL prompt. Keep this session open until replication has been completely configuredcompleted.
Code Block |
---|
FLUSH TABLES WITH READ LOCK; |
Get current binlog position
...
Execute on mysql promptby executing the command below on Maria DB prompt:
Code Block |
---|
SHOW MASTER STATUS; |
This will show curren current position on master 's binfile, we will ned those values later. We will need this value later when replicating the DB in the Maria DB slave server:
Code Block |
---|
MariaDB [(none)]> SHOW MASTER STATUS; +----------------------+----------+--------------+------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | +----------------------+----------+--------------+------------------+ | localhost-bin.000002 | 3712878 | | | +----------------------+----------+--------------+------------------+ 1 row in set (0.00 sec) |
Copy existing database to slave server
...
On a different session, dump kinton and kinton_accounting databases on Maria DB master server:
Code Block |
---|
mysqldump --databases kinton kinton_accounting --routines > dump.sql |
Configure slave replication point
Copy the generated kinton_ dump.sql to the slave server using scp or any other method.Import this dump on your slave server, if from previous step in Maria DB master server to Maria DB slave server.
Once copied, import it on Maria DB slave server. If this is a new installation you may need to create kinton database.
Code Block |
---|
mysql < dump.sql |
...
Once database is on the slave, we should tell mysql to start replicating the master from the frozen binlog position we set before.
...