Install XCALLY Motion
Install XCALLY Motion as usual by following the installation guide
Install MySQL on the REPLICA server
Recommended We strongly recommend you to use the same version of OS on both XCALLY Motion and MySQL servers
Run the following command on the REPLICA server:
yum install epel-release
wget https://provisioning.xcally.com/files/packages/motion/mysql57-community-release-el7-9.noarch.rpm
yum --assumeyes install yum-utils.noarch
rpm -ivh mysql57-community-release-el7-9.noarch.rpm
yum --assumeyes install mysql mysql-devel mysql-server mysql-connector-odbc
systemctl start mysqld.service
/usr/bin/mysql_secure_installation
About MySQL Installation Procedure Please refer to the MySQL official documentation here
Configure MySQL for the replica on the XCALLY Motion server
Edit the my.cnf fine under /etc/ and add the following rows:
my.cnf |
---|
#Replica DB GTID
server-id = 1
enforce-gtid-consistency=ON
gtid-mode=ON
log_slave_updates
binlog-format=ROW
binlog-do-db = motion2
relay-log = /var/lib/mysql/mysql-relay-bin
relay-log-index = /var/lib/mysql/mysql-relay-bin.index
log-error = /var/log/mysql.err
master-info-file = /var/lib/mysql/mysql-master.info
relay-log-info-file = /var/lib/mysql/mysql-relay-log.info
log-bin = /var/lib/mysql/mysql-bin
#Master Only
innodb_flush_log_at_trx_commit = 1
sync_binlog = 1
#Perf
relay_log_info_repository=TABLE
master_info_repository=TABLE
Save the file and run the commands:
systemctl stop motion.service
systemctl restart mysqld.service
Set the MySQL user permissions (XCALLY Motion server)
Choose a name and a password for the MySQL Replica user, e.g. replica_user / Password123
Connect to the MySQL CLI
mysql -u root -p
and run the commands:
MySQL CLI |
---|
mysql> GRANT REPLICATION SLAVE ON *.* TO 'replica_user'@'%' IDENTIFIED BY 'Password123';
mysql> FLUSH PRIVILEGES;
mysql> USE motion2;
mysql> FLUSH TABLES WITH READ LOCK;
mysql> SHOW MASTER STATUS;
Backup the XCALLY Motion database
cd /tmp
mysqldump --databases motion2 --opt --set-gtid-purged=off -u root --password='rootpassword'
>motion2.sql
MySQL CLI |
---|
mysql> use motion2;
mysql> UNLOCK TABLES;
mysql> quit;
Configure MySQL on the replica server
Edit the my.cnf fine under /etc/ and add the following rows:
my.cnf |
---|
#Replica DB
server-id = 2
read_only = 1
enforce-gtid-consistency=ON
gtid-mode=ON
log_slave_updates
binlog-format=ROW
replicate-do-db = motion2
relay-log = /var/lib/mysql/mysql-relay-bin
relay-log-index = /var/lib/mysql/mysql-relay-bin.index
log-error = /var/log/mysql.err
master-info-file = /var/lib/mysql/mysql-master.info
relay-log-info-file = /var/lib/mysql/mysql-relay-log.info
log-bin = /var/lib/mysql/mysql-bin
#Perf
relay_log_info_repository=TABLE
master_info_repository=TABLE
skip-slave-start
And restart the mysqld service
systemctl restart mysqld.service
Create the XCALLY Motion database on the replica server
Connect to MySQL CLI
mysql -u root -p
and run the command:
MySQL CLI |
---|
mysql> create database motion2 character set utf8 collate utf8_bin;
Restore the XCALLY Motion database on the replica server
Move the dump file (motion2.sql) to the replica server and perform the restore
mysql -u root -p -h localhost motion2 < motion2.sql
Start the replica service
Connect to MySQL CLI and run the commands:
MySQL CLI |
---|
mysql> CHANGE MASTER TO MASTER_HOST='MotionIpAddress', MASTER_USER='replica_user', MASTER_PASSWORD='Password123', MASTER_PORT=3306 , MASTER_AUTO_POSITION=1;
mysql> start slave;
mysql> show slave status\G
and remember to create the xcally mysql user:
MySQL CLI |
---|
mysql> GRANT ALL ON motion2.* TO 'xcall'@'%' IDENTIFIED BY 'xC@LL1234';
In the my.cnf , please comment (add #) the following row:
my.cnf |
---|
# skip-slave-start
Check the MySQL Replica service status
MySQL CLI |
---|
####Motion Server
mysql> show master status\G
*************************** 1. row ***************************
File: mysql-bin.000005
Position: 7781239
Binlog_Do_DB: motion2
Binlog_Ignore_DB:
Executed_Gtid_Set: b55eebff-c1e1-11e6-8321-0050560317c1:1-66943
1 row in set (0.00 sec)
####Slave:
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: xx.xx.xx.xx
Master_User: replica_user
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000005
Read_Master_Log_Pos: 7783315
Relay_Log_File: mysql-relay-bin.000006
Relay_Log_Pos: 7783525
Relay_Master_Log_File: mysql-bin.000005
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: motion2
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: 7783315
Relay_Log_Space: 43822229
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
Master_UUID: b55eebff-c1e1-11e6-8321-0050560317c1
Master_Info_File: mysql.slave_master_info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set: b55eebff-c1e1-11e6-8321-0050560317c1:1-66945
Executed_Gtid_Set: 655516e2-c1e0-11e6-8318-0050560317c2:1-770,
b55eebff-c1e1-11e6-8321-0050560317c1:1-66945
Auto_Position: 1
1 row in set (0.00 sec)