mysql数据库AB复制配置(2)
来源:未知 责任编辑:责任编辑 发表时间:2014-01-26 22:01 点击:次
+------------+----------+--------------+------------------+
1 row in set (0.00 sec)
file字段是master的binlog文件名,position是binlog的节点。
二、配置BACKUP
1、编辑配置文件my.cnf,添加4行。
[mysqld]
server-id=2
master-host=172.16.1.3 #MASTER服务器的ip地址
master-user=zhaoyun #连接MASTER服务器的用户名
master-password=123456 #密码
2、重启服务
[root@BACKUP ~]# service mysqld restart
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ]
3、重启服务后会在数据库目录下生成几个文件
[root@BACKUP mysql]# ls
ib_logfile1 mysqld-relay-bin.000001 mysqld-relay-bin.index test
ibdata1 master.info mysql.sock
ib_logfile0 mysql relay-log.info
[root@BACKUP mysql]# pwd
/var/lib/mysql
mysqld-relay-bin.000001 #binload文件,从master复制而来
mysqld-relay-bin.index #binload的信息
master.info #master信息
relay-log.info #中继日志信息
4、查看slave的状态
[root@BACKUP ~]# mysql -uroot -p123456
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show slave status \G ;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 172.16.1.3
Master_User: zhaoyun
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysqld-bin.000001
Read_Master_Log_Pos: 315
Relay_Log_File: mysqld-relay-bin.000002
Relay_Log_Pos: 453
Relay_Master_Log_File: mysqld-bin.000001
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>