This topic describes how to deploy OceanBase Database Proxy (ODP) by using obshell.
Note
ODP V4.1.0.0 and later are supported.
This API is supported starting with obshell V4.2.6.
API details
Constraints
- The node must have an agent password set. For more information, see Set a node password.
- The obshell server performs security verification on the API. For more information, see API hybrid encryption.
- The obshell must not be managing any ODP services.
- The ODP package must be decompressed and installed in the working directory.
Request path
POST /api/v1/obproxy
Request parameters
| Parameter | Type | Required | Example value | Description |
|---|---|---|---|---|
| name | string | No | myobproxy | The name of the ODP service to be deployed. |
| home_path | string | Yes | /home/admin/obproxy | The working directory of ODP, which must have read and write permissions. |
| sql_port | int | No | 2883 | The SQL port of ODP. |
| exporter_port | int | No | 2884 | The exporter port of ODP. |
| rpc_port | int | No | 2885 | The listening port for the RPC service of ODP. |
| proxyro_password | string | No | ******* | The password of the proxyro@sys user in the associated cluster. |
| obproxy_sys_password | string | No | ******* | The password of the root@proxysys user. |
| rs_list | string | No | 10.10.10.1:2881;10.10.10.2:2881 | The list of RootServices in the associated cluster. After this parameter is specified, ODP can proxy requests for the corresponding OceanBase cluster, and can proxy only this cluster. |
| config_url | string | No | http://10.10.10.1:8080/services?Action=GetObProxyConfig | The URL of obconfigserver. After this parameter is specified, ODP can proxy requests for all clusters registered with obconfigserver. |
| parameters | map[string]string | No | { "server_tcp_keepidle": "5", "enable_strict_kernel_release": "false" } |
The parameters of ODP. |
Note
You cannot specify both rs_list and config_url in the request parameters. Otherwise, an error will be returned. If neither rs_list nor config_url is specified, and the obshell node is managing an OceanBase cluster, the deployed ODP will attempt to automatically associate with the cluster.
Response parameters
| Parameter | Type | Description |
|---|---|---|
| successful | bool | Indicates whether the request was successful. |
| timestamp | time.Time | The timestamp when the server finishes the request. |
| duration | int | The time taken by the server to process the request, in milliseconds. |
| status | int | The HTTP status code that conforms to the HTTP status specification. |
| traceId | string | The Trace ID of the request. |
| data | DagDetailDTO | For more information, see the DagDetailDTO data structure section below. |
| error | ApiError | The error generated by the request, which contains the following information:
|
The data structure of DagDetailDTO is as follows:
| Parameter | Type | Description |
|---|---|---|
| id | string | The general ID of the DAG. |
| dag_id | int | The DAG ID, which is the primary key stored in OceanBase Database. |
| name | string | The name of the DAG. |
| stage | int | The current execution stage of the DAG. |
| max_stage | int | The total number of stages in the DAG execution process. |
| state | string | The execution status of the DAG. |
| operator | string | The operation type of the DAG execution. |
| start_time | time.Time | The start time of the DAG execution. |
| end_time | time.Time | The end time of the DAG execution. |
| additional_data | map[string]any | Other data of the DAG. |
| nodes | []NodeDetailDTO | The information about all nodes in the DAG. For more information, see Get the details of a node. |
Examples
Request example
POST 10.10.10.1:2886/api/v1/obproxy
This example shows a request to deploy ODP on the 10.10.10.1:2886 node, with ODP operating in rs_list mode and associated with the cluster (RootService list: 10.10.10.1:2881;10.10.10.2:2881;10.10.10.3:2881). You can modify the example based on your specific requirements.
{
"home_path": "/data/obproxy",
"name": "myobproxy",
"sql_port": 2883,
"exporter_port": 2884,
"rpc_port": 2885,
"rs_list": "10.10.10.1:2881;10.10.10.2:2881;10.10.10.3:2881",
"proxyro_password": "********",
"obproxy_sys_password": "********",
"parameters": {
"server_tcp_keepidle": "5",
"enable_strict_kernel_release": "false"
}
}
Response example
{
"successful": true,
"timestamp": "2025-03-20T15:14:17.002389679+08:00",
"duration": 97,
"status": 200,
"traceId": "55930ebf755250c8",
"data": {
"id": "40194912107080887",
"dag_id": 7,
"name": "Add obproxy",
"stage": 1,
"max_stage": 4,
"state": "READY",
"operator": "RUN",
"start_time": "2025-03-20T15:14:17.000250481+08:00",
"end_time": "2025-03-20T15:14:17.000250481+08:00",
"additional_data": null,
"nodes": null
}
}
References
In addition to using the CLI to call the API, you can also use the SDK. For more information about how to request an API method through obshell-sdk-python, see Deploy ODP.