阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

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

161次阅读
没有评论

共计 10082 个字符,预计需要花费 26 分钟才能阅读完成。

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.

 Thread pointer: 0x7f9550000b10
 Attempting backtrace. You can use the following information to find out
 where mysqld died. If you see no messages after this, something went
 terribly wrong…
 stack_bottom = 7f9583175e28 thread_stack 0x40000
 /usr/local/mysql57/bin/mysqld(my_print_stacktrace+0x35)[0xf25c45]
 /usr/local/mysql57/bin/mysqld(handle_fatal_signal+0x4a4)[0x7b8604]
 /lib64/libpthread.so.0[0x37f160f7e0]
 /usr/local/mysql57/bin/mysqld(_ZN16Multisource_info9delete_miEPKc+0x2df)[0xf082ff]
 /usr/local/mysql57/bin/mysqld(_Z11reset_slaveP3THDP11Master_infob+0x1c5)[0xef1e05]
 /usr/local/mysql57/bin/mysqld(_Z11reset_slaveP3THD+0x2e2)[0xef21b2]
 /usr/local/mysql57/bin/mysqld(_Z15reset_slave_cmdP3THD+0x98)[0xef2388]
 /usr/local/mysql57/bin/mysqld(_Z20reload_acl_and_cacheP3THDmP10TABLE_LISTPi+0x30c)[0xd2ae3c]
 /usr/local/mysql57/bin/mysqld(_Z21mysql_execute_commandP3THDb+0x83a)[0xcfaf2a]
 /usr/local/mysql57/bin/mysqld(_Z11mysql_parseP3THDP12Parser_state+0x3cd)[0xcff97d]
 /usr/local/mysql57/bin/mysqld(_Z16dispatch_commandP3THDPK8COM_DATA19enum_server_command+0x1099)[0xd00a79]
 /usr/local/mysql57/bin/mysqld(_Z10do_commandP3THD+0x194)[0xd016e4]
 /usr/local/mysql57/bin/mysqld(handle_connection+0x2a4)[0xdce6e4]
 /usr/local/mysql57/bin/mysqld(pfs_spawn_thread+0x171)[0x121b951]
 /lib64/libpthread.so.0[0x37f1607aa1]
 /lib64/libc.so.6(clone+0x6d)[0x37f0ee893d]

 Trying to get some variables.
 Some pointers may be invalid and cause the dump to abort.
 Query (7f95500054f0): is an invalid pointer
 Connection ID (thread ID): 2
 Status: NOT_KILLED

 The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
 information that should help you find out what is causing the crash.
 2016-06-08T08:56:18.890685Z mysqld_safe Number of processes running now: 0
 2016-06-08T08:56:18.906614Z mysqld_safe mysqld restarted

本文永久更新链接地址 :http://www.linuxidc.com/Linux/2016-12/138164.htm

正文完
星哥玩云-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-22发表,共计10082字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中