今天在优化io的时候,移动了从库relay-bin的位置,并将hostname部分去掉了,启动后,从库slave状态如下:
mysql> show slave status\G;*************************** 1. row *************************** Slave_IO_State: Master_Host: 127.0.0.1 Master_User: root Master_Port: 3306 Connect_Retry: 60 Master_Log_File: mysql-bin.000226 Read_Master_Log_Pos: 175251675 Relay_Log_File: iZ23nn1p4mjZ-relay-bin.000464 Relay_Log_Pos: 175251629 Relay_Master_Log_File: mysql-bin.000226 Slave_IO_Running: No Slave_SQL_Running: No Replicate_Do_DB: db_rsk,db_sys Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: db_rsk.tb_act_unitequitiesposition,db_rsk.tb_act_productposition,db_rsk.tb_act_productunitasset,db_rsk.tb_act_productaccount,db_rsk.tb_act_unitaccount,db_rsk.tb_act_operationconfig,db_rsk.tb_rsk_assetvaluecompliance,db_rsk.tb_rsk_stockcostcompliance,db_rsk.tb_rsk_stockpoolcompliance,db_rsk.tb_rsk_stockquantitycompliance,db_rsk.tb_rsk_stockvaluecompalince,db_rsk.tb_rsk_tradelimitcompliance,db_rsk.tb_rsk_reversetradecompliance,db_rsk.tb_rsk_navcompliance,db_rsk.tb_rsk_rulescompliancecode,db_rsk.tb_rsk_usernavsection,db_rsk.tb_rsk_complianceset,db_rsk.tb_rsk_customdimensionstock,db_rsk.tb_rsk_customdimensiontype,db_rsk.tb_rsk_indexstock,db_rsk.tb_rsk_indextype,db_rsk.tb_rsk_industryclassification,db_rsk.tb_rsk_industrystock,db_rsk.tb_rsk_industrytype,db_rsk.tb_rsk_userdimensionstock,db_rsk.tb_rsk_userdimensiontype,db_rsk.tb_rsk_productmonitorset,db_rsk.tb_rsk_stockmonitorset,db_sys.tb_sys_bond_info,db_sys.tb_sys_code_map,db_sys.tb_sys_company,db_sys.tb_sys_dictionary,db_sys.tb_sys_exchange_info,db_sys.tb_sys_function_info,db_sys.tb_sys_menu,db_sys.tb_sys_menu_function,db_sys.tb_sys_operator,db_sys.tb_sys_operator_company,db_sys.tb_sys_operator_menu,db_sys.tb_sys_operator_parameter,db_sys.tb_sys_operator_role,db_sys.tb_sys_operator_unit,db_sys.tb_sys_order_direction,db_sys.tb_sys_parameter,db_sys.tb_sys_role,db_sys.tb_sys_role_menu,db_sys.tb_sys_stock_type,db_sys.tb_sys_system_info,db_sys.tb_sys_trade_date,db_sys.tb_sys_trade_time,db_sys.tb_sys_task_ex Replicate_Wild_Ignore_Table: Last_Errno: 1872 Last_Error: Slave failed to initialize relay log info structure from the repository Skip_Counter: 0 Exec_Master_Log_Pos: 175251424 Relay_Log_Space: 0 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: NULLMaster_SSL_Verify_Server_Cert: No Last_IO_Errno: 0 Last_IO_Error: Last_SQL_Errno: 1872 Last_SQL_Error: Slave failed to initialize relay log info structure from the repository Replicate_Ignore_Server_Ids: Master_Server_Id: 0 Master_UUID: 96b464e1-b68f-11e6-8321-00163f00368a Master_Info_File: /usr/local/Percona-Server-5.7.16-10-Linux.x86_64.ssl101/data2/master.info SQL_Delay: 0 SQL_Remaining_Delay: NULL Slave_SQL_Running_State: Master_Retry_Count: 86400 Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: 170314 19:34:56 Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: Executed_Gtid_Set: Auto_Position: 0 Replicate_Rewrite_DB: (db_act,db_rsk) Channel_Name: Master_TLS_Version: 1 row in set (0.00 sec)ERROR: No query specified
使用start slave命令开启失败:
mysql> start slave;
ERROR 1872 (HY000): Slave failed to initialize relay log info structure from the repository
使用reset slave命令解决:
mysql> reset slave;
Query OK, 0 rows affected (0.01 sec)
mysql> start slave;
Query OK, 0 rows affected (0.03 sec)
mysql> show slave status\G;*************************** 1. row *************************** Slave_IO_State: Queueing master event to the relay log Master_Host: 127.0.0.1 Master_User: root Master_Port: 3306 Connect_Retry: 60 Master_Log_File: mysql-bin.000223 Read_Master_Log_Pos: 62998 Relay_Log_File: relay-bin.000003 Relay_Log_Pos: 11565 Relay_Master_Log_File: mysql-bin.000223 Slave_IO_Running: Yes Slave_SQL_Running: Yes Replicate_Do_DB: db_rsk,db_sys Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: db_rsk.tb_act_unitequitiesposition,db_rsk.tb_act_productposition,db_rsk.tb_act_productunitasset,db_rsk.tb_act_productaccount,db_rsk.tb_act_unitaccount,db_rsk.tb_act_operationconfig,db_rsk.tb_rsk_assetvaluecompliance,db_rsk.tb_rsk_stockcostcompliance,db_rsk.tb_rsk_stockpoolcompliance,db_rsk.tb_rsk_stockquantitycompliance,db_rsk.tb_rsk_stockvaluecompalince,db_rsk.tb_rsk_tradelimitcompliance,db_rsk.tb_rsk_reversetradecompliance,db_rsk.tb_rsk_navcompliance,db_rsk.tb_rsk_rulescompliancecode,db_rsk.tb_rsk_usernavsection,db_rsk.tb_rsk_complianceset,db_rsk.tb_rsk_customdimensionstock,db_rsk.tb_rsk_customdimensiontype,db_rsk.tb_rsk_indexstock,db_rsk.tb_rsk_indextype,db_rsk.tb_rsk_industryclassification,db_rsk.tb_rsk_industrystock,db_rsk.tb_rsk_industrytype,db_rsk.tb_rsk_userdimensionstock,db_rsk.tb_rsk_userdimensiontype,db_rsk.tb_rsk_productmonitorset,db_rsk.tb_rsk_stockmonitorset,db_sys.tb_sys_bond_info,db_sys.tb_sys_code_map,db_sys.tb_sys_company,db_sys.tb_sys_dictionary,db_sys.tb_sys_exchange_info,db_sys.tb_sys_function_info,db_sys.tb_sys_menu,db_sys.tb_sys_menu_function,db_sys.tb_sys_operator,db_sys.tb_sys_operator_company,db_sys.tb_sys_operator_menu,db_sys.tb_sys_operator_parameter,db_sys.tb_sys_operator_role,db_sys.tb_sys_operator_unit,db_sys.tb_sys_order_direction,db_sys.tb_sys_parameter,db_sys.tb_sys_role,db_sys.tb_sys_role_menu,db_sys.tb_sys_stock_type,db_sys.tb_sys_system_info,db_sys.tb_sys_trade_date,db_sys.tb_sys_trade_time,db_sys.tb_sys_task_ex Replicate_Wild_Ignore_Table: Last_Errno: 0 Last_Error: Skip_Counter: 0 Exec_Master_Log_Pos: 11360 Relay_Log_Space: 63396 Until_Condition: None Until_Log_File: Until_Log_Pos: 0