Creating a service instance for Data
Replication with the cpd-cli
service-instance
create command
When you install Data
Replication, a service instance is created
automatically. You can optionally create more service instances in the operands
project. If you are aIBM® Software Hub user, you can use
the cpd-cli
service-instance
create command to script the process of creating
service instances.
- Who needs to complete this task?
- To create a service instance by using the
cpd-cli, you must have the Create service instances (can_provision) permission in IBM Software Hub.
- When do you need to complete this task?
- Complete this task only if you want to create a service instance from the
cpd-cliby using thecpd-cli service-instance createcommand.
Alternative methods for creating a service instance
- From the web client. For more information, see Creating a service instance for Data Replication from the web client.
- By using the
/v3/service_instancesREST API call. For more information, see Creating a service instance for Data Replication programmatically.
Information you need to complete this task
Review the following information before you create a service instance for Data Replication:
- Version requirements
-
All of the components that are associated with an instance of IBM Software Hub must be installed or created at the same release. For example, if Data Replication is installed at Version 5.1.3, you must create the service instance at Version 5.1.3.
- Environment variables
-
The commands in this task use environment variables so that you can run the commands exactly as written.
- If you don't have the script that defines the environment variables, see Setting up installation environment variables.
- To use the environment variables from the script, you must source the environment variables
before you run the commands in this task. For example,
run:
source ./cpd_vars.sh
Before you begin
This task assumes that the following prerequisites are met:
| Prerequisite | Where to find more information |
|---|---|
| Data Replication is installed. | If this task is not complete, see Installing Data Replication. |
The cpd-cli command-line interface is installed on the
workstation from which you will create the service instance. |
If this task is not complete, see Setting up a client workstation. |
| You created a IBM Software Hub user profile on the
workstation from which you will create the service instance. The profile must be associated with a
user who has the Create service instances ( |
If this task is not complete, see Creating a profile to use the cpd-cli management commands. |
Procedure
Complete the following tasks to create a service instance:
Creating a service instance
To create a service instance:
- Change to the directory on your workstation where you want to create the JSON file that defines the service instance payload.
- Set the environment variables that are used to populate the JSON payload
for the service instance:
- Set the
INSTANCE_NAMEenvironment variable to the unique name that you want to use as the display name for the service instance:export INSTANCE_NAME="<display-name>"This name is displayed on the Instances page of the IBM Software Hub web client.
The display name is a
stringand can contain alphanumeric characters (a-z, A-Z, 0-9), spaces ( ), dashes (-), underscores (_), and periods (.). Make sure that you surround the display name with quotation marks, as shown in the precedingexportcommand. - Set the
INSTANCE_DESCRIPTIONenvironment variable to the description that you want to use for the service instance:export INSTANCE_DESCRIPTION="<description>"This description is displayed on the Instances page of the IBM Software Hub web client.
The description is a
stringand can contain alphanumeric characters, spaces, dashes, underscores, and periods. Make sure that you surround the display name with quotation marks, as shown in the precedingexportcommand. - Set the
INSTANCE_VERSIONenvironment variable to the version that corresponds to the version of IBM Software Hub on your cluster:export INSTANCE_VERSION=<version>Use the following table to determine the appropriate value:
IBM Software Hub version Service instance version 5.1.3 5.1.3 5.1.2 5.1.2 5.1.1 5.1.1 5.1.0 5.1.0 - Set the
INSTANCE_SIZEenvironment variable. The size determines the resources that are allocated to the service instance.export INSTANCE_SIZE=<size>Valid values are:small_mincpureqsmallmediumlarge
For more information about the resources associated with each size, see the component scaling guidance PDF, which you can download from the IBM Entitled Registry.
- Set the
STORAGE_SIZEenvironment variable based on the size of your transactions:export STORAGE_SIZE=<integer>Specify a value between 10 GB and 512 GB. Specify the value as an integer. Omit the unit of measurement.
- Set the
INSTANCE_OWNERenvironment variable to your IBM Software Hub username:export INSTANCE_OWNER=<username>
- Set the
- Create the
data-replication-instance.jsonpayload file:cat << EOF > ./data-replication-instance.json{ "addon_type": "data-replication", "display_name": "${INSTANCE_NAME}", "namespace": "${PROJECT_CPD_INST_OPERANDS}", "addon_version": "${INSTANCE_VERSION}", "create_arguments": { "description": "${INSTANCE_DESCRIPTION}", "metadata": { "blockStorageClass": "${STG_CLASS_BLOCK}", "scaleConfig": "${INSTANCE_SIZE}" }, "owner_username": "${INSTANCE_OWNER}", "parameters": { "blockStorageClass": "${STG_CLASS_BLOCK}", "scaleConfig": "${INSTANCE_SIZE}", "storageSize": "${STORAGE_SIZE}" }, "resources": { } }, "pre_existing_owner": false, "transientFields": { } } EOFThe following environment variables use the values that are already defined in your installation environment variables script:${PROJECT_CPD_INST_OPERANDS}${STG_CLASS_BLOCK}
- Set the
PAYLOAD_FILEenvironment variable to the fully qualified name of the JSON payload file on your workstation:export PAYLOAD_FILE=<fully-qualified-JSON-file-name> - Create the service instance from the payload
file:
cpd-cli service-instance create \ --profile=${CPD_PROFILE_NAME} \ --from-source=${PAYLOAD_FILE}
Validating that the service instance was created
To validate that the service instance was created, run the following command:
cpd-cli service-instance status ${INSTANCE_NAME} \
--profile=${CPD_PROFILE_NAME} \
--output=json
- If the command returns
PROVISIONED, the service instance was successfully created. - If the command returns
PROVISION_IN_PROGRESS, wait a few minutes and run the command again. - If the command returns
FAILED, review the pod logs for thezen-core-apiandzen-watcherpods for possible causes.
What to do next
The service instance is ready to use. To work with the Data Replication service, see Getting started with Data Replication.