1

I am new to Proxysql and have created a docker file for the Gcloud instance group following is the configration of Docker.file

FROM debian:11
MAINTAINER Hitesh Sidhiyta <hitesh@thefitway.io>

RUN apt-get update && apt-get install -y wget default-mysql-client inotify-tools procps && apt-get install -y wget lsb-release gnupg apt-transport-https ca-certificates && wget -O - 'https://repo.proxysql.com/ProxySQL/repo_pub_key' | apt-key add - && echo deb https://repo.proxysql.com/ProxySQL/proxysql-2.3.x/$(lsb_release -sc)/ ./ | tee /etc/apt/sources.list.d/proxysql.list && apt-get update && apt-get install proxysql && rm -rf /var/lib/apt/lists/*

COPY proxysql.cnf /etc/proxysql.cnf
COPY verify_proxy_config.sh /usr/local/bin/verify_proxy_config.sh

ENTRYPOINT ["proxysql", "-f", "--idle-threads", "-D", "/var/lib/proxysql"]

# Expose ports
EXPOSE 6033

proxysql configration file proxysql.sh


datadir="/var/lib/proxysql"

admin_variables=
{
    admin_credentials="admin:admin"
    mysql_ifaces="0.0.0.0:6032"
    refresh_interval=2000
    restapi_enabled=true
    restapi_port=6070
}

restapi:
(
    {
        id=1
        active=1
        interval_ms=1000
        method="GET"
        uri="status"
        script="/usr/local/bin/verify_proxy_config.sh"
        comment="health check status"
    }
)

mysql_variables=
{
    eventslog_filename="queries.log"
    eventslog_default_log=1
    threads=4
    max_connections=2048
    default_query_delay=0
    default_query_timeout=36000000
    have_compress=true
    poll_timeout=2000
    interfaces="0.0.0.0:6033;/tmp/proxysql.sock"
    default_schema="information_schema"
    stacksize=1048576
    server_version="5.1.30"
    connect_timeout_server=10000
    monitor_history=60000
    monitor_connect_interval=200000
    monitor_ping_interval=200000
    ping_interval_server_msec=10000
    ping_timeout_server=200
    commands_stats=true
    sessions_sort=true
    monitor_username="***"
    monitor_password="***"
}

mysql_replication_hostgroups =
(
    { writer_hostgroup=10 , reader_hostgroup=20 , comment="host groups" }
)

mysql_servers =
(
    { address="*.*.*.*" , port=3306 , hostgroup=10, max_connections=1000 , max_replication_lag = 5 },
    { address="*.*.*.*" , port=3306 , hostgroup=20, max_connections=1000 , max_replication_lag = 5 },
    { address="*.*.*.*" , port=3306 , hostgroup=20, max_connections=1000 , max_replication_lag = 5 }
)

mysql_query_rules =
(
    {
        rule_id=100
        active=1
        match_pattern="^SELECT .* FOR UPDATE"
        destination_hostgroup=10
        log=1
        apply=1
    },
    {
        rule_id=200
        active=1
        match_pattern="^SELECT .*"
        destination_hostgroup=20
        log=1
        apply=1
    },
    {
        rule_id=300
        active=1
        match_pattern=".*"
        destination_hostgroup=10
        log=1
        apply=1
    }
)

mysql_users =
(
    { username = "***" , password = "***" , default_hostgroup = 10 , active = 1 }
)

verify_proxy_config.sh

#!/bin/bash
set -e
echo '{"message":"HealthCheck Succeded"}'
exit 0;

after all this setup when i send and http request for health check i get following error:

curl -i -X GET http://127.0.0.1:6070/sync/status
HTTP/1.1 424 Failed Dependency
Connection: Keep-Alive
Content-Length: 74
Access-Control-Allow-Origin: *
Content-Type: application/json
Date: Thu, 13 Oct 2022 11:58:50 GMT

{"type":"out", "error":"Script failed to be executed.", "error_code":"13"}

so my question are:

  1. Is this the right way to perform a health check? if no please help what should i do.

1 Answers1

0

Most probably the script verify_proxy_config.sh is missing execution permission, you may need to set +x mode on the file.

matheuzzy
  • 472
  • 3
  • 10