Physical connections refer to network connections. This topic describes two methods that you can use to query network connections on OceanBase Database Proxy (ODP).
Execute the
SHOW PROCESSLISTstatement to query the number of sessions of the current tenant and the session IDs.Here is an example:
obclient> SHOW PROCESSLIST; +------------+--------+------+-----------------------+-----------+-------------+-------------------+-------------------+-------+-------+ | Id | Tenant | User | Host | db | trans_count | svr_session_count | state | tid | pid | +------------+--------+------+-----------------------+-----------+-------------+-------------------+-------------------+-------+-------+ | 2147549229 | sys | root | XXX.XXX.XXX.XXX:48292 | oceanbase | 97 | 1 | MCS_ACTIVE_READER | 14531 | 14531 | +------------+--------+------+-----------------------+-----------+-------------+-------------------+-------------------+-------+-------+ 1 row in set (0.01 sec)The following table describes the parameters in the returned results.
Parameter Description Id The ID of the client session on ODP. This parameter is equivalent to the cs_idparameter.Tenant The tenant name. User The username. Host The IP address and port number of the source. db The database. trans_count The number of transactions transmitted by the ODP. svr_session_count The number of client sessions. state The status of the client session. Valid values: MCS_INIT: being initializedMCS_ACTIVE_READER: activeMCS_KEEP_ALIVE: aliveMCS_HALF_CLOSE: half-closedMCS_CLOSED: closed
tid The thread ID. pid The process ID. Execute the
SHOW PROXYNET CONNECTIONstatement to query the detailed internal attributes of all network connections on the ODP.SQL syntax:
SHOW PROXYNET CONNECTION [thread_id [LIMIT xx]]Note
If
thread_idis not specified, the detailed internal attributes of all network connections on ODP are returned.If
thread_idis specified, the detailed internal attributes of network connections on the specified thread are returned. You can also specifyLIMIT [offset,] rowsorLIMIT rows OFFSET offset. The formats of these two parameters are fully compatible with those of MySQL. If you specify thatrows == -1, all rows are returned.
Here is an example:
obclient> SHOW PROXYNET CONNECTION\G *************************** 1. row *************************** thread_id: 0 connect_id: 1 socket_fd: 4 type: inner connected src_ip: XXX.XXX.XXX.XXX src_port: 43051 dst_ip: XXX.XXX.XXX.XXX dst_port: 13203 virtual_ip: *Not IP address [0]* virtual_port: 0 bind_style: any read_enabled: 1 read_nbytes: 9223372036854775807 read_ndone: 0 write_enabled: 0 write_nbyte: 0 write_ndone: 0 alive_time(sec): 2864 activity_timeout_in(sec): 0 inactivity_timeout_in(sec): 28800 timeout_close_in(sec): 28791 last_error_no: 0 shutdown: 0 comments: not closed *************************** 2. row *************************** thread_id: 0 connect_id: 3 socket_fd: 24 type: accepted src_ip: XXX.XXX.XXX.XXX src_port: 48292 dst_ip: XXX.XXX.XXX.XXX dst_port: 13205 virtual_ip: *Not IP address [0]* virtual_port: 0 bind_style: any read_enabled: 1 read_nbytes: 9223372036854775807 read_ndone: 0 write_enabled: 0 write_nbyte: 0 write_ndone: 0 alive_time(sec): 1214 activity_timeout_in(sec): 0 inactivity_timeout_in(sec): 30 timeout_close_in(sec): 29 last_error_no: 0 shutdown: 0 comments: not closed *************************** 3. row *************************** thread_id: 0 connect_id: 4 socket_fd: 28 type: connected src_ip: XXX.XXX.XXX.XXX src_port: 43154 dst_ip: XXX.XXX.XXX.XXX dst_port: 13203 virtual_ip: *Not IP address [0]* virtual_port: 0 bind_style: any read_enabled: 1 read_nbytes: 9223372036854775807 read_ndone: 0 write_enabled: 0 write_nbyte: 0 write_ndone: 0 alive_time(sec): 1214 activity_timeout_in(sec): 0 inactivity_timeout_in(sec): 28800 timeout_close_in(sec): 28788 last_error_no: 0 shutdown: 0 comments: not closed *************************** 4. row *************************** thread_id: 1 connect_id: 5 socket_fd: 29 type: inner connected src_ip: XXX.XXX.XXX.XXX src_port: 43156 dst_ip: XXX.XXX.XXX.XXX dst_port: 13203 virtual_ip: *Not IP address [0]* virtual_port: 0 bind_style: any read_enabled: 1 read_nbytes: 9223372036854775807 read_ndone: 0 write_enabled: 0 write_nbyte: 0 write_ndone: 0 alive_time(sec): 1194 activity_timeout_in(sec): 0 inactivity_timeout_in(sec): 28800 timeout_close_in(sec): 28791 last_error_no: 0 shutdown: 0 comments: not closed *************************** 5. row *************************** thread_id: 3 connect_id: 2 socket_fd: 25 type: inner connected src_ip: XXX.XXX.XXX.XXX src_port: 43052 dst_ip: XXX.XXX.XXX.XXX dst_port: 13203 virtual_ip: *Not IP address [0]* virtual_port: 0 bind_style: any read_enabled: 1 read_nbytes: 9223372036854775807 read_ndone: 0 write_enabled: 0 write_nbyte: 0 write_ndone: 0 alive_time(sec): 2853 activity_timeout_in(sec): 0 inactivity_timeout_in(sec): 28800 timeout_close_in(sec): 28799 last_error_no: 0 shutdown: 0 comments: not closed 5 rows in set obclient> SHOW PROXYNET CONNECTION 0\G *************************** 1. row *************************** thread_id: 0 connect_id: 1 socket_fd: 4 type: inner connected src_ip: XXX.XXX.XXX.XXX src_port: 43051 dst_ip: XXX.XXX.XXX.XXX dst_port: 13203 virtual_ip: *Not IP address [0]* virtual_port: 0 bind_style: any read_enabled: 1 read_nbytes: 9223372036854775807 read_ndone: 0 write_enabled: 0 write_nbyte: 11958 write_ndone: 11958 alive_time(sec): 2919 activity_timeout_in(sec): 0 inactivity_timeout_in(sec): 30 timeout_close_in(sec): 30 last_error_no: 0 shutdown: 0 comments: not closed *************************** 2. row *************************** thread_id: 0 connect_id: 3 socket_fd: 24 type: accepted src_ip: XXX.XXX.XXX.XXX src_port: 48292 dst_ip: XXX.XXX.XXX.XXX dst_port: 13205 virtual_ip: *Not IP address [0]* virtual_port: 0 bind_style: any read_enabled: 1 read_nbytes: 9223372036854775807 read_ndone: 0 write_enabled: 0 write_nbyte: 0 write_ndone: 0 alive_time(sec): 1269 activity_timeout_in(sec): 0 inactivity_timeout_in(sec): 30 timeout_close_in(sec): 29 last_error_no: 0 shutdown: 0 comments: not closed *************************** 3. row *************************** thread_id: 0 connect_id: 4 socket_fd: 28 type: connected src_ip: XXX.XXX.XXX.XXX src_port: 43154 dst_ip: XXX.XXX.XXX.XXX dst_port: 13203 virtual_ip: *Not IP address [0]* virtual_port: 0 bind_style: any read_enabled: 1 read_nbytes: 9223372036854775807 read_ndone: 0 write_enabled: 0 write_nbyte: 0 write_ndone: 0 alive_time(sec): 1269 activity_timeout_in(sec): 0 inactivity_timeout_in(sec): 28800 timeout_close_in(sec): 28733 last_error_no: 0 shutdown: 0 comments: not closed 3 rows in set obclient> SHOW PROXYNET CONNECTION 0 limit 2 offset 1\G *************************** 1. row *************************** thread_id: 0 connect_id: 3 socket_fd: 24 type: accepted src_ip: XXX.XXX.XXX.XXX src_port: 48292 dst_ip: XXX.XXX.XXX.XXX dst_port: 13205 virtual_ip: *Not IP address [0]* virtual_port: 0 bind_style: any read_enabled: 1 read_nbytes: 9223372036854775807 read_ndone: 0 write_enabled: 0 write_nbyte: 0 write_ndone: 0 alive_time(sec): 1299 activity_timeout_in(sec): 0 inactivity_timeout_in(sec): 30 timeout_close_in(sec): 29 last_error_no: 0 shutdown: 0 comments: not closed *************************** 2. row *************************** thread_id: 0 connect_id: 4 socket_fd: 28 type: connected src_ip: XXX.XXX.XXX.XXX src_port: 43154 dst_ip: XXX.XXX.XXX.XXX dst_port: 13203 virtual_ip: *Not IP address [0]* virtual_port: 0 bind_style: any read_enabled: 1 read_nbytes: 9223372036854775807 read_ndone: 0 write_enabled: 0 write_nbyte: 0 write_ndone: 0 alive_time(sec): 1299 activity_timeout_in(sec): 0 inactivity_timeout_in(sec): 28800 timeout_close_in(sec): 28703 last_error_no: 0 shutdown: 0 comments: not closed 2 rows in setThe following table describes the parameters in the returned results.
Parameter Description thread_id The thread ID. connect_id The network connection ID. socket_fd The socket descriptor. type The connection status. src_ip The source IP address. src_port The source port number. dst_ip The destination IP address. dst_port The destination port number. virtual_ip The virtual IP address. virtual_port The virtual port number. bind_style The binding type. read_enabled Indicates whether the connection supports read operations. read_nbytes The number of bytes to be read. read_ndone The number of bytes that have been read. write_enabled Indicates whether the connection supports write operations. write_nbyte The number of bytes to be sent. write_ndone The number of bytes that have been sent. alive_time(sec) The duration when the connection is alive. activity_timeout_in(sec) The timeout period of the active state. inactivity_timeout_in(sec) The timeout period of the inactive state. timeout_close_in(sec) The timeout period after which the connection is closed. last_error_no The last returned error code. shutdown The number of closed network connections. comments The comment.