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 following list and click Download .
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 --volume /var/log/odc:/opt/odc/log \
-d -i --net host --cpu-period 100000 --cpu-quota 400000 --memory 8G --name "obodc" \
-e "DATABASE_HOST=1xx.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" \
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 |
|---|---|
| --volume | Maps the /var/log/odc directory of the host to the /opt/odc/log directory in the ODC container. If the /var/log/odc directory does not exist on the host, run the mkdir -p /var/log/odc command to create one. |
| --net | Specifies 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 domain name resolution (DNS) in the Docker container. In this case, run the --net host command to start the Docker container. |
| --cpu-period --cpu-quota | * The ---cpu-period parameter specifies the interval at which the CPU cores of the Docker container is reallocated. Unit: microseconds. * The ---cpu-quota parameter specifies the maximum time for running the current Docker container in this interval. Unit: microseconds. You can use these two parameters in combination to specify the number of CPU cores that the Docker container uses. The value is calculated by dividing cpu-quota by cpu-period. In the preceding sample statement, the values of cpu-quota and cpu-period are respectively 400000 and 100000, indicating that the Docker container can use at most four CPU cores. |
| --memory | Specifies the maximum memory size for the Docker container. |
| --name | Specifies the name of the container. |
| DATABASE_HOST | Specifies the IP address of the MetaDB. |
| DATABASE_PORT | Specifies the port number of the MetaDB. |
| DATABASE_USERNAME | Specifies the username of the MetaDB. In OceanBase Database, the username is given in the db_user@tenant_name#cluster_name format. |
| DATABASE_PASSWORD | Specifies the password for connecting to the database. |
| DATABASE_NAME | Specifies the name of the MetaDB. |
| ODC_PROFILE_MODE | Specifies the mode. Default value: alipay. |
In addition to the preceding parameters, you can also use the following parameters when running the image.
| Parameter | Description |
|---|---|
| ODC_LOG_DIR | Specifies the log directory. Default value: /opt/odc/log. |
| OBCLIENT_WORK_DIR | Specifies the working directory of OBClient. Default value: /opt/odc/data. |
| ODC_JAR_FILE | Specifies the directory of JAR files. Default value: /opt/odc/lib/odc-web-starter-*.jar. |
| ODC_WORK_DIR | Specifies the working directory of ODC. Default value: /opt/odc/script. |
| ODC_JVM_HEAP_OPTIONS | Specifies the JVM stack memory. The default maximum value of the parameter -Xmx is 60% of available physical memory size. ODC checks whether the available memory in the current environment reaches 2048 MB before it starts a script. Assume that this parameter is set to 60%, the available memory must be at least 3.4 GB to start the script. If the available memory of the host or Docker container is less than 3.4 GB, you can set the ODC_JVM_HEAP_OPTIONS parameter to, for example, "-Xmx2048m -Xms2048m" to skip memory check. |
| ODC_JVM_GC_OPTIONS | Specifies the garbage collection policy for JVM. Default policy: -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 | Specifies the OutOfMemory policy for JVM. Default value: -XX:+ExitOnOutOfMemoryError. |
| ODC_JVM_EXTRA_OPTIONS | Specifies other JVM configuration parameters. By default, no parameter is specified. |
| ODC_SERVER_PORT | Specifies the HTTP listening port for ODC Server. Default value: 8989. |