Bug #89834 Replication will not connect on IPv6 - does not function in an IPv6 only environ
Submitted: 27 Feb 2018 20:58 Modified: 2 Apr 2018 12:46
Reporter: Tim St. Pierre Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Replication Severity:S2 (Serious)
Version:5.7.21 OS:FreeBSD (11.1-RELEASE)
Assigned to: CPU Architecture:x86 (Hosted under KVM)
Tags: ipv6, replication

[27 Feb 2018 20:58] Tim St. Pierre
Description:
When running under an IPv6 only environment, replication client does not initiate a connection to the master server.  Error log indicates "error connecting to master" Error_code: 2005  I have tried setting master_host using a hostname, and IPv6 address both with and without square brackets.  The command line mysql client can connect to the replication master successfully.  The server is bound to :: and will respond to IPv6 connections from other hosts, including the master server (when running command line client).

How to repeat:
Configure two hosts with only IPv6 addresses and install mysql server.
Set bind_address to :: to ensure listening on IPv6
Configure binary logging on the master server
Configure replication on the slave server, using a valid DNS name (dns or hosts file).
Start slave
Observe timeout connecting to master
Perform packet capture on either server and observe that there is no connection initiated on the slave server.
As a control: use the mysql client on the slave server to connect to the master server and verify that it is listening on IPv6.

Suggested fix:
Review slave I/O code for the mechanism used to create connections to the master and ensure that it will resolve IPv6 host names or literal IP addresses.  In the case of literal addresses, add the correct format (brackets required?) to the documentation.
[2 Apr 2018 12:46] MySQL Verification Team
Hi,

Thanks for the report! It's definitely a bug on our part.

all best
Bogdan