MySQL Failover Circular Replication
===================================
Assume we have 2 servers: Server1 and Server2.
Server1 Settings
================
1. Put the option file my.cnf to Server1 path /etc with these settings:
[mysqld]
log-bin=mysql-bin
server-id = 1
auto_increment_increment = 10
auto_increment_offset = 1
2. Change mode/permission for my.cnf to _rw_r__r__ else mysql will igonore it.
sudo chmod 644 my.cnf
3. Stop and start mysql.
cd /Library/StartupItems/MySQLCOM
sudo ./MySQLCOM stop
sudo ./MySQLCOM start
4. Configure the server:
# create a user for replication process:
cd /usr/local/mysql/bin
./mysql -p -u root
create user replicant@'%' identified by 'password';
# Grant access rights:
GRANT SELECT, PROCESS, FILE, SUPER, REPLICATION CLIENT, REPLICATION SLAVE, RELOAD ON *.* TO replicant@'%';
Flush Privileges;
# Specify the info for the serve2:
CHANGE MASTER TO
MASTER_HOST='ip_of_server2',
MASTER_USER='replication_user_name_on_server2',
MASTER_PASSWORD='replication_password_on_server2';
# Start the listerner:
Start slave;
# Verify whether the replication is working:
show slave status\G
Server2 Settings
================
1. Put the option file my.cnf on to Server2 path /etc
with these settings:
[mysqld]
log-bin=mysql-bin
server-id = 2
auto_increment_increment = 10
auto_increment_offset = 2
2. Change mode/permission for my.cnf to _rw_r__r__ else mysql will igonore it.
sudo chmod 644 my.cnf
3. Stop and start mysql.
cd /Library/StartupItems/MySQLCOM
sudo ./MySQLCOM stop
sudo ./MySQLCOM start
4. Configure the server:
# create a user for replication process:
cd /usr/local/mysql/bin
./mysql -p -u root
create user replicant@'%' identified by 'password';
# Grant access rights:
GRANT SELECT, PROCESS, FILE, SUPER, REPLICATION CLIENT, REPLICATION SLAVE, RELOAD ON *.* TO replicant@'%';
Flush Privileges;
# Specify the info for the serve1:
CHANGE MASTER TO
MASTER_HOST='ip_of_server1',
MASTER_USER='replication_user_name_on_server1',
MASTER_PASSWORD='replication_password_on_server1';
# Example:
#
# CHANGE MASTER TO MASTER_HOST='125.564.12.1',
# MASTER_USER='replicant', MASTER_PASSWORD='password';
# Load data from Server1:
Load Data from Master;
# Start the listerner:
Start slave;
分享到:
相关推荐
mysql replication搭建
MySql Replication Tutorial,关于MySql Replication 的 PPT
MySQL Replication一主多从环境搭建
针对这一情况,提出在现有硬件的基础上利用JDBC规范与MySQL Replication实现数据库集群从而解决数据访问瓶颈。其主要方法是在进行JDBC连接之前实现负载均衡,所有SQL请求由负载均衡器进行统一调度。在数据库端利用...
第18章 MySQL Replication(共27页).pptMySQL从入门到精通 第19章 MySQL Cluster(共49页).pptMySQL从入门到精通 第20章 PHP操作MySQL数据库(共7页).pptMySQL从入门到精通 第21章 MySQL实战-新闻发布系统数据库...
Mysql Replication HA 配置
mysql-replication mysql数据库主从复制步骤
胖子摸索出来的,Ubuntu上MySQL的Replication配置,的简单记录步骤
mysql replication修改库名及复制单个表
NULL 博文链接:https://risheng.iteye.com/blog/1853366
详细描述mysql-replication配置,mysql主从库切换,验证等
MySQL Replication PPT资源
MySQL Replication Tips and Tricks 关于mysql复制的使用技巧,在新版中的新特性,推荐!!
MySQL Group Replication 详细搭建部署过程
深入理解MySQL Group Replication.pdf
MySQLReplication主从复制全方位解决方案.docx
MySQL Replication(复制)已经在一些著名的网站和企业广泛应用以将数据库的扩展性提升到极限水平。对用户而言可以简单快速地为数据库创建多个副本,超越单个数据库实例容量的限制,弹性扩展数据库系统以满足快速增长...
mysql replication binlog php 同步工具 运行环境 目前只支持数据库utf8编码 php版本>=5.4 mysql版本>=5.1 需要安装php sockets扩展 运行用户需要有创建文件的权限
藏经阁-MySQL Replication Latest Developments.pdf
通过Heartbert2 让Mysql Replication 具有HA【pdf教程】