File tree Expand file tree Collapse file tree 6 files changed +59
-4
lines changed Expand file tree Collapse file tree 6 files changed +59
-4
lines changed Original file line number Diff line number Diff line change 3030 bind *:33060
3131 mode tcp
3232 option clitcpka
33- default_backend mysql-primary
33+ default_backend mysql-x
3434
3535 frontend mysql-admin-in
3636 bind *:33062
3737 mode tcp
3838 option clitcpka
39- default_backend mysql-primary
39+ default_backend mysql-admin
4040
4141 frontend stats
4242 bind *:8404
Original file line number Diff line number Diff line change 1111 balance roundrobin
1212 option external-check
1313 external-check command /opt/percona/haproxy_check_replicas.sh
14+
15+ backend mysql-x
16+ mode tcp
17+ option srvtcpka
18+ balance roundrobin
19+ option external-check
20+ external-check command /opt/percona/haproxy_check_replicas.sh
21+
22+ backend mysql-admin
23+ mode tcp
24+ option srvtcpka
25+ balance roundrobin
26+ option external-check
27+ external-check command /opt/percona/haproxy_check_replicas.sh
Original file line number Diff line number Diff line change @@ -65,6 +65,34 @@ function main() {
6565 echo " ${NODE_LIST_REPL[*]} "
6666 ) >> " $path_to_haproxy_cfg /haproxy.cfg"
6767
68+ cat << -EOF >>"$path_to_haproxy_cfg /haproxy.cfg"
69+ backend mysql-x
70+ mode tcp
71+ option srvtcpka
72+ balance roundrobin
73+ option external-check
74+ external-check command /opt/percona/haproxy_check_replicas.sh
75+ EOF
76+
77+ (
78+ IFS=$' \n '
79+ echo " ${NODE_LIST_MYSQLX[*]} "
80+ ) >> " $path_to_haproxy_cfg /haproxy.cfg"
81+
82+ cat << -EOF >>"$path_to_haproxy_cfg /haproxy.cfg"
83+ backend mysql-admin
84+ mode tcp
85+ option srvtcpka
86+ balance roundrobin
87+ option external-check
88+ external-check command /opt/percona/haproxy_check_replicas.sh
89+ EOF
90+
91+ (
92+ IFS=$' \n '
93+ echo " ${NODE_LIST_ADMIN[*]} "
94+ ) >> " $path_to_haproxy_cfg /haproxy.cfg"
95+
6896 haproxy -c -f /opt/percona/haproxy-global.cfg -f $path_to_haproxy_cfg /haproxy.cfg
6997
7098 # TODO: Can we do something for maintenance mode?
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ metadata:
77spec :
88 containers :
99 - name : mysql-client
10- image : percona/percona-server:8.0.25
10+ image : percona/percona-server:8.0.33
1111 command :
1212 - sleep
1313 - infinity
Original file line number Diff line number Diff line change @@ -161,6 +161,19 @@ run_mysql() {
161161 | (grep -v ' Using a password on the command line interface can be insecure.' || :)
162162}
163163
164+ run_mysqlsh () {
165+ local command=" $1 "
166+ local uri=" $2 "
167+ local pod=" $3 "
168+
169+ client_pod=$( get_client_pod)
170+ wait_pod $client_pod 1>&2
171+
172+ kubectl -n " ${NAMESPACE} " exec " ${pod:- mysql-client} " -- \
173+ bash -c " printf '%s\n' \" ${command} \" | mysqlsh --sql --quiet-start=2 $uri " 2>&1 \
174+ | tail -n +2
175+ }
176+
164177run_curl () {
165178 kubectl -n " ${NAMESPACE} " exec mysql-client -- bash -c " curl -s -k $* "
166179}
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ commands:
1919 # proxy_protocol=$(run_mysql "SELECT count(*) FROM myDB.myTable" "-h $(get_haproxy_svc $(get_cluster_name)) -P 3309 -uroot -proot_password")
2020 # args="${args} --from-literal=proxy_protocol=${proxy_protocol}"
2121
22- mysqlx=$(run_mysql "SELECT count(*) FROM myDB.myTable" "-h $(get_haproxy_svc $(get_cluster_name)) -P 33060 -uroot -proot_password")
22+ mysqlx=$(run_mysqlsh "SELECT count(*) FROM myDB.myTable" "-h $(get_haproxy_svc $(get_cluster_name)) -P 33060 -uroot -proot_password")
2323 args="${args} --from-literal=mysqlx=${mysqlx}"
2424
2525 mysql_admin=$(run_mysql "SELECT count(*) FROM myDB.myTable" "-h $(get_haproxy_svc $(get_cluster_name)) -P 33062 -uroot -proot_password")
You can’t perform that action at this time.
0 commit comments