1

I create two instances on EC2 (CentOS 7). I am trying to deploy MySQL InnoDB Cluster. When I add instance (slave) I found master cannot be connected.

I can use GUI tool on my local to connect the master, but I cannot use mysql cli to connect slave from master. I have close firewalld and iptables, I also disable SELINUX. My security group is open all traffic. I don't know what else should I check. Hope someone could help me fix this issue.

Here is my error:

[root@ip-172-31-25-217 centos]# mysql -u root -p -h node2 -P 3306
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on 'node2' (110)
2
  • 1
    Does it locate within the same VPC and region? Can you ping the second node from the master? Have you tried to use IP instead of FQDN?
    – Strepsils
    Sep 27, 2018 at 7:34
  • @Strepsils Yes, master and slave are at same region and VPC. They can ping each other. I also have set root@%
    – Rukeith
    Sep 27, 2018 at 7:40

1 Answer 1

1

It sounds like a Security Group issue.

Make sure both EC2 instances are in the same Security Group and make sure that the SG permits traffic to TCP port 3306 from members of the same group.

To do that go to EC2 console ➡ Instances and select your instance. Inspect what's under Security Groups in the details and if they have the same SGs attached. If they don't change it through Actions (at the top) ➡ Networking ➡ Change Security Groups.

Next check that the SG permits access to tcp/3306 from all the members of that SG. Let's say the group id is sg-1234abcd - you can find the real SG ID in the Group ID column.

Click on the Security Group name in the EC2 ➡ Instance details and a new screen will open. Go to Inbound tab in the bottom half of the screen and make sure it has a line that says:

| MySQL | TCP | 3306 | sg-1234abcd |

If it doesn't Click on Edit and add such a rule.

That should fix your problem.

However consider using AWS Relational Database Service (RDS) instead of setting up MySQL replication on EC2 instances. RDS provides a managed, high availability databases with automatic fail over, 100% compatible with MySQL. Unless you've got very very special requirements RDS is most likely a better option than managing your own MySQL cluster.

Hope that helps :)

1
  • It work now. Thank you for find my problems. I didn't consider the SG. My employer use physical machine. That is no free server for me. So I just trying to practice on my EC2.
    – Rukeith
    Sep 27, 2018 at 8:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .