mysql-5.6多实例运行replication环境

本例4个实例 添加环境变量

echo 'export PATH=$PATH:/usr/local/mysql/bin' >> /etc/profile
source /etc/profile

my.cnf中的内容
[mysql] port = 3306
socket = /tmp/mysql3306.sock

[mysqldmulti]
mysqld = /usr/local/mysql/bin/mysqld
safe
mysqladmin = /usr/local/mysql/bin/mysqladmin
log = /data/mysql/mysqld_multi.log

[mysqld]
user=mysql
bind-address = 192.168.1.88
basedir = /usr/local/mysql
sqlmode=NOENGINESUBSTITUTION,STRICTTRANS_TABLES

slave Project-A

[mysqld3306]
lower_case_table_names = 1
mysqld=mysqld
mysqladmin=mysqladmin
datadir=/data/mysql/3306/data
relaylog = /data/mysql/3306/data/mysql-relay-bin
port=3306
server
id=3306
socket=/tmp/mysql3306.sock
log-output=file
slow_query_log = 1
long_query_time = 1
slow_query_log_file = /data/mysql/3306/log/slow.log
log-error = /data/mysql/3306/log/error.log
slave_parallel_workers = 4

slave Project-B

[mysqld3307]
lower_case_table_names = 1
mysqld=mysqld
mysqladmin=mysqladmin
datadir=/data/mysql/3307/data
relaylog = /data/mysql/3307/data/mysql-relay-bin
port=3307
server
id=3307
socket=/tmp/mysql3307.sock
log-output=file
slow_query_log = 1
long_query_time = 1
slow_query_log_file = /data/mysql/3307/log/slow.log
log-error = /data/mysql/3307/log/error.log
slave_parallel_workers = 4

slave for Project-C

[mysqld3308]
lower_case_table_names = 1
mysqld=mysqld
mysqladmin=mysqladmin
datadir=/usr/local/mysql/data/3308
relaylog = /usr/local/mysql/data/3308/mysql-relay-bin
port=3308
server
id=3308
socket=/tmp/mysql3308.sock
log-output=file
slow_query_log = 1
long_query_time = 1
slow_query_log_file = /usr/local/mysql/log/3308slow.log
log-error = /usr/local/mysql/log/3308error.log
slave_parallel_workers = 4

slave for Project-D

[mysqld3309]
lower_case_table_names = 1
mysqld=mysqld
mysqladmin=mysqladmin
datadir=/usr/local/mysql/data/3309
relaylog = /usr/local/mysql/data/3309/mysql-relay-bin
port=3309
server
id=3309
socket=/tmp/mysql3309.sock
log-output=file
slow_query_log = 1
long_query_time = 1
slow_query_log_file = /usr/local/mysql/log/3309slow.log
log-error = /usr/local/mysql/log/3309error.log
slave_parallel_workers = 4`

初始化数据库 如下例

/usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/data/mysql/3306/data --defaults-file=my.cnf

mysqld_multi进行多实例管理
启动全部实例: /usr/local/mysql/bin/mysqld_multi start

查看全部实例状态:/usr/local/mysql/bin/mysqld_multi report

启动单个实例:/usr/local/mysql/bin/mysqld_multi start 3306

停止单个实例:/usr/local/mysql/bin/mysqld_multi stop 3306

查看单个实例状态:/usr/local/mysql/bin/mysqld_multi report 3306