Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info

This guide is based on CentOS 6

Install MariaDB on slave server

Install in the replica server 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:

...

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 DB server

Create the replication configuration file in Maria master DB master server:

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

...

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:

Code Block
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:

...

Initial replication

Open a new session on Maria master DB master server and execute the command commands below in MySQL mysql prompt. Keep this session open until replication has been completed.

Code Block
FLUSH TABLES WITH READ LOCK;

Get current binlog position by executing the command below on Maria DB prompt:

Code Block
SHOW MASTER STATUS;

This will show current position master status on master binfileDB server. We will need this value later when replicating the DB in the Maria slave DB slave serverserver in the slave. Leave this session as it is until replication is completed:

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 dump.sql from previous step from Maria master DB master server to Maria slave DB slave server. Once copied, import it into Maria slave DB slave server. If this is a new installation you may need to create kinton database.

Code Block
mysql < dump.sql

Once imported, configure Maria slave DB slave 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:

Code Block
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 with this command:

Code Block
START SLAVE;

You can check replication status by executing on the slave:

Code Block
MariaDB [kinton]> 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
              Replicate_Do_DB: 
          Replicate_Ignore_DB: 
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
                   Last_Errno: 0
                   Last_Error: 
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 3713036
              Relay_Log_Space: 989
              Until_Condition: None
               Until_Log_File: 
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File: 
           Master_SSL_CA_Path: 
              Master_SSL_Cert: 
            Master_SSL_Cipher: 
               Master_SSL_Key: 
        Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error: 
               Last_SQL_Errno: 0
               Last_SQL_Error: 
  Replicate_Ignore_Server_Ids: 
             Master_Server_Id: 1
1 row in set (0.00 sec)

When the Slave_IO_State is "Waiting for master to send event" means you replication is working okreplication is finished. Once the DB is replicated, you can close the first session on master DB server where locks were set and master status was requested.

References

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

...