Mysqlchk in container

I am running percona-xtradb 8.0.21 in a docker container. I am trying to configure haproxy to load balance but can’t quite get it. I’m following this

https://www.percona.com/doc/percona-xtradb-cluster/LATEST/howtos/haproxy.html

and this

https://www.percona.com/doc/percona-xtradb-cluster/5.6/howtos/virt_sandbox.html

I can run the clustercheck script as such

docker exec -it percona-xtradb clustercheck clusteradmin ****

and get the 200 OK (Percona XtraDB Cluster Node is synced.) response

but can’t quite figure it out the mysqlchk part. I have dropped the mysqlchk file in /etc/xinetd.d inside the container and restarted it, however I do not see 9200 listening on the container host. I do see 3306 and can make remote mysql connections into mysql running in the container.

I do not see any xinetd service unit.

Should I pull mysqlchk and clustercheck out of the container and run on the container host?

Maybe proxysql is the way to go. Just figured it would be nice to know how others have done it with haproxy.

Thanks

1 Like

I was able to get this working. I moved the mysqlchk from the container and run it on the localhost. I modifed it some to look like this

service mysqlchk
{
  disable         = no
  flags           = REUSE
  socket_type     = stream
  type            = UNLISTED
  port            = 9200
  wait            = no
  user            = root
  server          = /usr/bin/docker
  log_on_failure += USERID
  only_from       = <haproxy IP>
  per_source      = UNLIMITED
  server_args     = exec percona-xtradb /usr/bin/clustercheck <user> <pass> 0 /dev/null 0
}

I had to touch this file as root

touch ~/.docker/config.json

b/c without it I would get this as the first line of output when running clustercheck thru docker exec as root

WARNING: Error loading config file: .dockerconfig: $HOME is not defined

And haproxy would show db as down b/c it expects to see the HTTP/1.1 200 OK line first

1 Like