This topic describes how to deploy OceanBase Database Proxy (ODP) on a specified node by using obshell-sdk-python.
Note
ODP V4.1.0.0 and later are supported.
This API is supported starting with obshell V4.2.6.
Considerations
Make sure that obshell is running normally.
Make sure that ODP is not deployed on the node corresponding to the client that initiates the request.
Make sure that the agent password is set on the node corresponding to the client that initiates the request.
Sample code
from obshell import ClientSet
from obshell.auth import PasswordAuth
# Create a client instance. The node address is '10.10.10.1', the port is 2886, and the agent password is '***'.
client = ClientSet("10.10.10.1", 2886, PasswordAuth(agent_password='***'))
client.v1.add_obproxy_sync(home_path="/home/obproxy",
app_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"}
)
from obshell import ClientSet
from obshell.auth import PasswordAuth
# Create a client instance. The node address is '10.10.10.1', the port is 2886, and the agent password is '***'.
client = ClientSet("10.10.10.1", 2886, PasswordAuth(agent_password='***'))
dag = client.v1.add_obproxy(home_path="/home/obproxy",
app_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"}
)
# Wait for the task to complete.
client.v1.wait_dag_succeed(dag.generic_id)
References
For more information about the API for deploying ODP, see Deploy ODP.