你好,游客 登录 注册 搜索
背景:
阅读新闻

CentOS 5.8下MySQL 5.5复制配置详细步骤

[日期:2012-05-21] 来源:Linux社区  作者:codingstandards [字体:大 中 小]

操作步骤九:确认并验证配置

使用 show slave status\G 查看从服务器状态。

使用 SHOW VARIABLES LIKE 'auto_inc%'; 查看自动递增设置。

在一台上创建测试表、插入和更新数据,到另外一台上是否被复制。 

mysql> show slave status\G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: xxx.170
                  Master_User: rep
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000001
          Read_Master_Log_Pos: 107
               Relay_Log_File: s156-relay-bin.000002
                Relay_Log_Pos: 253
        Relay_Master_Log_File: mysql-bin.000001
             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: 107
              Relay_Log_Space: 408
              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: 170
1 row in set (0.00 sec)

mysql> SHOW VARIABLES LIKE 'auto_inc%';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| auto_increment_increment | 2     |
| auto_increment_offset    | 1     |
+--------------------------+-------+
2 rows in set (0.00 sec)

 

mysql> use test
Database changed
mysql> create table test1 (id integer not null primary key);    
Query OK, 0 rows affected (0.00 sec) 

在另外一台看看是否复制过来了

mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| test1          |
+----------------+
1 rows in set (0.00 sec)

更多的确认测试可自行进行,比如:insert/update/delete等操作。

操作步骤十:恢复应用运行

与操作步骤一对应,要把应用程序和定时任务恢复过来。

比如:

1. tomcat等应用服务器。

2. crontab中的与数据库有关的定时任务。

3. 其他与数据库有关的程序。

配置结束,大功告成!

linux
相关资讯       CentOS安装教程 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款