mysql实现主从的模式_mysql 设置主从模式教程

mysql> change master to master_host='172.16.22.1',master_user='test',master_password='test',master_log_file='mysql-bin.000030',master_log_pos=337;

mysql> change master to master_host='192.168.40.176',master_port=3306,master_user='repl',master_password='123456',master_auto_position=1,master_delay=20;   --master_delay此参数表示relay日志会同步到slave机,但是会根据事件时间戳延时20秒

// master_host 主库IP

//master_user 上面创建的复制用户名

//master_passowrd 用户密码

// master_log_file 从那个二进制文件开始复制

//master_log_pos 从二进制文件的哪个位置开始复制

mysql> start slave;

mysql> show slave status\G;

*************************** 1. row ***************************

Slave_IO_State: Waiting for master to send event

Master_Host: 172.16.22.1

Master_User: test

Master_Port: 3306

Connect_Retry: 60

Master_Log_File: mysql-bin.000031

Read_Master_Log_Pos: 185029

Relay_Log_File: mysql-relay-bin.000004

Relay_Log_Pos: 185175

Relay_Master_Log_File: mysql-bin.000031

Slave_IO_Running: Yes

Slave_SQL_Running: Yes

Replicate_Do_DB:

Replicate_Ignore_DB:

Replicate_Do_Table:

Replicate_Ignore_Table:

Replicate_Wild_Do_Table:

Replicate_Wild_Ignore_Table:

Last_Errno: 0

Last_Error:

Skip_Counter: 0

Exec_Master_Log_Pos: 185029

Relay_Log_Space: 185477

Until_Condition: None

Until_Log_File:

Until_Log_Pos: 0

Master_SSL_Allowed: No

Master_SSL_CA_File:

Master_SSL_CA_Path:

Master_SSL_Cert:

Master_SSL_Cipher:

Master_SSL_Key:

Seconds_Behind_Master: 0

Master_SSL_Verify_Server_Cert: No

Last_IO_Errno: 0

Last_IO_Error:

Last_SQL_Errno: 0

Last_SQL_Error:

Replicate_Ignore_Server_Ids:

Master_Server_Id: 1

1 row in set (0.00 sec)

ERROR:

No query specified

Slave_IO_Running、Slave_SQL_Running都为Yes即成功了。

任何一个显示为No,检查网络、用户、用户名、二进制文件

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值