Linux Version:
$root@master # uname -a
Linux izwz92ycxa8b5h6uoxux99z 3.10.0-327.22.2.el7.x86_64 #1 SMP Thu Jun 23 17:05:11 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Release:
CentOS Linux release 7.2.1511 (Core)
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
CentOS Linux release 7.2.1511 (Core)
CentOS Linux release 7.2.1511 (Core)
Install:
yum install mariadb-server
systemctl enable mariadb
systemctl start mariadb
mysql_secure_installation
Master
ChangeConfig:
vi /etc/my.cnf
# add below
[mysqld]
log-bin
server_id=1
log-basename=master1
bind-address=<ip address>
# socket
CheckConfig:
show variables like 'sql_log_bin'; # sql_log_bin on
show variables like "skip_networking"; # sql_log_bin off
Create Slave User:
grant replication slave on *.* to xxxuser;
CheckStatus:
show master status; $ record the binlog and pos
Slave
ChangeConfig:
[mysqld]
log-bin
server_id=2
log-basename=slave1
bind-address=<ip address>
Config Master
CHANGE MASTER TO
MASTER_HOST="<ip address>",
MASTER_USER="user",
MASTER_PASSWORD="pass",
MASTER_PORT=3306,
MASTER_LOG_FILE="bin_log",
MASTER_LOG_POS=<pos>,
MASTER_CONNECT_RETRY=10;
Start Slave:
start slave;
Check Status:
show slave status;