mysql master slave 主从安装
来源:互联网 发布:mac ai2017cc 破解 编辑:程序博客网 时间:2024/05/22 07:58
mysql 版本: http://www.mysql.com/get/Downloads/MySQL-5.5/MySQL-server-5.5.29-1.rhel5.x86_64.rpm.
master: vi/etc/my.cnf
add content:
log-bin = master-bin
log-bin-index = master-bin.index
在 master 上创建 复制用户:
run shell: create user repl_user;
run shell: grant replication slave on *.* to repl_user identified by 'Zjw11763';
slave: vi/etc/my.cnf
add content:
server-id = 2
relay-log = slave-relay-bin
relay-log-index = slave-relay-bin.index
##// server-id should be different;
这个时候 master slave 数据库都是一致的,先查看 master 上当前 日志情况
在 master 上 执行 shell:show master status\G;
返回值:
*************************** 1. row ***************************
File: master-bin.000004
Position: 1369
Binlog_Do_DB:
Binlog_Ignore_DB:
1 row in set (0.00 sec)
ERROR:
No query specified
从 master 上最新位置开始同步数据
change master to
master_host='vm-1bd6-3d6d.nam.nsroot.net',
master_port=3309,
master_user='repl_user',
master_password='Zjw11763',
master_log_file='master-bin.000004',
master_log_pos=1369;
然后启动 slave,
start slave;
关于 指向 日志位置问题 也可以用方法二(master slave 数据一致的情况下):
stop slave;
reset slave;
reset master;
start slave;
#stop slave;
#set GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
#start slave;
数据库导出:
mysqldump -A -h 'vm-1bd6-3d6d.nam.nsroot.net' -P 3309 -p --master-data=1> /home/jz54495/BACKUP.sql
##// 加上 master-data=1 在dump 文件中有自动将位置 指向 master 最新位置的 语句 不需要自己重新 change master to ..............
恢复:
mysql --host='vm-a2eb-5b5d.nam.nsroot.net' -u root -p -P 3309 </home/jz54495/BACKUP.sql
如果hive使用此主从 复制模式选择 混合模式
- mysql master slave 主从安装
- mysql 主从复制(master-slave)
- MYSQL:master/slave主从复制
- mysql 主从配置(master/slave)
- mysql主从复制(Master-Slave)
- MySQL数据库主从(Master/Slave)同步安装与配置
- MySQL主从(Master-Slave)复制
- linux配置mysql主从--master and slave
- mysql主从复制(master/slave)
- MySQL Master/Slave 主从数据同步
- MySQL Master-Slave 主从复制环境搭建
- Mysql主从备份实现master-slave
- MySQL主从复制(Master-Slave)
- Mysql主从复制(master-slave)实际操作案例
- mysql主从复制(master-slave)实录
- MySQL的主从使用 Master/Slave
- MySQL主从复制(Master-Slave)【详讲】
- MySQL主从复制(Master-Slave)实践
- UNIX UDP回射服务器/客户端
- 【iOS-cocos2d-X 游戏开发之一】在Mac下结合Xcode搭建Cocos2d-X开发环境!
- 体验js中splice()的强大
- VC控制台颜色设置
- 泛型的单例模式
- mysql master slave 主从安装
- 怎样用hibernate的hql查询查询成map或list
- springAOP
- pthread_cond
- c#对xml操作小结
- 新型的按键扫描程序(备用)
- 使用DBCC CHECKPRIMARYFILE 查询Detach数据库信息
- iptables命令
- android 用Achartengine 作图