This topic describes the background of introducing the feature of globally unique client session IDs, and how to configure a globally unique ID for a client session.
Background information
The current session is uniquely identified by client session ID (cs_id). At present, each of OceanBase Database Proxy (ODP) and OceanBase Database has a client session ID generation mechanism. Therefore, the client session ID generated by ODP is inconsistent with that generated by an OBServer node. When you connect to the OBServer node through ODP, ODP transmits the generated client session ID to the client during the handshake phase. As a result, the client session IDs displayed for various components are inconsistent. Therefore, a unified client session ID is required.
Prerequisites
Before you use this feature, make sure that the following conditions are met:
The version of ODP to be deployed or that has been deployed in your environment is V4.2.3 or later.
The version of OceanBase Database in your environment is V4.3.0 or later.
Procedure
You can configure this feature at the startup of ODP or modify the settings during the running of ODP. We recommend that you configure this feature at ODP startup. Modifying the settings during the running of ODP easily leads to client session ID conflicts.
(Recommended) Method 1: Configure the feature at ODP startup
Here is an example of configuring the feature at ODP startup:
-o "proxy_id=1,client_session_id_version=2"
In this example, proxy_id is set to 1. You can set it to any value within the range 0 to 8191, except 2. Make sure that the specified value is not duplicate with that of other ODPs. For more information about the proxy_id and client_session_id_version parameters, see proxy_id and client_session_id_version.
Method 2: Modify the settings during the running of ODP
Note
We recommend that you do not use this method. Modifying the client_session_id_version and proxy_id parameters during the running of ODP easily leads to client session ID conflicts.
Log in to OceanBase Database through ODP as the
root@sysuser or log in to ODP as theroot@proxysysuser.Here is an example of logging in to OceanBase Database through ODP as the
root@sysuser. For more information, see Connect to an OceanBase Database tenant by using OBClient.[admin@obtest ~]$ obclient -uroot@sys#obcluster -h10.10.10.1 -P2883 -pNotice
To use ODP commands in OceanBase Database, the IP address (specified by
-h) and the port (specified by-P) for connecting to OceanBase Database must be the IP address and listening port (specified bylisten_port) of ODP.Here is an example of logging in to ODP as the
root@proxysysuser. The IP address (specified by-h) is the IP address of ODP, and the port (specified by-P) is the listening port (specified bylisten_port) of ODP.[admin@obtest ~]$ obclient -uroot@proxysys -h10.10.10.1 -P2883 -pRun the following command to set
client_session_id_versionto2:obclient> alter proxyconfig set client_session_id_version=2;client_session_id_versionspecifies the version of the format used for generating client session IDs. To use the new calculation logic, you need to set this parameter to2.(Optional) Run the following command to set
proxy_idto1:Note
To ensure the uniqueness of client session IDs, you must set
proxy_idto different values for different ODPs. This limitation does not apply to a cluster with a single ODP.obclient> alter proxyconfig set proxy_id=1;In this example,
proxy_idis set to1. You can set it to any value within the range 0 to 8191, except 2. Make sure that the specified value is not duplicate with that of other ODPs.