Skip to content

Latest commit

 

History

History
103 lines (82 loc) · 3.58 KB

step10.md

File metadata and controls

103 lines (82 loc) · 3.58 KB
Zero Downtime Migration Lab ℹ️ For technical support, please contact us via email.
⬅️ Back Step 10 Next ➡️
Phase 5: connect directly to Target

Phase 5

🎯 Goal: instructing your client application to connect directly to Target, in order to later dispose of the whole ZDM infrastructure.

Until now we could bail out any time. After the following change we are effectively committing to the migration, with the app directly writing to Astra DB and finally skipping the ZDM (and Origin) altogether.

This step is very simple. The following command stops the running API, then restarts it by passing the appropriate setting to it:

### {"terminalId": "api", "macrosBefore": ["ctrl_c"]}
# A Ctrl-C to stop the running process ... followed by:
CLIENT_CONNECTION_MODE=ASTRA_DB uvicorn api:app

Once again, run the following, which changes the messages in the API-writing loop accordingly:

### {"terminalId": "client", "macrosBefore": ["ctrl_c"]}
while true; do
  NEW_STATUS="ModeAstra_`date +'%H-%M-%S'`";
  echo -n "Setting status to ${NEW_STATUS} ... ";
  curl -s -XPOST -o /dev/null "localhost:8000/status/eva/${NEW_STATUS}";
  echo "done. Sleeping a little ... ";
  sleep 20;
done

The API will work exactly as before and the migration is complete. At this point, you can destroy the whole ZDM infrastructure (see next step).

To ensure the application is still working as expected, you can launch yet another read request, looking for the "ModeAstra..." status messages:

### host
curl -s -XGET "localhost:8000/status/eva?entries=2" | jq -r '.[] | "\(.when)\t\(.status)"'

Conversely, on Origin, you will not see the latest entries inserted, confirming that database has really disappeared from the picture:

### host
docker exec \
  -it cassandra-origin-1 \
  cqlsh -u cassandra -p cassandra \
  -e "SELECT * FROM zdmapp.user_status WHERE user='eva' LIMIT 5;"

🏆 Congratulations: the migration is complete.

You managed to perform a Zero Downtime Migration, making sure all data (past and present) is kept consistent, with the ability to keep read performance under scrutiny at all times, and a full suite of dashboards to inspect every aspect of the migration process. The only thing left to do is cleaning up: hit "Next" to complete this exercise.

Schema, phase 5

🔎 Monitoring suggestion

The proxy has now been put aside: you can check with, the proxy instance graphs, that no requests are going through it anymore.

⬅️ Back Next ➡️