Question
On Ververica Platform, I would like to move a Deployment from one Namespace to another, e.g. after upgrading from the Community Edition to the Stream Edition. How can this be done?
Answer
Note: This section applies to Ververica Platform Stream Edition 2.0 or later.
The following four steps will guide you through the process of moving a deployment from one namespace to another namespace:
- Stop your running deployment with a savepoint, e.g. via the "suspend" button, in the original namespace
- Note the most recent snapshot's URI, e.g. via the "Snapshots" tab, then click "Actions" for the latest savepoint, and select "Copy URI to Clipboard".
- Re-create the deployment in the new namespace:
- copy the deployment's yaml specification from the original namespace
- paste to the `Create Deployment`'s YAML editor in the new namespace
- change `spec.state` to `CANCELLED`
- make sure `restoreStrategy.kind` is either `LATEST_SAVEPOINT` or `LATEST_STATE`
- adapt `spec.deploymentTargetId` to a deployment target of your new namespace (either in the YAML editor if you know the new ID, or by switching to the Standard editor and changing it there)
- click `Create Deployment`
- Add a savepoint to the new deployment in the new namespace with the savepoint URI noted above by clicking "Add Savepoint Manually". For Ververica Platform before 2.7, you can use the REST API to add Savepoint Resource. The REST API call can also be done using the platform's swagger interface through <ververica-platform-url>/swagger:
If you now browse to the new deployment and click into the "Snapshots" tab, you should see the added savepoint under the "Next job will use the following snapshot" section.
If that is the case, you can simply start the deployment again and remove the old deployment from the original namespace after verifying the new setup is working correctly.
Note: There are a few technical details to point out:
- The new `deploymentId` will be different from the old one.
- If Universal Blob Storage is used and the savepoint location is not configured explicitly in the deployment, future savepoints will be stored under
${baseUri}/flink-savepoints/namespaces/${ns}/deployments/${deploymentId}
using the new namespace (similarly, checkpoints). - The manually created savepoint in step 4 above still references the savepoint files in the original location. Before you remove the original savepoint files, you should trigger a new savepoint in the new deployment.
- Only starting from Ververica Platform 2.5, you can delete savepoint resources if not needed.
- If you don't want lingering links to the old savepoint location and use Flink version 1.11 and above, you can also move the savepoint to the new location before step 4 above and set the savepoint URI accordingly.