After creating a service, you can query the service status through views.
Query service status in the sys tenant
Log in to the
systenant of the cluster as therootuser.Below is an example. Specify the parameters based on your actual environment when connecting.
obclient -h10.xx.xx.xx -P2883 -uroot@sys#obdemo -p***** -AExecute the following statement to query service information of a specified tenant in the cluster.
Example:
obclient [oceanbase]> SELECT * FROM oceanbase.CDB_OB_SERVICES WHERE TENANT_ID=1002 AND SERVICE_NAME='s_hz';Query result:
+-----------+----------------------------+----------------------------+-----------------+--------------+----------------+ | TENANT_ID | CREATE_TIME | MODIFIED_TIME | SERVICE_NAME_ID | SERVICE_NAME | SERVICE_STATUS | +-----------+----------------------------+----------------------------+-----------------+--------------+----------------+ | 1002 | 2024-06-15 17:43:08.461690 | 2024-06-15 17:43:08.461690 | 2 | s_hz | STARTED | +-----------+----------------------------+----------------------------+-----------------+--------------+----------------+Field descriptions:
TENANT_ID: the tenant ID.CREATE_TIME: the time when the service was created.MODIFY_TIME: the time when the service information was last updated.SERVICE_NAME_ID: the ID of the service, which uniquely identifies the service name.SERVICE_NAME: the name of the service.SERVICE_STATUS: the service status. Main values:STARTED: The service has been started. You can create a new session by using the service name and send requests in the session.STOPPING: The service is being stopped. The system is notifying all OBServer nodes in the tenant to stop the service, and you cannot create a new session by using the service name.STOPPED: The service has been stopped. The notification is complete. No session opened by using the service name exists, and you cannot create a new session by using the service name.
Query the service status in a user tenant
Log in to a MySQL-compatible tenant or Oracle-compatible tenant of the cluster.
Below is an example. Specify the parameters based on your actual environment when connecting.
obclient -h10.xx.xx.xx -P2883 -uroot@mysql_tenant#obdemo -p***** -AExecute the following statement to query service information of the current tenant.
MySQL-compatible modeOracle-compatible modeQuery statement in MySQL-compatible mode:
obclient [oceanbase]> SELECT * FROM oceanbase.DBA_OB_SERVICES;Query statement in Oracle-compatible mode:
obclient [SYS]> SELECT * FROM SYS.DBA_OB_SERVICES;Query result:
+----------------------------+----------------------------+-----------------+--------------+----------------+ | CREATE_TIME | MODIFIED_TIME | SERVICE_NAME_ID | SERVICE_NAME | SERVICE_STATUS | +----------------------------+----------------------------+-----------------+--------------+----------------+ | 2024-06-15 17:43:08.461690 | 2024-06-15 17:43:08.461690 | 2 | s_hz | STARTED | +----------------------------+----------------------------+-----------------+--------------+----------------+Field descriptions:
CREATE_TIME: the time when the service was created.MODIFY_TIME: the time when the service information was last updated.SERVICE_NAME_ID: the service ID, which uniquely identifies the service name.SERVICE_NAME: the service name.SERVICE_STATUS: the service status. Main values:STARTED: The service has been started. You can create a new session by using the service name and send requests in the session.STOPPING: The service is being stopped. The system is notifying all OBServer nodes in the tenant to stop the service, and you cannot create a new session by using the service name.STOPPED: The service has been stopped. The notification is complete. No session opened by using the service name exists, and you cannot create a new session by using the service name.