Skip to content

Instantly share code, notes, and snippets.

@a1git
Created March 1, 2021 23:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save a1git/5775af6ee102b5fdce91a769f961c903 to your computer and use it in GitHub Desktop.
Save a1git/5775af6ee102b5fdce91a769f961c903 to your computer and use it in GitHub Desktop.
haproxy setting.
frontend galera-front-1
bind 172.29.236.11:3306
option tcplog
timeout client 5000s
acl white_list src 127.0.0.1/8 192.168.0.0/16 172.16.0.0/12 10.0.0.0/8
tcp-request content accept if white_list
tcp-request content reject
mode tcp
default_backend galera-back
backend galera-back
mode tcp
balance leastconn
timeout server 5000s
stick store-request src
stick-table type ip size 256k expire 30m
option tcplog
option httpchk HEAD / HTTP/1.0\r\nUser-agent:\ osa-haproxy-healthcheck
server c1_galera_container-55d36d5a 172.29.239.79:3306 check port 9200 inter 12000 rise 1 fall 1
root@c1:~# lxc-attach -n c1_galera_container-55d36d5a
root@c1-galera-container-55d36d5a:~# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 68
Server version: 10.5.8-MariaDB-1:10.5.8+maria~focal-log mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.000 sec)
MariaDB [(none)]>
root@c1-utility-container-f8475869:~# cat .my.cnf
[client]
host = 172.29.236.11
user = root
password = b10822f055acb44155
root@c1-utility-container-f8475869:~# mysql -h 172.29.236.11 -u root -p
Enter password:
ERROR 2013 (HY000): Lost connection to MySQL server at 'handshake: reading initial communication packet', system error: 11
root@c1-utility-container-f8475869:~# mysql -h 172.29.239.79 -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 69
Server version: 10.5.8-MariaDB-1:10.5.8+maria~focal-log mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment