RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
mysql5.6升级到5.7.13后开启多源复制遇到重复的channelname该怎么办

这篇文章将为大家详细讲解有关MySQL5.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. 5.7:

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

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

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

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

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

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

  18. 13

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

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

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

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

  23. mysql>

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

  25.     -> master_user='repl',

  26.     -> MASTER_PORT=3307,

  27.     -> master_password='passw0rd',

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

  29. change master to master_host='vm3',

  30. master_user='repl',

  31. MASTER_PORT=3307,

  32. master_password='passw0rd',

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

  34. mysql>

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

  36.     -> master_user='repl',

  37.     -> MASTER_PORT=3307,

  38.     -> master_password='passw0rd',

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

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

  41. mysql>

  42. mysql>

  43. mysql> show slave status\G;

  44. *************************** 1. row ***************************

  45.                Slave_IO_State:

  46.                   Master_Host: vm2

  47.                   Master_User: repl

  48.                   Master_Port: 3307

  49.                 Connect_Retry: 60

  50.               Master_Log_File:

  51.           Read_Master_Log_Pos: 4

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

  53.                 Relay_Log_Pos: 4

  54.         Relay_Master_Log_File:

  55.              Slave_IO_Running: No

  56.             Slave_SQL_Running: No

  57.               Replicate_Do_DB:

  58.           Replicate_Ignore_DB:

  59.            Replicate_Do_Table:

  60.        Replicate_Ignore_Table:

  61.       Replicate_Wild_Do_Table:

  62.   Replicate_Wild_Ignore_Table:

  63.                    Last_Errno: 0

  64.                    Last_Error:

  65.                  Skip_Counter: 0

  66.           Exec_Master_Log_Pos: 0

  67.               Relay_Log_Space: 154

  68.               Until_Condition: None

  69.                Until_Log_File:

  70.                 Until_Log_Pos: 0

  71.            Master_SSL_Allowed: No

  72.            Master_SSL_CA_File:

  73.            Master_SSL_CA_Path:

  74.               Master_SSL_Cert:

  75.             Master_SSL_Cipher:

  76.                Master_SSL_Key:

  77.         Seconds_Behind_Master: NULL

  78. Master_SSL_Verify_Server_Cert: No

  79.                 Last_IO_Errno: 0

  80.                 Last_IO_Error:

  81.                Last_SQL_Errno: 0

  82.                Last_SQL_Error:

  83.   Replicate_Ignore_Server_Ids:

  84.              Master_Server_Id: 0

  85.                   Master_UUID:

  86.              Master_Info_File: mysql.slave_master_info

  87.                     SQL_Delay: 0

  88.           SQL_Remaining_Delay: NULL

  89.       Slave_SQL_Running_State:

  90.            Master_Retry_Count: 86400

  91.                   Master_Bind:

  92.       Last_IO_Error_Timestamp:

  93.      Last_SQL_Error_Timestamp:

  94.                Master_SSL_Crl:

  95.            Master_SSL_Crlpath:

  96.            Retrieved_Gtid_Set:

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

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

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

  100.                 Auto_Position: 1

  101.          Replicate_Rewrite_DB:

  102.                  Channel_Name: master_vm2

  103.            Master_TLS_Version:

  104. *************************** 2. row ***************************

  105.                Slave_IO_State:

  106.                   Master_Host: vm3

  107.                   Master_User: repl

  108.                   Master_Port: 3307

  109.                 Connect_Retry: 60

  110.               Master_Log_File:

  111.           Read_Master_Log_Pos: 4

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

  113.                 Relay_Log_Pos: 4

  114.         Relay_Master_Log_File:

  115.              Slave_IO_Running: No

  116.             Slave_SQL_Running: No

  117.               Replicate_Do_DB:

  118.           Replicate_Ignore_DB:

  119.            Replicate_Do_Table:

  120.        Replicate_Ignore_Table:

  121.       Replicate_Wild_Do_Table:

  122.   Replicate_Wild_Ignore_Table:

  123.                    Last_Errno: 0

  124.                    Last_Error:

  125.                  Skip_Counter: 0

  126.           Exec_Master_Log_Pos: 0

  127.               Relay_Log_Space: 154

  128.               Until_Condition: None

  129.                Until_Log_File:

  130.                 Until_Log_Pos: 0

  131.            Master_SSL_Allowed: No

  132.            Master_SSL_CA_File:

  133.            Master_SSL_CA_Path:

  134.               Master_SSL_Cert:

  135.             Master_SSL_Cipher:

  136.                Master_SSL_Key:

  137.         Seconds_Behind_Master: NULL

  138. Master_SSL_Verify_Server_Cert: No

  139.                 Last_IO_Errno: 0

  140.                 Last_IO_Error:

  141.                Last_SQL_Errno: 0

  142.                Last_SQL_Error:

  143.   Replicate_Ignore_Server_Ids:

  144.              Master_Server_Id: 0

  145.                   Master_UUID:

  146.              Master_Info_File: mysql.slave_master_info

  147.                     SQL_Delay: 0

  148.           SQL_Remaining_Delay: NULL

  149.       Slave_SQL_Running_State:

  150.            Master_Retry_Count: 86400

  151.                   Master_Bind:

  152.       Last_IO_Error_Timestamp:

  153.      Last_SQL_Error_Timestamp:

  154.                Master_SSL_Crl:

  155.            Master_SSL_Crlpath:

  156.            Retrieved_Gtid_Set:

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

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

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

  160.                 Auto_Position: 1

  161.          Replicate_Rewrite_DB:

  162.                  Channel_Name: master_vm2

  163.            Master_TLS_Version:

  164. 2 rows in set (0.00 sec)

  165. ERROR:

  166. No query specified

  167. mysql>

  168. mysql> select CHANNEL_NAME FROM performance_schema.replication_connection_status;

  169. +--------------+

  170. | CHANNEL_NAME |

  171. +--------------+

  172. | master_vm2 |

  173. | master_vm2 |

  174. +--------------+

  175. 2 rows in set (0.01 sec)

  176. mysql> select CHANNEL_NAME FROM performance_schema.replication_connection_status;

  177. +--------------+

  178. | CHANNEL_NAME |

  179. +--------------+

  180. | master_vm2 |

  181. | master_vm2 |

  182. +--------------+

  183. 2 rows in set (0.01 sec)

  184. mysql> start slave;

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

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

  187. mysql> show databases;

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

  189. | Database |

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

  191. | information_schema |

  192. | mysql |

  193. | performance_schema |

  194. | sys |

  195. | test |

  196. | vm2 |

  197. | vm3 |

  198. +--------------------+

  199. 7 rows in set (0.00 sec)

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

  201. mysql> reset slave all;

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

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

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

  205. mysql>

  206. mysql> reset slave all;

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

  208. No connection. Trying to reconnect...

  209. Connection id: 2

  210. Current database: *** NONE ***

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

  212. mysql> show slave status\G;

  213. Empty set (0.01 sec)

  214. ERROR:

  215. No query specified

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

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

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

  219. 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

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

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

  222. 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

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

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

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

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

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

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

  229. collection process might fail.

  230. key_buffer_size=8388608

  231. read_buffer_size=131072

  232. max_used_connections=1

  233. max_threads=151

  234. thread_count=1

  235. connection_count=1

  236. It is possible that mysqld could use up to

  237. key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 68189 K  bytes of memory

  238. 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

关于mysql5.6升级到5.7.13后开启多源复制遇到重复的channel name该怎么办就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。


本文名称:mysql5.6升级到5.7.13后开启多源复制遇到重复的channelname该怎么办
URL地址:http://scpingwu.com/article/iidcpg.html