频道栏目
首页 > 网络 > 其他 > 正文

无需申请自动送

2018-11-30 10:51:38           
收藏   我要投稿
在master1上

vim /etc/my.cnf

[mysqld]

socket=/tmp/mysql.sock

basedir=/usr/local/mysql

datadir=/mydata/data

log-bin=/mydata/binlog/log-bin

server-id=1

bind-address = 0.0.0.0

skip-name-resolve

mysql

GRANT REPLICATION SLAVE,REPLICATION CLIENT ON *.* TO &无需申请自动送39;repluser&无需申请自动送39;@&无需申请自动送39;192.168.130.%&无需申请自动送39; IDENTIFIED BY &无需申请自动送39;replpass&无需申请自动送39;;

FLUSH PRIVILEGES;

mysql> show master status;

+----------------+----------+--------------+------------------+-------------------+

| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |

+----------------+----------+--------------+------------------+-------------------+

| log-bin.000017 | 154 | | | |

+----------------+----------+--------------+------------------+-------------------+

1 row in set (0.00 sec)

在master2上

vim /etc/my.cnf

[mysqld]

socket=/tmp/mysql.sock

basedir=/usr/local/mysql

datadir=/mydata/data

log-bin=/mydata/binlog/log-bin

server-id=2

bind-address = 0.0.0.0

skip-name-resolve

mysql

GRANT REPLICATION SLAVE,REPLICATION CLIENT ON *.* TO &无需申请自动送39;repluser&无需申请自动送39;@&无需申请自动送39;192.168.130.%&无需申请自动送39; IDENTIFIED BY &无需申请自动送39;replpass&无需申请自动送39;;

FLUSH PRIVILEGES;

mysql> show master status;

+----------------+----------+--------------+------------------+-------------------+

| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |

+----------------+----------+--------------+------------------+-------------------+

| log-bin.000017 | 154 | | | |

+----------------+----------+--------------+------------------+-------------------+

1 row in set (0.00 sec)

在slave上

vim /etc/my.cnf

[mysqld]

socket=/tmp/mysql.sock

basedir=/usr/local/mysql

datadir=/mydata/data

无需申请自动送log-bin=/mydata/binlog/log-bin

server-id=3

relay-log = /mydata/binlog/relay-bin

bind-address = 0.0.0.0

skip-name-resolve

master_info_repository=TABLE

relay_log_info_repository=TABLE

SHOW GLOBAL VARIABLES LIKE &无需申请自动送39;%repository%&无需申请自动送39;;

CHANGE MASTER TO MASTER_HOST=&无需申请自动送39;192.168.130.61&无需申请自动送39;, MASTER_USER=&无需申请自动送39;repluser&无需申请自动送39;, MASTER_PASSWORD=&无需申请自动送39;replpass&无需申请自动送39;, MASTER_LOG_FILE=&无需申请自动送39;log-bin.000017&无需申请自动送39;, MASTER_LOG_POS=154 FOR CHANNEL &无需申请自动送39;Master_1&无需申请自动送39;;

START SLAVE FOR CHANNEL &无需申请自动送39;Master_1&无需申请自动送39;;

SHOW SLAVE STATUS FOR CHANNEL &无需申请自动送39;Master_1&无需申请自动送39;\G;

CHANGE MASTER TO MASTER_HOST=&无需申请自动送39;192.168.130.62&无需申请自动送39;, MASTER_USER=&无需申请自动送39;repluser&无需申请自动送39;, MASTER_PASSWORD=&无需申请自动送39;replpass&无需申请自动送39;, MASTER_LOG_FILE=&无需申请自动送39;log-bin.000017&无需申请自动送39;, MASTER_LOG_POS=154 FOR CHANNEL &无需申请自动送39;Master_2&无需申请自动送39;;

START SLAVE FOR CHANNEL &无需申请自动送39;Master_2&无需申请自动送39;;

SHOW SLAVE STATUS FOR CHANNEL &无需申请自动送39;Master_2&无需申请自动送39;\G;

上一篇:Linux服务器之安装Tomcat
下一篇:Centos7 编译安装搭建LAMP平台
相关文章
图文推荐

关于我们 | 联系我们 | 服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑--致力于做实用的IT技术学习网站