没有合适的资源?快使用搜索试试~ 我知道了~
mysql互为主从配置
资源推荐
资源详情
资源评论
114库配置文件:
[root@Test-node02 mysql5.6]# cat /etc/my.cnf
[mysqld]
server-id = 2
datadir = /data/mysql
socket = /data/mysql/mysql.sock
#master-host = 172.16.88.113
user = mysql
port = 3307
log-bin = mysql-bin
log-bin-index = mysql-bin.index
replicate-do-db = test
replicate-wild-do-table = test.%
log-slave-updates
sync_binlog = 1
slave-skip-errors=all
symbolic-links = 0
pid-file = /data/mysql/mysqld.pid
character-set-server = utf8
#[mysqld_safe]
log-error = /data/mysqllog/mysqld_err.log
[client]
default-character-set = utf8
113库配置文件:
[root@Test-node01 ~]# cat /etc/my.cnf
[mysqld]
server-id = 1
datadir = /data/mysql
socket = /data/mysql/mysql.sock
[root@Test-node02 mysql5.6]# cat /etc/my.cnf
[mysqld]
server-id = 2
datadir = /data/mysql
socket = /data/mysql/mysql.sock
#master-host = 172.16.88.113
user = mysql
port = 3307
log-bin = mysql-bin
log-bin-index = mysql-bin.index
replicate-do-db = test
replicate-wild-do-table = test.%
log-slave-updates
sync_binlog = 1
slave-skip-errors=all
symbolic-links = 0
pid-file = /data/mysql/mysqld.pid
character-set-server = utf8
#[mysqld_safe]
log-error = /data/mysqllog/mysqld_err.log
[client]
default-character-set = utf8
113库配置文件:
[root@Test-node01 ~]# cat /etc/my.cnf
[mysqld]
server-id = 1
datadir = /data/mysql
socket = /data/mysql/mysql.sock
user = mysql
port = 3307
replicate-do-db = test
replicate-wild-do-table = test.%
log-bin = mysql-bin
log-bin-index = mysql-bin.index
log-slave-updates
sync_binlog = 1
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links = 0
character-set-server = utf8
slave-skip-errors = all
#[mysqld_safe]
log-error = /data/mysqllog/mysqld_error.log
pid-file = /data/mysql/mysqld.pid
[client]
default-character-set = utf8
主库:
create user 'devops'@'172.16.88.%' IDENTIFIED BY '123456';
grant all privileges ON *.* TO 'devops'@'172.16.88.%' IDENTIFIED BY '123456';
grant replication slave on *.* to 'devops'@'172.16.88.113' identified by '123456';
从库:
mysql> CHANGE MASTER TO
-> MASTER_HOST='172.16.88.114', MASTER_PORT=3307,
-> MASTER_USER='devops',
-> MASTER_PASSWORD='123456',
port = 3307
replicate-do-db = test
replicate-wild-do-table = test.%
log-bin = mysql-bin
log-bin-index = mysql-bin.index
log-slave-updates
sync_binlog = 1
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links = 0
character-set-server = utf8
slave-skip-errors = all
#[mysqld_safe]
log-error = /data/mysqllog/mysqld_error.log
pid-file = /data/mysql/mysqld.pid
[client]
default-character-set = utf8
主库:
create user 'devops'@'172.16.88.%' IDENTIFIED BY '123456';
grant all privileges ON *.* TO 'devops'@'172.16.88.%' IDENTIFIED BY '123456';
grant replication slave on *.* to 'devops'@'172.16.88.113' identified by '123456';
从库:
mysql> CHANGE MASTER TO
-> MASTER_HOST='172.16.88.114', MASTER_PORT=3307,
-> MASTER_USER='devops',
-> MASTER_PASSWORD='123456',
剩余6页未读,继续阅读
资源评论
yangle0000
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功