How to perform health checks on ProxySQL containers on ECS/EKS

1,334 views
Skip to first unread message

Simha Srivatsa

unread,
Aug 6, 2022, 6:54:56 AM8/6/22
to proxysql
Hello,

Sorry more of an infrastructure setup question. I want to know what's the best way to expose the health of ProxySQL containers on ECS. I'm thinking of creating a rest api endpoint :6070/health_check which would return a 200 response to a load balancer. Is this going to be expensive on the Proxysql side? Anything else I can do?

Sanjaya Senadheera

unread,
Aug 6, 2022, 7:42:29 AM8/6/22
to Simha Srivatsa, proxysql

On Sat, Aug 6, 2022 at 4:24 PM 'Simha Srivatsa' via proxysql <prox...@googlegroups.com> wrote:
Hello,

Sorry more of an infrastructure setup question. I want to know what's the best way to expose the health of ProxySQL containers on ECS. I'm thinking of creating a rest api endpoint :6070/health_check which would return a 200 response to a load balancer. Is this going to be expensive on the Proxysql side? Anything else I can do?

--
You received this message because you are subscribed to the Google Groups "proxysql" group.
To unsubscribe from this group and stop receiving emails from it, send an email to proxysql+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/proxysql/e4db772e-4e67-4da0-a156-c6b985fb2a90n%40googlegroups.com.

Simha Srivatsa

unread,
Aug 6, 2022, 10:16:23 AM8/6/22
to proxysql
I don't think this is what i'm looking for.
 I have a network load balancer(NLB) in front of a Proxysql cluster which uses target groups to perform health checks.  These health checks indicate if a proxysql container is healthy and can be forwarded traffic to. There are two types of health checks I can do.
  1. Using TCP and check if port 6033/6032 is accessible.
  2. Use HTTP and check port 6070 which will then return a 200 response.
In the first case, I get  Closing unhealthy client connection after every health check that the NLB makes. The second case looks promising. Would it slow down proxysql is my question? and also is there another way?

Nirav Patil

unread,
Nov 23, 2022, 11:27:20 PM11/23/22
to proxysql
hey any luck on this ??

Markus Bergholz

unread,
Nov 29, 2022, 4:38:33 AM11/29/22
to Simha Srivatsa, proxysql
On Sat, Aug 6, 2022 at 4:16 PM 'Simha Srivatsa' via proxysql <prox...@googlegroups.com> wrote:
I don't think this is what i'm looking for.
 I have a network load balancer(NLB) in front of a Proxysql cluster which uses target groups to perform health checks.  These health checks indicate if a proxysql container is healthy and can be forwarded traffic to. There are two types of health checks I can do.
  1. Using TCP and check if port 6033/6032 is accessible.
  2. Use HTTP and check port 6070 which will then return a 200 response.
In the first case, I get  Closing unhealthy client connection after every health check that the NLB makes.

We're seeing thousands to millions of "closing unhealthy client connections" per day.

And we're using proxysql also behind AWS NLB. It is very important that the healthcheck is targeting the Client SQL Port. So 6032. Basically the health check just proofs that something is listning on Port 6032.


 
The second case looks promising. Would it slow down proxysql is my question? and also is there another way?

On Saturday, August 6, 2022 at 5:12:29 PM UTC+5:30 smsse...@gmail.com wrote:

On Sat, Aug 6, 2022 at 4:24 PM 'Simha Srivatsa' via proxysql <prox...@googlegroups.com> wrote:
Hello,

Sorry more of an infrastructure setup question. I want to know what's the best way to expose the health of ProxySQL containers on ECS. I'm thinking of creating a rest api endpoint :6070/health_check which would return a 200 response to a load balancer. Is this going to be expensive on the Proxysql side? Anything else I can do?

--
You received this message because you are subscribed to the Google Groups "proxysql" group.
To unsubscribe from this group and stop receiving emails from it, send an email to proxysql+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/proxysql/e4db772e-4e67-4da0-a156-c6b985fb2a90n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "proxysql" group.
To unsubscribe from this group and stop receiving emails from it, send an email to proxysql+u...@googlegroups.com.

Simha Srivatsa

unread,
Nov 29, 2022, 4:48:49 AM11/29/22
to proxysql
Hey, I've created an HTTP endpoint. using restapi_routes, and I've used the endpoint in the NLB target group for a health check. This is enough for me to know if the containers are healthy

In the config file, I added this block.

restapi:
(
{
id=1
active=1
timeout_ms=1000
method="GET"
uri="health_check"
script="/home/proxysql/shared_utils/health_check.py"
comment="Health check endpoint"
}
)


Then used this script to return 200

#!/usr/local/bin/python

"""
Return a 200 response
"""

import json

if __name__ == "__main__":
print(json.dumps({"status": 200}))
exit(0)


You can set your NLB target group health check endpoint to /sync/health_check and it will work. (Note that protocol needs to be HTTP just for the health check)

Markus Bergholz

unread,
Nov 29, 2022, 6:18:30 AM11/29/22
to Simha Srivatsa, proxysql
On Tue, Nov 29, 2022 at 10:48 AM 'Simha Srivatsa' via proxysql <prox...@googlegroups.com> wrote:
Hey, I've created an HTTP endpoint. using restapi_routes, and I've used the endpoint in the NLB target group for a health check. This is enough for me to know if the containers are healthy

In the config file, I added this block.

restapi:
(
{
id=1
active=1
timeout_ms=1000
method="GET"
uri="health_check"
script="/home/proxysql/shared_utils/health_check.py"
comment="Health check endpoint"
}
)


Then used this script to return 200

#!/usr/local/bin/python

"""
Return a 200 response
"""

import json

if __name__ == "__main__":
print(json.dumps({"status": 200}))
exit(0)

That looks terribly wrong :) How does this verify that proxysql is running and accepting connections on the defined port?


 

Simha Srivatsa

unread,
Nov 29, 2022, 6:33:24 AM11/29/22
to proxysql
if the health check works, I think you can assume that proxysql is running. I'm the rest API endpoint as a "side" feature. If that works the main stuff works :D
Reply all
Reply to author
Forward
0 new messages