ITPub博客

首页 > 数据库 > MySQL > Mysql5.6.22双向复制+KeepAlived:配置mysql的高可用

Mysql5.6.22双向复制+KeepAlived:配置mysql的高可用

原创 MySQL 作者:呱呱牛 时间:2016-05-24 16:46:56 0 删除 编辑

1. 基础安装环境  ,采用mysql5.6.22和keepalived-1.2.15版本安装mysql高可用

点击(此处)折叠或打开

  1. [root@xxt01 ~]# uname -a
  2. Linux xxt01 2.6.32-431.el6.x86_64 #1 SMP Sun Nov 10 22:19:54 EST 2013 x86_64 x86_64 x86_64 GNU/Linux
  3. [root@xxt01 ~]# ll
  4. -rw-r--r--. 1 root root 345471 May 24 15:14 keepalived-1.2.15.tar.gz
  5. -rw-r--r--. 1 root root 33115516 May 24 10:32 mysql-5.6.22.tar.gz
两台服务器 分别是 10.6.0.203 master 、10.6.0.204 slave   vip 10.6.0.205
mysql
下载地址
http://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.22.tar.gz
keepalive下载地址
http://www.keepalived.org/software/keepalived-1.2.15.tar.gz

2.mysql的安装

2.1 卸载原有系统自带mysql包  

点击(此处)折叠或打开

  1. [root@xxt01 ~]#yum -y remove mysql-libs-5.1*
2.2 安装mysql账号 
点击(此处)折叠或打开
  1. [root@xxt01 ~]# groupadd mysql
  2. [root@xxt01 ~]#useradd -g mysql -s /sbin/nologin -d /opt/mysql mysql
2.3  检查 mysql账号

点击(此处)折叠或打开

  1. [root@xxt01 ~]#id mysql
  2. uid=500(mysql) gid=500(mysql) groups=500(mysql)

2.4 创建mysql安装目录
点击(此处)折叠或打开
  1. [root@xxt01 ~]#mkdir -p /usr/local/mysql
  2. [root@xxt01 ~]#mkdir -p /usr/local/mysql/data
 2.4.1 执行cmake:       

点击(此处)折叠或打开

  1. [root@xxt01 ~]#cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data  -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci  

点击(此处)折叠或打开

  1. #解释说明各个参数
  2. cmake \
  3. -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ #安装路径
  4. -DMYSQL_DATADIR=/usr/local/mysql/data \ #数据文件存放位置
  5. -DSYSCONFDIR=/etc \ #my.cnf路径
  6. -DWITH_MYISAM_STORAGE_ENGINE=1 \ #支持MyIASM引擎
  7. -DWITH_INNOBASE_STORAGE_ENGINE=1 \ #支持InnoDB引擎
  8. -DWITH_MEMORY_STORAGE_ENGINE=1 \ #支持Memory引擎
  9. -DWITH_READLINE=1 \ #快捷键功能(我没用过)
  10. -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock \ #连接数据库socket路径
  11. -DMYSQL_TCP_PORT=3306 \ #端口
  12. -DENABLED_LOCAL_INFILE=1 \ #允许从本地导入数据
  13. -DWITH_PARTITION_STORAGE_ENGINE=1 \ #安装支持数据库分区
  14. -DEXTRA_CHARSETS=all \ #安装所有的字符集
  15. -DDEFAULT_CHARSET=utf8 \ #默认字符
  16. -DDEFAULT_COLLATION=utf8_general_ci
2.4.2   执行make

点击(此处)折叠或打开

  1. [root@xxt01 ~]#make && make install
2.4.3 配置my.cnf文件  可以使用默认的配置文件 $basedir/my.cnf

点击(此处)折叠或打开

  1. [root@xxt01 support-files]# cp my-default.cnf /etc/my.cnf
 2.4.4  配置mysqld启动脚本

点击(此处)折叠或打开

  1. [root@xxt01 support-files]# cp mysql.server /etc/init.d/mysqld
2.4.5 初始化mysql DB

点击(此处)折叠或打开

  1. [root@xxt02 mysql]# scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/
 2.4.6 添加到开机启动

点击(此处)折叠或打开

  1. [root@xxt02 mysql]# chkconfig --add mysqld
  2. [root@xxt02 mysql]# chkconfig --list mysqld
  3. mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
  4. [root@xxt02 mysql]# service mysqld restart
  5. Shutting down MySQL. SUCCESS!
  6. Starting MySQL. SUCCESS!
  7. [root@xxt02 mysql]# netstat -anput|grep mysqld
  8. tcp 0 0 :::3306 :::* LISTEN 12270/mysqld
  9. [root@xxt02 mysql]#
2.4.7 提高安全性修改秘密

点击(此处)折叠或打开

  1. [root@xxt02 bin]# ./mysqladmin -uroot password 'mysql'
  2. Warning: Using a password on the command line interface can be insecure.
  3. [root@xxt02 bin]# mysql -uroot -pmysql
  4. Warning: Using a password on the command line interface can be insecure.
  5. Welcome to the MySQL monitor. Commands end with ; or \g.
  6. Your MySQL connection id is 2
  7. Server version: 5.6.22-log Source distribution
  8. Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.

    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

    mysql> 


3.  配置双向复制

3.1 修改 $basedir/my.cnf

点击(此处)折叠或打开

  1. 在203上添加
  2. server_id = 1
  3. log_bin = mysql-binlog
  4. 在204上添加
  5. server_id = 2
  6. log_bin = mysql-binlog
3.2 搭建单向主从服务配置
    首先在master 203 上操作

点击(此处)折叠或打开

  1. mysql> grant replication slave on *.* to 'slave'@'10.6.0.204' identified by '123456';
  2. Query OK, 0 rows affected (0.00 sec)

  3. mysql> flush privileges;
  4. Query OK, 0 rows affected (0.00 sec)

  5. mysql>
    然后在slave 204上操作

点击(此处)折叠或打开

  1. mysql> change master to master_host='10.6.0.203',master_user='slave',master_password='123456',master_log_file=' mysql-binlog.000002',master_log_pos=407,master_port=3306;
  2. ERROR 1198 (HY000): This operation cannot be performed with a running slave; run STOP SLAVE first
  3. mysql> stop slave
  4. -> ;
  5. Query OK, 0 rows affected (0.00 sec)
  6. mysql> change master to master_host='10.6.0.203',master_user='slave',master_password='123456',master_log_file=' mysql-binlog.000002',master_log_pos=407,master_port=3306;
  7. Query OK, 0 rows affected, 2 warnings (0.01 sec)
  8. /*
  9. master_log_file=' mysql-binlog.000002' 修改为master_log_file='mysql-binlog.000002' 多出一个空格
  10. 导致 Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file'
        
        下面这两个参数同时为YES时 ,表示成功
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
  1. */

  2. mysql> stop slave;
  3. Query OK, 0 rows affected (0.00 sec)
  4. mysql> change master to master_host='10.6.0.203',master_user='slave',master_password='123456',master_log_file='mysql-binlog.000002',master_log_pos=407,master_port=3306;
  5. Query OK, 0 rows affected, 2 warnings (0.01 sec)
  6. mysql> start slave;
  7. Query OK, 0 rows affected (0.01 sec)
mysql> show slave status \G;
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 10.6.0.203
                  Master_User: slave
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-binlog.000002
          Read_Master_Log_Pos: 407
               Relay_Log_File: xxt02-relay-bin.000002
                Relay_Log_Pos: 286
        Relay_Master_Log_File: mysql-binlog.000002
             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: 407
              Relay_Log_Space: 459
              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
                  Master_UUID: a2e9d608-216d-11e6-acd6-000c29d8f5d9
             Master_Info_File: /usr/local/mysql/data/master.info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
           Master_Retry_Count: 86400
                  Master_Bind: 
      Last_IO_Error_Timestamp: 
     Last_SQL_Error_Timestamp: 
               Master_SSL_Crl: 
           Master_SSL_Crlpath: 
           Retrieved_Gtid_Set: 
            Executed_Gtid_Set: 
                Auto_Position: 0
1 row in set (0.00 sec)


ERROR: 
No query specified


3.3  配置mysql双向复制:在master 203上授权;因为有3.2的基础,在master执行实际是在slave对master执行授权命令。 

     在master 203 上面操作

点击(此处)折叠或打开

  1. mysql> grant replication slave on *.* to 'slave'@'10.6.0.203' identified by '123456';
  2. Query OK, 0 rows affected (0.00 sec)
  3. mysql> flush privileges;
  4. Query OK, 0 rows affected (0.00 sec)
  5. mysql>
    在slave 204 上面操作
点击(此处)折叠或打开
  1. mysql> show master status;
  2. +---------------------+----------+--------------+------------------+-------------------+
  3. | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
  4. +---------------------+----------+--------------+------------------+-------------------+
  5. | mysql-binlog.000002 | 624556 | | | |
  6. +---------------------+----------+--------------+------------------+-------------------+
  7. 1 row in set (0.00 sec)

  8. mysql>
    master 同步操作,参数Slave_IO_Running和Slave_SQL_Running为YES时表示成功,同时无其他错误

点击(此处)折叠或打开

  1. mysql> grant replication slave on *.* to 'slave'@'10.6.0.203' identified by '123456';
  2. Query OK, 0 rows affected (0.00 sec)
  3. mysql> flush privileges;
  4. Query OK, 0 rows affected (0.00 sec)
  5. mysql> change master to master_host='10.6.0.204',master_user='slave',master_password='123456',master_log_file='mysql-binlog.000002',master_log_pos=624556;
  6. Query OK, 0 rows affected, 2 warnings (0.01 sec)
  7. mysql> start slave;
  8. Query OK, 0 rows affected (0.01 sec)
  9. mysql> show slave status\G;
    *************************** 1. row ***************************
                   Slave_IO_State: Waiting for master to send event
                      Master_Host: 10.6.0.204
                      Master_User: slave
                      Master_Port: 3306
                    Connect_Retry: 60
                  Master_Log_File: mysql-binlog.000002
              Read_Master_Log_Pos: 624556
                   Relay_Log_File: xxt01-relay-bin.000002
                    Relay_Log_Pos: 286
            Relay_Master_Log_File: mysql-binlog.000002
                 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: 624556
                  Relay_Log_Space: 459
                  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: 2
                      Master_UUID: aa208c56-216f-11e6-ace3-000c29065661
                 Master_Info_File: /usr/local/mysql/data/master.info
                        SQL_Delay: 0
              SQL_Remaining_Delay: NULL
          Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
               Master_Retry_Count: 86400
                      Master_Bind: 
          Last_IO_Error_Timestamp: 
         Last_SQL_Error_Timestamp: 
                   Master_SSL_Crl: 
               Master_SSL_Crlpath: 
               Retrieved_Gtid_Set: 
                Executed_Gtid_Set: 
                    Auto_Position: 0
    1 row in set (0.00 sec)

4.配置keepalived ,实现主从自动切换 

    原理:keepalived用来解决单点故障,提供vrrp(虚拟路由冗余协议)以及healthcheck功能,提供一个vip虚拟ip;

    keepalived的作用是检测服务器的状态,当其中一台服务器出现问题,则将它从组中剔除,恢复后再将它加进来

    服务安装,同时保持master和slave服务配置相同。

点击(此处)折叠或打开

  1. [root@xxt01 ~]# tar zxf keepalived-1.2.15.tar.gz
  2. [root@xxt01 keepalived-1.2.15]# ./configure --prefix=/usr/local/keepalived
  3. [root@xxt01 keepalived-1.2.15]# make && make install
  4. [root@xxt01 etc]# cp -a /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d/
  5. [root@xxt01 etc]# cp -a /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/
  6. [root@xxt01 etc]# mkdir /etc/keepalived/
  7. [root@xxt01 etc]# cp -a /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/
  8. [root@xxt01 etc]# cp -a /usr/local/keepalived/sbin/keepalived /usr/sbin/
4.1 修改203的 /etc/keepalived/keepalived.conf 文件

点击(此处)折叠或打开

  1. ! Configuration File for keepalived
  2. global_defs {
  3. notification_email {
  4. acassen@firewall.loc
  5. failover@firewall.loc
  6. sysadmin@firewall.loc
  7. }
  8. notification_email_from Alexandre.Cassen@firewall.loc
  9. smtp_server 192.168.200.1
  10. smtp_connect_timeout 30
  11. router_id LVS_DEVEL
  12. }
  13. vrrp_instance VI_1 {
  14. state MASTER
  15. interface eth0
  16. virtual_router_id 51
  17. priority 100
  18. advert_int 1
  19. authentication {
  20. auth_type PASS
  21. auth_pass 1111
  22. }
  23. virtual_ipaddress {
  24. 10.6.0.205
  25. }
  26. }
  27. # set mysqld
  28. virtual_server 10.6.0.205 3306 {
  29. delay_loop 6
  30. lb_algo wrr
  31. lb_kind DR
  32. persistence_timeout 50
  33. protocol TCP
  34. real_server 10.6.0.203 3306 {
  35. weight 3
  36. notify_down /etc/keepalived/killkeepalived.sh
  37. TCP_CHECK {
  38. connect_timeout 10
  39. nb_get_retry 3
  40. delay_before_retry 3
  41. connect_port 3306
  42. }
  43. }
  44. }
4.2配置 killkeepalived.sh

点击(此处)折叠或打开

  1. [root@xxt01 etc]# vi /etc/keepalived/killkeepalived.sh
  2. #!/bin/sh
  3. pkill keepalived
4.3 分别检查mater和slave的 /var/log/message日志,分别做启停mysqld服务测试,信息如下表示服务正常。

点击(此处)折叠或打开

  1. 203 master 服务器
  2. May 24 15:47:38 xxt01 Keepalived_vrrp[14242]: Configuration is using : 63545 Bytes
  3. May 24 15:47:38 xxt01 Keepalived_vrrp[14242]: Using LinkWatch kernel netlink reflector...
  4. May 24 15:47:38 xxt01 Keepalived_vrrp[14242]: VRRP sockpool: [ifindex(2), proto(112), unicast(0), fd(10,11)]
  5. May 24 15:47:38 xxt01 Keepalived_healthcheckers[14241]: Using LinkWatch kernel netlink reflector...
  6. May 24 15:47:38 xxt01 Keepalived_healthcheckers[14241]: Activating healthchecker for service [10.6.0.203]:3306
  7. May 24 15:47:39 xxt01 Keepalived_vrrp[14242]: VRRP_Instance(VI_1) Transition to MASTER STATE
  8. May 24 15:47:40 xxt01 Keepalived_vrrp[14242]: VRRP_Instance(VI_1) Entering MASTER STATE
  9. May 24 15:47:40 xxt01 Keepalived_vrrp[14242]: VRRP_Instance(VI_1) setting protocol VIPs.
  10. May 24 15:47:40 xxt01 Keepalived_healthcheckers[14241]: Netlink reflector reports IP 10.6.0.205 added
  11. May 24 15:47:40 xxt01 Keepalived_vrrp[14242]: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth0 for 10.6.0.205
  12. May 24 15:47:45 xxt01 Keepalived_vrrp[14242]: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth0 for 10.6.0.205
  13. May 24 15:56:27 xxt01 Keepalived_vrrp[14242]: VRRP_Instance(VI_1) Received higher prio advert
  14. May 24 15:56:27 xxt01 Keepalived_vrrp[14242]: VRRP_Instance(VI_1) Entering BACKUP STATE
  15. May 24 15:56:27 xxt01 Keepalived_vrrp[14242]: VRRP_Instance(VI_1) removing protocol VIPs.
  16. May 24 15:56:27 xxt01 Keepalived_healthcheckers[14241]: Netlink reflector reports IP 10.6.0.205 removed
  17. May 24 16:01:28 xxt01 Keepalived_vrrp[14242]: VRRP_Instance(VI_1) Transition to MASTER STATE
  18. May 24 16:01:29 xxt01 Keepalived_vrrp[14242]: VRRP_Instance(VI_1) Entering MASTER STATE
  19. May 24 16:01:29 xxt01 Keepalived_vrrp[14242]: VRRP_Instance(VI_1) setting protocol VIPs.
  20. May 24 16:01:29 xxt01 Keepalived_vrrp[14242]: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth0 for 10.6.0.205
  21. May 24 16:01:29 xxt01 Keepalived_healthcheckers[14241]: Netlink reflector reports IP 10.6.0.205 added
  22. May 24 16:01:34 xxt01 Keepalived_vrrp[14242]: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth0 for 10.6.0.205
  23. May 24 16:08:36 xxt01 Keepalived_vrrp[14242]: VRRP_Instance(VI_1) Received higher prio advert
  24. May 24 16:08:36 xxt01 Keepalived_vrrp[14242]: VRRP_Instance(VI_1) Entering BACKUP STATE
  25. May 24 16:08:36 xxt01 Keepalived_vrrp[14242]: VRRP_Instance(VI_1) removing protocol VIPs.
  26. May 24 16:08:36 xxt01 Keepalived_healthcheckers[14241]: Netlink reflector reports IP 10.6.0.205 removed
  27. 204 slave 服务器
  28. May 24 16:08:36 xxt02 Keepalived[15014]: Starting Keepalived v1.2.15 (05/24,2016)
  29. May 24 16:08:36 xxt02 Keepalived[15015]: Starting Healthcheck child process, pid=15016
  30. May 24 16:08:36 xxt02 Keepalived[15015]: Starting VRRP child process, pid=15017
  31. May 24 16:08:36 xxt02 Keepalived_healthcheckers[15016]: Netlink reflector reports IP 10.6.0.204 added
  32. May 24 16:08:36 xxt02 Keepalived_healthcheckers[15016]: Netlink reflector reports IP fe80::20c:29ff:fe06:5661 added
  33. May 24 16:08:36 xxt02 Keepalived_healthcheckers[15016]: Registering Kernel netlink reflector
  34. May 24 16:08:36 xxt02 Keepalived_healthcheckers[15016]: Registering Kernel netlink command channel
  35. May 24 16:08:36 xxt02 Keepalived_vrrp[15017]: Netlink reflector reports IP 10.6.0.204 added
  36. May 24 16:08:36 xxt02 Keepalived_vrrp[15017]: Netlink reflector reports IP fe80::20c:29ff:fe06:5661 added
  37. May 24 16:08:36 xxt02 Keepalived_vrrp[15017]: Registering Kernel netlink reflector
  38. May 24 16:08:36 xxt02 Keepalived_healthcheckers[15016]: Opening file '/etc/keepalived/keepalived.conf'.
  39. May 24 16:08:36 xxt02 Keepalived_vrrp[15017]: Registering Kernel netlink command channel
  40. May 24 16:08:36 xxt02 Keepalived_healthcheckers[15016]: Configuration is using : 11978 Bytes
  41. May 24 16:08:36 xxt02 Keepalived_vrrp[15017]: Registering gratuitous ARP shared channel
  42. May 24 16:08:36 xxt02 Keepalived_vrrp[15017]: Opening file '/etc/keepalived/keepalived.conf'.
  43. May 24 16:08:36 xxt02 Keepalived_vrrp[15017]: Configuration is using : 63545 Bytes
  44. May 24 16:08:36 xxt02 Keepalived_vrrp[15017]: Using LinkWatch kernel netlink reflector...
  45. May 24 16:08:36 xxt02 Keepalived_healthcheckers[15016]: Using LinkWatch kernel netlink reflector...
  46. May 24 16:08:36 xxt02 Keepalived_healthcheckers[15016]: Activating healthchecker for service [10.6.0.204]:3306
  47. May 24 16:08:36 xxt02 Keepalived_vrrp[15017]: VRRP sockpool: [ifindex(2), proto(112), unicast(0), fd(10,11)]
  48. May 24 16:08:36 xxt02 Keepalived_vrrp[15017]: VRRP_Instance(VI_1) Transition to MASTER STATE
  49. May 24 16:08:36 xxt02 Keepalived_vrrp[15017]: VRRP_Instance(VI_1) Received lower prio advert, forcing new election
  50. May 24 16:08:37 xxt02 Keepalived_vrrp[15017]: VRRP_Instance(VI_1) Entering MASTER STATE
  51. May 24 16:08:37 xxt02 Keepalived_vrrp[15017]: VRRP_Instance(VI_1) setting protocol VIPs.
  52. May 24 16:08:37 xxt02 Keepalived_healthcheckers[15016]: Netlink reflector reports IP 10.6.0.205 added
  53. May 24 16:08:37 xxt02 Keepalived_vrrp[15017]: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth0 for 10.6.0.205
  54. May 24 16:08:42 xxt02 Keepalived_vrrp[15017]: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth0 for 10.6.0.205
  55. May 24 16:10:14 xxt02 yum[15023]: Installed: 2:nmap-5.51-3.el6.x86_64
4.4 检查服务

点击(此处)折叠或打开

  1. [root@xxt01 mysql]# nmap 10.6.0.205
  2. Starting Nmap 5.51 ( http://nmap.org ) at 2016-05-24 16:14 CST
  3. mass_dns: warning: Unable to determine any DNS servers. Reverse DNS is disabled. Try using --system-dns or specify valid servers with --dns-servers
  4. Nmap scan report for 10.6.0.205
  5. Host is up (0.00029s latency).
  6. Not shown: 998 closed ports
  7. PORT STATE SERVICE
  8. 111/tcp open rpcbind
  9. 3306/tcp open mysql
  10. MAC Address: 00:0C:29:06:56:61 (VMware)
  11. Nmap done: 1 IP address (1 host up) scanned in 1.21 seconds
  12. [root@xxt01 mysql]# nmap 10.6.0.203
  13. Starting Nmap 5.51 ( http://nmap.org ) at 2016-05-24 16:15 CST
  14. mass_dns: warning: Unable to determine any DNS servers. Reverse DNS is disabled. Try using --system-dns or specify valid servers with --dns-servers
  15. Nmap scan report for 10.6.0.203
  16. Host is up (0.0000050s latency).
  17. Not shown: 998 closed ports
  18. PORT STATE SERVICE
  19. 111/tcp open rpcbind
  20. 3306/tcp open mysql
  21. Nmap done: 1 IP address (1 host up) scanned in 0.08 seconds
  22. [root@xxt01 mysql]#
  23. [root@xxt01 mysql]# nmap 10.6.0.205
  24. Starting Nmap 5.51 ( http://nmap.org ) at 2016-05-24 16:14 CST
  25. mass_dns: warning: Unable to determine any DNS servers. Reverse DNS is disabled. Try using --system-dns or specify valid servers with --dns-servers
  26. Nmap scan report for 10.6.0.205
  27. Host is up (0.00029s latency).
  28. Not shown: 998 closed ports
  29. PORT STATE SERVICE
  30. 111/tcp open rpcbind
  31. 3306/tcp open mysql
  32. MAC Address: 00:0C:29:06:56:61 (VMware)
  33. Nmap done: 1 IP address (1 host up) scanned in 1.21 seconds
  34. [root@xxt01 mysql]# nmap 10.6.0.203
  35. Starting Nmap 5.51 ( http://nmap.org ) at 2016-05-24 16:15 CST
  36. mass_dns: warning: Unable to determine any DNS servers. Reverse DNS is disabled. Try using --system-dns or specify valid servers with --dns-servers
  37. Nmap scan report for 10.6.0.203
  38. Host is up (0.0000050s latency).
  39. Not shown: 998 closed ports
  40. PORT STATE SERVICE
  41. 111/tcp open rpcbind
  42. 3306/tcp open mysql
  43. Nmap done: 1 IP address (1 host up) scanned in 0.08 seconds
  44. [root@xxt01 mysql]#
参考的博客:http://732233048.blog.51cto.com/9323668/1643376


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/27039319/viewspace-2106110/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: Linux SSH公钥登录
请登录后发表评论 登录
全部评论

注册时间:2014-05-29

  • 博文量
    96
  • 访问量
    286799