After you initialize the MetaDB of OceanBase Developer Center (ODC), you need to obtain and run the ODC image on each node to install ODC. The single-node deployment of ODC is completed after the image runs successfully.
Load the image
To obtain the ODC image on the host, select the required image from the Maintenance Tools of the OceanBase Download Center.
After you obtain the image, run the following command in the command-line tool to load it:
gunzip -c obodc-{$version}.tar.gz docker load
Run the image
Execute the following sample statement in the command-line tool to run the image:
#!/usr/bin/env bash
docker run -v /var/log/odc:/opt/odc/log -v /var/data/odc:/opt/odc/data \
-d -i --net host --cpu-period 100000 --cpu-quota 400000 --memory 8G --name "obodc" \
-e "DATABASE_HOST=xxx.xx.xx.xx" \
-e "DATABASE_PORT=60805" \
-e "DATABASE_USERNAME=db_user@tenant_name#cluster_name" \
-e "DATABASE_PASSWORD=******" \
-e "DATABASE_NAME=odc_metadb" \
-e "ODC_PROFILE_MODE=alipay" \
-e "ODC_ADMIN_INITIAL_PASSWORD=******" \
reg.docker.alibaba-inc.com/oceanbase/odc-server:{image_tag}
You can run the docker images command to view the {image_tag} parameter on the host after you load the image. The following table describes other parameters used in the preceding sample statement.
| Parameter | Description |
|---|---|
| -v |
|
| --net | The network configuration of the Docker container. If you set this parameter to host, the host network is directly used. You can also use the --publish (-p) parameter to configure port mapping. However, the Docker container may fail to start in some circumstances due to incorrect DNS resolution in the Docker container. In this case, run the --net host command to start the Docker container. |
| --cpu-period --cpu-quota |
|
| --memory | The maximum memory size for the Docker container. |
| --name | The name of the container. |
| DATABASE_HOST | The IP address of the MetaDB. |
| DATABASE_PORT | The port number of the MetaDB. |
| DATABASE_USERNAME | The username of the MetaDB. In OceanBase Database, the username is given in the db_user@tenant_name#cluster_name format. |
| DATABASE_PASSWORD | The password for connecting to the database. |
| DATABASE_NAME | The name of the MetaDB. |
| ODC_PROFILE_MODE | The mode. Default value: alipay. |
| ODC_ADMIN_INITIAL_PASSWORD | Specify the initial password of the ODC administrator account.
Notice |
In addition to the preceding parameters, you can also use the following parameters when running the image.
| Parameter | Description |
|---|---|
| ODC_LOG_DIR | The log directory. Default value: /opt/odc/log. |
| OBCLIENT_WORK_DIR | The working directory of OBClient. Default value: /opt/odc/data. |
| ODC_JAR_FILE | The directory of JAR files. Default value: /opt/odc/lib/odc-web-starter-*.jar. |
| ODC_WORK_DIR | The working directory of ODC. Default value: /opt/odc/script. |
| ODC_JVM_HEAP_OPTIONS | The JVM memory configuration. Default value: -XX:MaxRAMPercentage=60.0 -XX:InitialRAMPercentage=60.0, indicating that 60% of the memory is used, and the JVM memory can be customized by specifying the parameter ODC_JVM_HEAP_OPTIONS. Example: -Xmx2048m -Xms2048m, indicating that the heap memory is set to 2G. |
| ODC_JVM_GC_OPTIONS | The garbage collection (GC) strategy for JVM. Default value: -XX:+UseG1GC -XX:+PrintAdaptiveSizePolicy -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xloggc:/opt/odc/log/gc.log -XX:+UseGCLogFileRotation -XX:GCLogFileSize=50M -XX:NumberOfGCLogFiles=5. |
| ODC_JVM_OOM_OPTIONS | The OutOfMemory strategy for JVM. Default value: -XX:+ExitOnOutOfMemoryError. |
| ODC_JVM_EXTRA_OPTIONS | Other JVM parameters. By default, no parameter is specified. |
| ODC_SERVER_PORT | The HTTP listening port for ODC-Server. Default value: 8989. |
| ODC_HOST | The IP address of ODC, which can be used as the destination IP address for remote procedure calls in high-availability deployment scenarios. |
| ODC_RPC_PORT | The port number of ODC, which can be used as the destination port number for remote procedure calls in high-availability deployment scenarios.
Note |
| ODC_APP_EXTRA_ARGS | Other App parameters need to be specified. Example, --server.servlet.session.timeout=10m, indicating that the Session period is 10 minutes. The default value is empty. |
| ODC_MAPPING_PORT | The port number of the ODC runtime to avoid the problem that the port number cannot be used due to the deployment environment. This parameter is suitable for port mapping when deploying ODC in Docker. |
| ODC_APP_EXTRA_ARGS | Other App parameters need to be specified. Example, --server.servlet.session.timeout=10m, indicating that the Session period is 10 minutes. The default value is empty. |
| ODC_SERVER_RPC_PORT | The internal RPC listening port for ODC-Server. Default value: 8990. |