MySQL 5.7.13开启多源复制后遇到重复的channel name

MySQL从5.6升级到5.7.13后,开启多源复制,遇到重复的channel name

1.一共三个数据库,原版本均为5.6,升级到5.7.13后开启多源复制,做成两主一从,发现channel name同名。
 
2. 在从库执行reset slave all后,从库自动重启。

3. 5.6 ---> 5.7.13:

4. 5.6:

5. 1 cd /usr/local/mysql ; scripts/mysql_install_db --user=mysql --defaults-file=/57data/my56.cnf

6. 2 /usr/local/mysql/bin/mysqld_safe --defaults-file=/57data/my56.cnf &

7. 3 mysqladmin -S /tmp/mysql3307.sock -u root -P3307 -p password

8. 4 mysql -uroot -S /tmp/mysql3307.sock -pmysql

9. 5 set global innodb_fast_shutdown=0;

10. 6 mysqladmin -S /tmp/mysql3307.sock shutdown

11.

12. 5.7:

13. 7 cd /usr/local/mysql57 ; ./bin/mysqld_safe --defaults-file=/57data/my.cnf &

14. 8 cd /usr/local/mysql57 ; ./bin/mysql_upgrade -S /tmp/mysql3307.sock

15. 9 cd /usr/local/mysql57 ; ./bin/mysqladmin -S /tmp/mysql3307.sock shutdown

16. 10 cd /usr/local/mysql57 ; ./bin/mysqld_safe --defaults-file=/57data/my.cnf &

17. 11 /usr/local/mysql57/bin/mysql -S /tmp/mysql3307.sock

18. 12 grant replication slave,replication client on *.* to repl@'%' identified by 'passw0rd';

19. 13

20. mysql> SET GLOBAL master_info_repository = 'TABLE';

21. Query OK, 0 rows affected (0.00 sec)

22.

23. mysql> SET GLOBAL relay_log_info_repository = 'TABLE';

24. Query OK, 0 rows affected (0.00 sec)

25.

26. mysql>

27. mysql> change master to master_host='vm2',

28.    -> master_user='repl',

29.    -> MASTER_PORT=3307,

30.    -> master_password='passw0rd',

31.    -> master_auto_position=1 FOR CHANNEL 'master_vm2';

32.

33. change master to master_host='vm3',

34. master_user='repl',

35. MASTER_PORT=3307,

36. master_password='passw0rd',

37. Query OK, 0 rows affected, 2 warnings (0.08 sec)

38.

39. mysql>

40. mysql> change master to master_host='vm3',

41.    -> master_user='repl',

42.    -> MASTER_PORT=3307,

43.    -> master_password='passw0rd',

44.    -> master_auto_position=1 FOR CHANNEL 'master_vm3';

45. Query OK, 0 rows affected, 2 warnings (0.04 sec)

46.

47. mysql>

48. mysql>

49. mysql> show slave status\G;

50. *************************** 1. row ***************************

51.                Slave_IO_State:

52.                  Master_Host: vm2

53.                  Master_User: repl

54.                  Master_Port: 3307

55.                Connect_Retry: 60

56.              Master_Log_File:

57.          Read_Master_Log_Pos: 4

58.                Relay_Log_File: vm4-relay-bin-master_vm2.000001

59.                Relay_Log_Pos: 4

60.        Relay_Master_Log_File:

61.              Slave_IO_Running: No

62.            Slave_SQL_Running: No

63.              Replicate_Do_DB:

64.          Replicate_Ignore_DB:

65.            Replicate_Do_Table:

66.        Replicate_Ignore_Table:

67.      Replicate_Wild_Do_Table:

68.  Replicate_Wild_Ignore_Table:

69.                    Last_Errno: 0

70.                    Last_Error:

71.                  Skip_Counter: 0

72.          Exec_Master_Log_Pos: 0

73.              Relay_Log_Space: 154

74.              Until_Condition: None

75.                Until_Log_File:

76.                Until_Log_Pos: 0

77.            Master_SSL_Allowed: No

78.            Master_SSL_CA_File:

79.            Master_SSL_CA_Path:

80.              Master_SSL_Cert:

81.            Master_SSL_Cipher:

82.                Master_SSL_Key:

83.        Seconds_Behind_Master: NULL

84. Master_SSL_Verify_Server_Cert: No

85.                Last_IO_Errno: 0

86.                Last_IO_Error:

87.                Last_SQL_Errno: 0

88.                Last_SQL_Error:

89.  Replicate_Ignore_Server_Ids:

90.              Master_Server_Id: 0

91.                  Master_UUID:

92.              Master_Info_File: mysql.slave_master_info

93.                    SQL_Delay: 0

94.          SQL_Remaining_Delay: NULL

95.      Slave_SQL_Running_State:

96.            Master_Retry_Count: 86400

97.                  Master_Bind:

98.      Last_IO_Error_Timestamp:

99.      Last_SQL_Error_Timestamp:

100.                Master_SSL_Crl:

101.            Master_SSL_Crlpath:

102.            Retrieved_Gtid_Set:

103.            Executed_Gtid_Set: 45ee9543-2d51-11e6-ba5d-0800276e6667:1-2,

104. 4acf2a8c-2d51-11e6-ba5d-080027806975:1-2,

105. 4c01fc54-2d51-11e6-ba5d-08002781f86e:1-6

106.                Auto_Position: 1

107.          Replicate_Rewrite_DB:

108.                  Channel_Name: master_vm2

109.            Master_TLS_Version:

110. *************************** 2. row ***************************

111.                Slave_IO_State:

112.                  Master_Host: vm3

113.                  Master_User: repl

114.                  Master_Port: 3307

115.                Connect_Retry: 60

116.              Master_Log_File:

117.          Read_Master_Log_Pos: 4

118.                Relay_Log_File: vm4-relay-bin-master_vm3.000001

119.                Relay_Log_Pos: 4

120.        Relay_Master_Log_File:

121.              Slave_IO_Running: No

122.            Slave_SQL_Running: No

123.              Replicate_Do_DB:

124.          Replicate_Ignore_DB:

125.            Replicate_Do_Table:

126.        Replicate_Ignore_Table:

127.      Replicate_Wild_Do_Table:

128.  Replicate_Wild_Ignore_Table:

129.                    Last_Errno: 0

130.                    Last_Error:

131.                  Skip_Counter: 0

132.          Exec_Master_Log_Pos: 0

133.              Relay_Log_Space: 154

134.              Until_Condition: None

135.                Until_Log_File:

136.                Until_Log_Pos: 0

137.            Master_SSL_Allowed: No

138.            Master_SSL_CA_File:

139.            Master_SSL_CA_Path:

140.              Master_SSL_Cert:

141.            Master_SSL_Cipher:

142.                Master_SSL_Key:

143.        Seconds_Behind_Master: NULL

144. Master_SSL_Verify_Server_Cert: No

145.                Last_IO_Errno: 0

146.                Last_IO_Error:

147.                Last_SQL_Errno: 0

148.                Last_SQL_Error:

149.  Replicate_Ignore_Server_Ids:

150.              Master_Server_Id: 0

151.                  Master_UUID:

152.              Master_Info_File: mysql.slave_master_info

153.                    SQL_Delay: 0

154.          SQL_Remaining_Delay: NULL

155.      Slave_SQL_Running_State:

156.            Master_Retry_Count: 86400

157.                  Master_Bind:

158.      Last_IO_Error_Timestamp:

159.      Last_SQL_Error_Timestamp:

160.                Master_SSL_Crl:

161.            Master_SSL_Crlpath:

162.            Retrieved_Gtid_Set:

163.            Executed_Gtid_Set: 45ee9543-2d51-11e6-ba5d-0800276e6667:1-2,

164. 4acf2a8c-2d51-11e6-ba5d-080027806975:1-2,

165. 4c01fc54-2d51-11e6-ba5d-08002781f86e:1-6

166.                Auto_Position: 1

167.          Replicate_Rewrite_DB:

168.                  Channel_Name: master_vm2

169.            Master_TLS_Version:

170. 2 rows in set (0.00 sec)

171.

172. ERROR:

173. No query specified

174.

175. mysql>

176.

177. mysql> select CHANNEL_NAME FROM performance_schema.replication_connection_status;

178. +--------------+

179. | CHANNEL_NAME |

180. +--------------+

181. | master_vm2 |

182. | master_vm2 |

183. +--------------+

184. 2 rows in set (0.01 sec)

185.

186.

187. mysql> select CHANNEL_NAME FROM performance_schema.replication_connection_status;

188. +--------------+

189. | CHANNEL_NAME |

190. +--------------+

191. | master_vm2 |

192. | master_vm2 |

193. +--------------+

194. 2 rows in set (0.01 sec)

195.

196. mysql> start slave;

197. Query OK, 0 rows affected (0.04 sec)

198.

199. 在两主库分别建数据库vm2和vm3,系统正常复制到从库。

200. mysql> show databases;

201. +--------------------+

202. | Database |

203. +--------------------+

204. | information_schema |

205. | mysql |

206. | performance_schema |

207. | sys |

208. | test |

209. | vm2 |

210. | vm3 |

211. +--------------------+

212. 7 rows in set (0.00 sec)

213.

214. 在从库执行reset slave all,从库自动重启。

215. mysql> reset slave all;

216. ERROR 2013 (HY000): Lost connection to MySQL server during query

217. mysql> 2016-06-08T08:56:18.890685Z mysqld_safe Number of processes running now: 0

218. 2016-06-08T08:56:18.906614Z mysqld_safe mysqld restarted

219.

220. mysql>

221. mysql> reset slave all;

222. ERROR 2006 (HY000): MySQL server has gone away

223. No connection. Trying to reconnect...

224. Connection id: 2

225. Current database: *** NONE ***

226.

227. Query OK, 0 rows affected (0.09 sec)

228.

229. mysql> show slave status\G;

230. Empty set (0.01 sec)

231.

232. ERROR:

233. No query specified

234.

235.

236. err log里channel name信息显示正确,但出现Thread pointer相关信息,如下:

237. 2016-06-08T08:55:54.540373Z 4 [Note] Error reading relay log event for channel 'master_vm2': slave SQL thread was killed

238. 2016-06-08T08:55:54.550729Z 3 [Note] Slave I/O thread killed while reading event for channel 'master_vm2'

239. 2016-06-08T08:55:54.550814Z 3 [Note] Slave I/O thread exiting for channel 'master_vm2', read up to log 'mysql_bin.000005', position 653

240. 2016-06-08T08:55:54.556301Z 6 [Note] Error reading relay log event for channel 'master_vm3': slave SQL thread was killed

241. 2016-06-08T08:55:54.563404Z 5 [Note] Slave I/O thread killed while reading event for channel 'master_vm3'

242. 2016-06-08T08:55:54.563549Z 5 [Note] Slave I/O thread exiting for channel 'master_vm3', read up to log 'mysql_bin.000005', position 653

243. 08:56:18 UTC - mysqld got signal 11 ;

244. This could be because you hit a bug. It is also possible that this binary

245. or one of the libraries it was linked against is corrupt, improperly built,

246. or misconfigured. This error can also be caused by malfunctioning hardware.

247. Attempting to collect some information that could help diagnose the problem.

248. As this is a crash and something is definitely wrong, the information

249. collection process might fail.

250.

251. key_buffer_size=8388608

252. read_buffer_size=131072

253. max_used_connections=1

254. max_threads=151

255. thread_count=1

256. connection_count=1

257. It is possible that mysqld could use up to

258. key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 68189 K  bytes of memory
259. Hope that's ok; if not, decrease some variables in the equation.

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/796ed0ddec93158a89e0fa9d11118aa6.html