mysqlrplcheck

mysqlrplcheck检查建立主备关系先决条件是否满足

$ ./mysqlrplcheck --help
Usage: mysqlrplcheck --master=root@localhost:3306 --slave=root@localhost:3310 
 
mysqlrplcheck - check replication
 
Options:
  --version             show program's version number and exit
  --help                display a help message and exit
  --master=MASTER       connection information for master server in the form:
                        <user>[:<password>]@<host>[:<port>][:<socket>] or
                        <login-path>[:<port>][:<socket>].
  --slave=SLAVE         connection information for slave server in the form:
                        <user>[:<password>]@<host>[:<port>][:<socket>] or
                        <login-path>[:<port>][:<socket>]
  --master-info-file=MASTER_INFO
                        the name of the master information file on the
                        slave.default = 'master.info' read from the data
                        directory. Note: this option requires that the utility
                        run on the slave with appropriate file read access to
                        the data directory.
  -s, --show-slave-status
                        show slave status
  --width=WIDTH         display width
  --suppress            suppress warning messages
  -v, --verbose         control how much information is displayed. e.g., -v =
                        verbose, -vv = more verbose, -vvv = debug
  -q, --quiet           turn off all messages for quiet execution.

eg1:查看主备复制先决条件

$ sudo ./mysqlrplcheck --master=root@localhost:3306 --slave=root@localhost:3406 -vv
# master on localhost: ... connected.
# slave on localhost: ... connected.
Test Description                                                     Status
---------------------------------------------------------------------------
Checking for binary logging on master                                [pass]
Are there binlog exceptions?                                         [pass]
Replication user exists?                                             [pass]
Checking server_id values                                            [pass]
 
 master id = 15444555
  slave id = 15444556
 
Checking server_uuid values                                          [pass]
 
 master uuid = Not supported.
  slave uuid = Not supported.
 
Is slave connected to master?                                        [pass]
Check master information file                                        [pass]
 
#
# Master information file: 
#
               Master_Log_File : mysql-bin.002592
           Read_Master_Log_Pos : 360024544
                   Master_Host : localhost
                   Master_User : slave
               Master_Password : slave
                   Master_Port : 3306
                 Connect_Retry : 60
            Master_SSL_Allowed : 0
            Master_SSL_CA_File : 
            Master_SSL_CA_Path : 
               Master_SSL_Cert : 
             Master_SSL_Cipher : 
                Master_SSL_Key : 
 Master_SSL_Verify_Server_Cert : 0
                     Heartbeat : 1800.000
                          Bind : 
            Ignored_server_ids : 0
 
Checking InnoDB compatibility                                        [pass]
Checking storage engines compatibility                               [pass]
Checking lower_case_table_names settings                             [pass]
 
  Master lower_case_table_names: 1
   Slave lower_case_table_names: 1
 
Checking slave delay (seconds behind master)                         [pass]
# ...done.

eg2:查看主备复制先决条件,同时查看slave信息

$ sudo ./mysqlrplcheck --master=root@localhost:3306 --slave=root@localhost:3406 --show-slave-status -vv
# master on localhost: ... connected.
# slave on localhost: ... connected.
Test Description                                                     Status
---------------------------------------------------------------------------
Checking for binary logging on master                                [pass]
Are there binlog exceptions?                                         [pass]
Replication user exists?                                             [pass]
Checking server_id values                                            [pass]
 
 master id = 15444555
  slave id = 15444556
 
Checking server_uuid values                                          [pass]
 
 master uuid = Not supported.
  slave uuid = Not supported.
 
Is slave connected to master?                                        [pass]
Check master information file                                        [pass]
 
#
# Master information file: 
#
               Master_Log_File : mysql-bin.002592
           Read_Master_Log_Pos : 360024544
                   Master_Host : localhost
                   Master_User : slave
               Master_Password : slave
                   Master_Port : 3306
                 Connect_Retry : 60
            Master_SSL_Allowed : 0
            Master_SSL_CA_File : 
            Master_SSL_CA_Path : 
               Master_SSL_Cert : 
             Master_SSL_Cipher : 
                Master_SSL_Key : 
 Master_SSL_Verify_Server_Cert : 0
                     Heartbeat : 1800.000
                          Bind : 
            Ignored_server_ids : 0
 
Checking InnoDB compatibility                                        [pass]
Checking storage engines compatibility                               [pass]
Checking lower_case_table_names settings                             [pass]
 
  Master lower_case_table_names: 1
   Slave lower_case_table_names: 1
 
Checking slave delay (seconds behind master)                         [pass]
 
#
# Slave status: 
#
                Slave_IO_State : Waiting for master to send event
                   Master_Host : localhost
                   Master_User : slave
                   Master_Port : 3306
                 Connect_Retry : 60
               Master_Log_File : mysql-bin.002592
           Read_Master_Log_Pos : 360024544
                Relay_Log_File : mysqld-relay-bin.000002
                 Relay_Log_Pos : 344
         Relay_Master_Log_File : mysql-bin.002592
              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 : 360024544
               Relay_Log_Space : 501
               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 : 15444555
# ...done.

Post a Comment