设为首页 加入收藏

TOP

利用keepalived构建高可用MySQL-HA(二)
2014-11-23 19:23:27 来源: 作者: 【 】 浏览:99
Tags:利用 keepalived 构建 可用 MySQL-HA
--------------+----------+--------------+------------------+ 1 row in set (0.00 sec)

在192.168.1.202上将192.168.1.201设为自己的主服务器

MySQL> change master to master_host='192.168.1.201',master_user='replication',master_password='replication',master_log_file='MySQL-bin.000003',master_log_pos=374;

Query OK, 0 rows affected (0.05 sec)



MySQL> start slave;

Query OK, 0 rows affected (0.00 sec)



MySQL> show slave status\G

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

Slave_IO_State: Waiting for master to send event

Master_Host: 192.168.1.201

Master_User: replication

Master_Port: 3306

Connect_Retry: 60

Master_Log_File: MySQL-bin.000003

Read_Master_Log_Pos: 374

Relay_Log_File: MySQL-master2-relay-bin.000002

Relay_Log_Pos: 235

Relay_Master_Log_File: MySQL-bin.000003

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: 374

Relay_Log_Space: 235

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

1 row in set (0.00 sec)

3、将192.168.1.202设为192.168.1.201的主服务器

在192.168.1.202上新建授权用户

MySQL> grant replication slave on *.* to 'replication'@'%' identified by 'replication';

Query OK, 0 rows affected (0.00 sec)



MySQL> show master status;

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

| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |

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

| MySQL-bin.000003 | 374 | | |

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

1 row in set (0.00 sec)

在192.168.1.201上,将192.168.1.202设为自己的主服务器

MySQL> change master to master_host='192.168.1.202',master_user='replication',master_password='replication',master_log_file='MySQL-bin.000003',master_log_pos=374;

Query OK, 0 rows affected (0.05 sec)



MySQL> start slave;

Query OK, 0 rows affected (0.00 sec)



MySQL> show slave status\G

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

Slave_IO_State: Waiting for master to send event

Master_Host: 192.168.1.202

Master_User: replication

Master_Port: 3306

Connect_Retry: 60

Master_Log_File: MySQL-bin.000003

Read_Master_Log_Pos: 374

Relay_Log_File: MySQL-master1-relay-bin.000002

Relay_Log_Pos: 235

Relay_Master_Log_File: MySQL-bin.000003

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: 374

Relay_Log_Space: 235

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
首页 上一页 1 2 3 4 下一页 尾页 2/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇mysql语句汇总 下一篇mysql、sqlserver、oracle三种数..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: