Migrating SQL jobs
You can migrate your SQL jobs using the SQL Stream Builder (SSB) job migration tool. The migration tool can be used from Command Line Interface (CLI) or using the SSB REST API. The migration tool enables you to export your SQL jobs with configurations, and import them to a different cluster or deployment when needed.
You can migrate you SQL jobs either using the API Explorer or the SSB migration tool from CLI. The migration process consists of exporting and importing the details of the SQL job. No matter which migration option you choose, the underlying process is the same as both solutions are based on calling the SSB REST API endpoints. However, when using the API Explorer, you need to manual copy and paste the job details between the endpoints. The migration tool in CLI automatically takes care of accessing this information.
Before migrating your SQL jobs, you need to stop the job if it is in a running state. To stop the SQL job you can use the Stop button either under the SQL window on the Compose page, or next to the running job on the SQL Jobs tab. Make a note of the SQL job name as you need to provide it for the job migration.
- Access the API Explorer.
- Click API Explorer on the main menu of Streaming SQL Console.
- Go to SQLStreamBuilder API Explorer from Web UI. , and click
- Open the GET/api/v1/ssb/jobs/{jobsName} operation.
- Paste the copied job name to jobName.
- Provide your username.
- Click Execute.
The details about the job is exported, and returned in a JSON string. To import the job, you need to copy the JSON detail and add it to the POST request.
- Copy the JSON string.
- Open the POST/api/v1/ssb/jobs/{jobsName} operation.
- Provide a job name.
- Provide your username.
- Click Execute.
The job is imported to the Streaming SQL Console, and is listed under the SQL jobs tab with a stopped status.
- Connect to your cluster using
ssh
. - Use the following command to export the
job:
ssb-job-migration -api <cluster_hostname> -o job-export -j <jobname> -f <target_filename>
- Use the following command to import the
job:
ssb-job-migration -api <cluster_hostname> -o job-import -j <jobname> -f <source_filename>
The job is imported to the Streaming SQL Console, and is listed under the SQL jobs tab with a stopped status.
When using the migration tool in a secure environment, you need to provide your security credentials to submit the commands.- TLS/SSL enabled
- You need to provide a private CA signed certificate (global_truststore.jks) using
the
-ts
and-tspw
arguments for the truststore path and password. - Authentication
-
- For keytabs, you can use
kinit
, and then submit the job migration operation. - For Knox, you need to provide your Knox credentials with
-jt
,-pw
and-u
arguments for the Knox JWT token, password and user.
- For keytabs, you can use