Quantcast
Channel: IT社区推荐资讯 - ITIndex.net
Viewing all articles
Browse latest Browse all 15843

mysql主从复制

$
0
0


从库的配置,mysql5.5不支持配置文件的配置了,问了数据库的人,用命令行指定

如下

参考
http://hi.baidu.com/hero0524/item/5280630bbf0ad7eb3599028f


修改从库的配置
#default-storage-engine = InnoDB
#修改
default-storage-engine = blackhole

server-id = 11215004
#新增
replicate-do-db = test

log-bin = mysql-bin
#新增
binlog_format = row

★★★★★★★★★★★★★★★★★
在主库
show master status
+------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000001 | 2615 | | | 
+------------------+----------+--------------+------------------+

记录master_log_file和master_log_pos
在从库 ,
5004:
change master to
master_host='10.73.11.21',master_user='databus',master_password='databus', master_port=5000, master_log_file='mysql-bin.000001',master_log_pos=2615;

5005:
change master to master_host='10.73.11.21',master_user='databus',master_password='databus', master_port=5001, master_log_file='mysql-bin.000003',master_log_pos=389;
5006:
change master to master_host='10.73.11.21',master_user='databus',master_password='databus', master_port=5002, master_log_file='mysql-bin.000003',master_log_pos=389;
5007:
change master to master_host='10.73.11.21',master_user='databus',master_password='databus', master_port=5003, master_log_file='mysql-bin.000003',master_log_pos=389;

start slave;

show slave status\G;

注意一定要是
Slave_IO_Running: Yes
Slave_SQL_Running: Yes

查看Relay_Log_File: relay-bin.000002
在slave目录 tailf relay-bin.000002

在主库
CREATE TABLE test(i INT, c CHAR(10));
INSERT INTO test VALUES(1,'record one1111'),(2,'record 11111');

观察从库的log

★★★★★★★★★★


已有 0人发表留言,猛击->> 这里<<-参与讨论


ITeye推荐




Viewing all articles
Browse latest Browse all 15843

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>