- You have started Mlflow with a postgres database you want to upgrade
- Open a terminal
- Check that your database is running correctly - its pod name is usually
mlflow-db-0
and we'll use this name is the next steps.
kubectl get pods | grep mlflow
- Retrieve the database name, username and password for connection.
One way to do this is by checking the description of the Mlflow pod and retrieving the backend store URI. It looks like this :postgresql://[username]:[password]@[host]:[port]/[database]
kubectl describe pod mlflow-xxxx-xxx-xx | grep -i backend-store-uri
You should get the following result : --backend-store-uri=postgresql://username:mypassword@mlflow-db:5432/mlflow
5. Let's save your data
kubectl exec -it mlflow-db-0 -- pg_dump mlflow -U [username] -O -F c -v -f tmp/dump.backup
- Retrieve the dump
kubectl cp [namespace]/mlflow-db-0:tmp/dump.backup dump.backup
⚠️ Check that you have the file with expected content in your workspace - be careful as the next step is irreversible- Uninstall mlflow and delete the volume associated with your database
helm ls
helm uninstall mlflow-xxxxx
kubectl get pvc
kubectl delete pvc data-mlflow-db-0
- Start a new mlflow instance with the upgraded version of postgres
- Restore the data - refer to step 4 if you do not know your connection credentials
kubectl cp dump.backup [namespace]/mlflow-db-0:/tmp/dump.backup
kubectl exec -it mlflow-db-0 -- pg_restore -h mlflow-db -p 5432 -d mlflow -U [username] -v tmp/dump.backup
Do not forget to clean 🧹
kubectl exec -it mlflow-db-0 -- rm /tmp/dump.backup
- Enjoy 🙂