mysql5.7过滤重复数据_MySQL 5.7.13开启多源复制后遇到重复的channel name

在升级MySQL从5.6到5.7.13并启用多源复制后,遇到了channel name重复的问题。升级过程中,两主一从的配置导致了相同的channel name,执行`reset slave all`后从库自动重启。为了解决此问题,可能需要检查并调整各个数据库的channel名称,确保其唯一性。
摘要由CSDN通过智能技术生成

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

0b1331709591d260c1c78e86d0c51c18.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值