Links

3 - Upgrade

How to upgrade Memphis on K8S

Best practice procedure for production environments

Step 1: Deploy the new Memphis server in parallel to the existing one

Step 2: Create a second connection for the consumers

Create a second connection and consumer entities in each existing consumer to the newly created Memphis, so the consumers will consume messages from both the existing Memphis and the newer version.

Step 3: Shift the producers to the newer version

Reconnect the producers to produce messages to the newly created Memphis.

Step 4: Disconnect the old consumer connections

Once all the existing messages on the older memphis server are read, it is safe to disconnect the older memphis connections and complete the migration.

One-to-one replacement: After v1.0.0 (Included)

Step 0: Obtain user-supplied values.

helm get values memphis --namespace memphis

Step 1: Obtain the credentials of your current deployment.

export CT=$(kubectl get secret --namespace "memphis" memphis-creds -o jsonpath="{.data.CONNECTION_TOKEN}" | base64 -d)
export ROOT_PASSWORD=$(kubectl get secret --namespace "memphis" memphis-creds -o jsonpath="{.data.ROOT_PASSWORD}" | base64 -d)
export PASSWORD=$(kubectl get secret --namespace "memphis" memphis-metadata -o jsonpath="{.data.password}" | base64 -d)
export REPMGR_PASSWORD=$(kubectl get secret --namespace "memphis" memphis-metadata -o jsonpath="{.data.repmgr-password}" | base64 -d)
export ADMIN_PASSWORD=$(kubectl get secret --namespace "memphis" memphis-metadata-coordinator -o jsonpath="{.data.admin-password}" | base64 -d)
export ENCRYPTION_SECRET_KEY=$(kubectl get secret --namespace "memphis" memphis-creds -o jsonpath="{.data.ENCRYPTION_SECRET_KEY}" | base64 -d)

Step 2: Uninstall existing helm installation

helm uninstall memphis --namespace memphis
Data will not be lost! PVCs are not removed and will be re-attached to the new installation

Step 3: Upgrade Memphis helm repo

helm repo update

Step 4: Reinstall Memphis

Production
Production-grade Memphis with a minimum of three memphis brokers configured in cluster-mode. Add user-supplied values if necessary.
helm repo add memphis https://k8s.memphis.dev/charts/ --force-update &&
helm install memphis --set global.cluster.enabled="true",metadata.postgresql.password=$PASSWORD,metadata.postgresql.repmgrPassword=$REPMGR_PASSWORD,metadata.pgpool.adminPassword=$ADMIN_PASSWORD,memphis.creds.connectionToken=$CT,memphis.creds.rootPwd=$ROOT_PASSWORD,memphis.creds.encryptionSecretKey=$ENCRYPTION_SECRET_KEY memphis/memphis --create-namespace --namespace memphis --wait
Dev
Standalone installation of Memphis with a single broker. Add user-supplied values if necessary.
helm repo add memphis https://k8s.memphis.dev/charts/ --force-update &&
helm install memphis --set metadata.postgresql.password=$PASSWORD,metadata.postgresql.repmgrPassword=$REPMGR_PASSWORD,metadata.pgpool.adminPassword=$ADMIN_PASSWORD,memphis.creds.connectionToken=$CT,memphis.creds.rootPwd=$ROOT_PASSWORD,memphis.creds.encryptionSecretKey=$ENCRYPTION_SECRET_KEY memphis/memphis --create-namespace --namespace memphis --wait

Upgrade Memphis cluster with "helm upgrade" using a manual rolling upgrade

Step 0: Obtain user-supplied values.

helm get values memphis --namespace memphis

Step 1: Obtain the credentials of your current deployment

export CT=$(kubectl get secret --namespace "memphis" memphis-creds -o jsonpath="{.data.CONNECTION_TOKEN}" | base64 -d)
export ROOT_PASSWORD=$(kubectl get secret --namespace "memphis" memphis-creds -o jsonpath="{.data.ROOT_PASSWORD}" | base64 -d)
export PASSWORD=$(kubectl get secret --namespace "memphis" memphis-metadata -o jsonpath="{.data.password}" | base64 -d)
export REPMGR_PASSWORD=$(kubectl get secret --namespace "memphis" memphis-metadata -o jsonpath="{.data.repmgr-password}" | base64 -d)
export ADMIN_PASSWORD=$(kubectl get secret --namespace "memphis" memphis-metadata-coordinator -o jsonpath="{.data.admin-password}" | base64 -d)
export ENCRYPTION_SECRET_KEY=$(kubectl get secret --namespace "memphis" memphis-creds -o jsonpath="{.data.ENCRYPTION_SECRET_KEY}" | base64 -d)

Step 2: Delete the statefulset with cascade=orphan option

kubectl delete statefulset memphis --cascade=orphan -n memphis

Step 3: Run helm upgrade with all the values you need + updateStrategy=OnDelete

helm repo add memphis https://k8s.memphis.dev/charts/ --force-update &&helm upgrade --install memphis --set metadata.postgresql.password=$PASSWORD,metadata.postgresql.repmgrPassword=$REPMGR_PASSWORD,metadata.pgpool.adminPassword=$ADMIN_PASSWORD,memphis.creds.connectionToken=$CT,memphis.creds.rootPwd=$ROOT_PASSWORD,memphis.creds.encryptionSecretKey=$ENCRYPTION_SECRET_KEY memphis/memphis --create-namespace --namespace memphis --wait

Step 4: Upgrade brokers. Delete one by one and validate each one to get back to the online state.

One-to-one replacement: Before v1.0.0 (Not included)

Step 0: Obtain user-supplied values.

helm get values memphis --namespace memphis

Step 1: Obtain the credentials of your current deployment.

export CT=$(kubectl get secret --namespace "memphis" memphis-creds -o jsonpath="{.data.CONNECTION_TOKEN}" | base64 -d)
export ROOT_PASSWORD=$(kubectl get secret --namespace "memphis" memphis-creds -o jsonpath="{.data.ROOT_PASSWORD}" | base64 -d)

Step 2: Uninstall existing helm installation

helm uninstall memphis -n memphis
Data will not be lost! PVCs are not removed and will be re-attached to the new installation

Step 3: Upgrade Memphis helm repo

helm repo update

Step 4: Reinstall Memphis

Production
Production-grade Memphis with a minimum of three memphis brokers configured in cluster-mode. Add user-supplied values if necessary.
helm repo add memphis https://k8s.memphis.dev/charts/ --force-update &&
helm install memphis --set global.cluster.enabled="true",connectionToken=$CT,rootPwd=$ROOT_PASSWORD memphis/memphis --create-namespace --namespace memphis --wait
Dev
Standalone installation of Memphis with a single broker. Add user-supplied values if necessary.
helm repo add memphis https://k8s.memphis.dev/charts/ --force-update &&
helm install memphis --set connectionToken=$CT,rootPwd=$ROOT_PASSWORD memphis/memphis --create-namespace --namespace memphis --wait
Last modified 1mo ago