File tree 6 files changed +59
-4
lines changed
6 files changed +59
-4
lines changed Original file line number Diff line number Diff line change 30
30
bind *:33060
31
31
mode tcp
32
32
option clitcpka
33
- default_backend mysql-primary
33
+ default_backend mysql-x
34
34
35
35
frontend mysql-admin-in
36
36
bind *:33062
37
37
mode tcp
38
38
option clitcpka
39
- default_backend mysql-primary
39
+ default_backend mysql-admin
40
40
41
41
frontend stats
42
42
bind *:8404
Original file line number Diff line number Diff line change 11
11
balance roundrobin
12
12
option external-check
13
13
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() {
65
65
echo " ${NODE_LIST_REPL[*]} "
66
66
) >> " $path_to_haproxy_cfg /haproxy.cfg"
67
67
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
+
68
96
haproxy -c -f /opt/percona/haproxy-global.cfg -f $path_to_haproxy_cfg /haproxy.cfg
69
97
70
98
# TODO: Can we do something for maintenance mode?
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ metadata:
7
7
spec :
8
8
containers :
9
9
- name : mysql-client
10
- image : percona/percona-server:8.0.25
10
+ image : percona/percona-server:8.0.33
11
11
command :
12
12
- sleep
13
13
- infinity
Original file line number Diff line number Diff line change @@ -161,6 +161,19 @@ run_mysql() {
161
161
| (grep -v ' Using a password on the command line interface can be insecure.' || :)
162
162
}
163
163
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
+
164
177
run_curl () {
165
178
kubectl -n " ${NAMESPACE} " exec mysql-client -- bash -c " curl -s -k $* "
166
179
}
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ commands:
19
19
# proxy_protocol=$(run_mysql "SELECT count(*) FROM myDB.myTable" "-h $(get_haproxy_svc $(get_cluster_name)) -P 3309 -uroot -proot_password")
20
20
# args="${args} --from-literal=proxy_protocol=${proxy_protocol}"
21
21
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")
23
23
args="${args} --from-literal=mysqlx=${mysqlx}"
24
24
25
25
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