Set Up Server Load Balancer for ProxySQLs on Alibaba Cloud

We use 2 ProxySQLs to single point of failure of ProxySQL. We need to set up load balancer as the gateway and share the traffict for both of ProxySQLS.

We set up the Load Balancer instance in Alibaba Cloud, follow the step in this link https://www.alibabacloud.com/help/doc-detail/27552.htm

When you are in Add Listener pop up. Follow this note:

  • Frontend Protocol [Port] : 6033. To make it simple you can use port 6033 (same with ProxySQL port)
  • Backend Protocol [Port] : 6033. It must same with ProxySQL port, because we want to access this port
  • Scheduling Algorithm : Round Robin
  • Health Check Port : 6033

After you add the listener, you need to add Backend Servers. Add the both of ProxySQL instance to the Backend Servers. Go back to the Instances page and click Refresh. When health check is Normal, the corresponding ECS instance can process requests forwarded by the Server Load Balancer instance normally.

Check and Test

Test to access the database using the load balancer IP address (50.50.50.1). If you use mysql shell, use this command: mysql -u sbuser -psbpassword -h 50.50.50.1 -P 6033

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Setting environment for using XAMPP for Windows.
user@DESKTOP-P20ELHV d:\xampp
# mysql -u sbuser -psbpassword -h 50.50.50.1 -P 6033
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 367836
Server version: 5.5.30 (ProxySQL)

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]> select * from playground.equipment;
+----+-------+-------+--------+
| id | type | quant | color |
+----+-------+-------+--------+
| 1 | slide | 2 | blue |
| 2 | swing | 10 | yellow |
| 9 | slide | 3 | green |
| 15 | pen | 5 | purple |
| 16 | watch | 6 | black |
+----+-------+-------+--------+
5 rows in set (0.06 sec)

MySQL [(none)]>

Reference

https://www.alibabacloud.com/help/doc-detail/27552.htm

© 2017 - Muh Rizal
Powered by Hexo