Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 24 Next »

This guide is based on CentOS 6

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.

Install MariaDB on slave server

Install the same MariaDB server package that Abiquo API server is using in the slave server. This can be achieve by installing the corresponding abiquo-release package on the replica server and executing the command below:

yum -y install MariaDB-server MariaDB-client

Configure DB replication on master DB server

Create the replication configuration file in master DB server:

cat <<EOF >/etc/my.cnf.d/replication.cnf
[server]
log-basename=master
log-bin
binlog-format=row
server_id=1
EOF

Restart mysql service:

service mysql restart

Create a replicator user and grant it replication permissions by executing the query below on DB prompt. Replace SLAVE_IP and PASSWORD accordingly to your installation:

GRANT REPLICATION SLAVE ON *.* TO 'replicator'@'SLAVE_IP' IDENTIFIED BY 'PASSWORD';
FLUSH PRIVILEGES;

Configure DB replication on slave DB server

Create the replication configuration file in Maria DB slave server:

cat <<EOF >/etc/my.cnf.d/replication.cnf
[server]
server_id=2
EOF

Restart mysql service:

service mysql restart

Initial replication

Open a new session on master DB server and execute the commands below in mysql prompt.

FLUSH TABLES WITH READ LOCK;
SHOW MASTER STATUS;

This will show master current status. We will need this later when replicating the DB in the slave. Leave this session as it is until replication is completed:

+----------------------+----------+--------------+------------------+
| File                 | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+----------------------+----------+--------------+------------------+
| localhost-bin.000002 |  3712878 |              |                  |
+----------------------+----------+--------------+------------------+
1 row in set (0.00 sec)

On a different session, dump kinton and kinton_accounting databases on Maria DB master server:

mysqldump --databases kinton kinton_accounting --routines > dump.sql 

Configure slave replication point

Copy dump.sql from previous step from master DB server to slave DB server. Once copied, import it into slave DB server. If this is a new installation you may need to create kinton database.

mysql < dump.sql

Once imported, configure slave DB server replication. Replace MASTER_HOST, MASTER_USER, MASTER_PASSWORD, MASTER_LOG_FILE and MASTER_LOG_POS accordingly to previous steps in command below and execute it in slave server mysql prompt:

CHANGE MASTER TO
  MASTER_HOST='MASTER_IP',
  MASTER_USER='replicator',
  MASTER_PASSWORD='PASSWORD',
  MASTER_PORT=3306,
  MASTER_LOG_FILE='localhost-bin.000002',
  MASTER_LOG_POS=3712878,
  MASTER_CONNECT_RETRY=10;

Start slave DB replication from slave mysql prompt:

START SLAVE;

You can check replication status by executing on the slave:

SHOW SLAVE STATUS\G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 10.60.13.25
                  Master_User: replicator
                  Master_Port: 3306
                Connect_Retry: 10
              Master_Log_File: localhost-bin.000002
          Read_Master_Log_Pos: 3713036
               Relay_Log_File: localhost-relay-bin.000002
                Relay_Log_Pos: 691
        Relay_Master_Log_File: localhost-bin.000002
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
...
1 row in set (0.00 sec)

Once Slave_IO_State is "Waiting for master to send event" replication is finished. Then, close the first session on master DB server where locks were set and master status was requested to release locks and you are done.

References

https://mariadb.com/kb/en/setting-up-replication/

 

  • No labels