Skip to content

Commit 46194f4

Browse files
Merge pull request #1446 from eduolivares/bgp-wait-for-connectivity-to-tripleo-galera
mariadb_copy: wait for connectivity to TripleO Galera before sync check
2 parents 481b732 + 1f6903c commit 46194f4

2 files changed

Lines changed: 41 additions & 1 deletion

File tree

docs_user/modules/proc_migrating-databases-to-mariadb-instances.adoc

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,26 @@ $ oc wait --for condition=Ready pod/mariadb-copy-data --timeout=30s
186186

187187
.Procedure
188188

189+
. Wait for the `mariadb-copy-data` pod to reach the source TripleO Galera databases:
190+
+
191+
----
192+
for CELL in $(echo $CELLS); do
193+
MEMBERS=SOURCE_GALERA_MEMBERS_$(echo ${CELL}|tr '[:lower:]' '[:upper:]')[@]
194+
for i in "${!MEMBERS}"; do
195+
echo "Checking connectivity to the database node $i"
196+
oc rsh mariadb-copy-data mysql \
197+
-h "$i" -uroot -p"${SOURCE_DB_ROOT_PASSWORD[$CELL]}" -e 'select 1;'
198+
done
199+
done
200+
----
201+
+
202+
[NOTE]
203+
====
204+
For BGP-enabled environments, this command might take a few moments to succeed while the route to the `mariadb-copy-data` pod is advertised and propagated through the network via BGP. If the command fails, wait a few seconds and retry. The connection should succeed once the BGP route advertisement is complete.
205+
206+
For standard deployments, this command should succeed immediately.
207+
====
208+
189209
. Check that the source Galera database clusters in each cell have its members online and synced:
190210
+
191211
----
@@ -232,7 +252,7 @@ $ oc rsh mariadb-copy-data mysql -rsh "${PODIFIED_MARIADB_IP['super']}" \
232252
+
233253
[NOTE]
234254
====
235-
For BGP-enabled environments, this command might take a few moments to succeed while BGP routes are advertised and propagated through the network. The `mariadb-copy-data` pod needs to receive the route to the podified MariaDB IP address through BGP before it can establish a connection. If the command fails, wait a few seconds and retry. The connection should succeed once the BGP route advertisement is complete.
255+
For BGP-enabled environments, this command might take a few moments to succeed while the route to the `mariadb-copy-data` pod is advertised and propagated through the network via BGP. If the command fails, wait a few seconds and retry. The connection should succeed once the BGP route advertisement is complete.
236256
237257
For IPv6 environments, this command might take a few moments to succeed while the network IPv6 stack completes its setup. If the command fails, wait a few seconds and retry.
238258

tests/roles/mariadb_copy/tasks/main.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,26 @@
8686
until: _podified_db_check.rc == 0
8787
changed_when: false
8888

89+
- name: wait until TripleO Galera DBs are reachable from the mariadb-copy-data pod
90+
no_log: "{{ use_no_log }}"
91+
ansible.builtin.shell: |
92+
{{ oc_header }}
93+
{{ mariadb_members_env }}
94+
{{ mariadb_copy_shell_vars_src }}
95+
for CELL in $(echo $CELLS); do
96+
MEMBERS=SOURCE_GALERA_MEMBERS_$(echo ${CELL}|tr '[:lower:]' '[:upper:]')[@]
97+
for i in "${!MEMBERS}"; do
98+
echo "Checking connectivity to the database node $i"
99+
oc rsh mariadb-copy-data mysql \
100+
-h "$i" -uroot -p"${SOURCE_DB_ROOT_PASSWORD[$CELL]}" -e 'select 1;'
101+
done
102+
done
103+
register: _galera_db_check
104+
retries: 60
105+
delay: 3
106+
until: _galera_db_check.rc == 0
107+
changed_when: false
108+
89109
- name: check that the Galera database cluster(s) members are online and synced, for all cells
90110
no_log: "{{ use_no_log }}"
91111
ansible.builtin.shell: |

0 commit comments

Comments
 (0)