Using the IoTDB Client
Scenario
This section describes how to use the IoTDB client in the O&M or service scenario.
Prerequisites
- The client has been installed. For example, the installation directory is /opt/client. The client directory in the following operations is only an example. Change it based on the actual installation directory onsite.
- Service component users have been created by the MRS cluster administrator. In security mode, machine-machine users need to download the keytab file. A human-machine user must change the password upon the first login.
Procedure
- Log in to the node where the client is installed as the client installation user.
- Run the following command to go to the client installation directory:
cd /opt/client
- Run the following command to configure environment variables:
source bigdata_env
- Before logging in to the IoTDB client for the first time, perform the following steps to generate a client SSL certificate:
- Run the following command to generate a client SSL certificate:
keytool -noprompt -import -alias myservercert -file ca.crt -keystore truststore.jks
After running this command, you are required to set a password.
- Copy the generated truststore.jks file to the Client installation directory/IoTDB/iotdb/conf directory.
cp truststore.jks Client installation directory/IoTDB/iotdb/conf
- Run the following command to generate a client SSL certificate:
- Log in to the IoTDB client based on the cluster authentication mode.
- Run the following command to switch to the directory where the IoTDB client running script is stored:
cd /opt/client/IoTDB/iotdb/sbin
- If Kerberos authentication is disabled for the cluster (the cluster is in normal mode), invoke the alter-cli-password.sh script to change the default password of the default user root.
sh alter-cli-password.sh IP address of the IoTDBServer instance RPC port number
- To view the IP address of the IoTDBServer instance node, log in to FusionInsight Manager and choose Cluster > Services > IoTDB > Instances.
- The IoTDBServer RPC port can be configured in the IoTDB_SERVER_RPC_PORT parameter. The default ports are as follows:
- The default open-source port number is 6667.
- The default customized port number is 22260.
Port customization/open source: When creating an LTS version cluster, you can set Component Port to Open source or Custom. If Open source is selected, the open source port is used. If Custom is selected, the customized port is used.
- The initial password of user root is root in versions earlier than MRS 3.3.0 and Iotdb@123 in MRS 3.3.3.0 and later versions.
The password must contain at least four characters in versions earlier than MRS 3.3.0 and at least eight characters in MRS 3.3.0 and later versions, and cannot contain spaces.
- Run the following command to log in to the client:
./start-cli.sh -h IP address of the IoTDBServer instance node -p IoTDBServer RPC port
After you run this command, specify the service username as required.
- To specify the service username, enter yes and enter the service username and password as prompted.
- If you will not specify the service username, enter no. In this case, you will perform subsequent operations as the user in 5.
- If you enter other information, you will log out.
- If Kerberos authentication is disabled for the cluster (the cluster is in normal mode), use the default user root to log in to the IoTDB client.
- When you log in to the client, you can configure the -maxRPC parameter to control the number of lines of execution results to be printed at a time. The default value is 1000. If the value of -maxRPC is less than or equal to 0, all results are printed at a time. This parameter is typically used to redirect SQL execution results.
- Meanwhile, you can optionally use the -disableISO8601 parameter to control the display format of the time column in the query result. If this parameter is not specified, the time is displayed in YYYYMMDDHHMMSS format. If this parameter is specified, the timestamp is displayed.
- If the SSL configuration is disabled on the server, you need to disable it on the client as follows:
cd Client installation directory/IoTDB/iotdb/conf
vi iotdb-client.env
Change the value of iotdb_ssl_enable to false, save the configuration, and exit.
To check the SSL configuration of the server, log in to FusionInsight Manager, choose Cluster > Services > IoTDB > Configurations, and search for SSL_ENABLE. Value true indicates that SSL is enabled, and value false indicates that it is disabled.
- To specify the service username, enter yes and enter the service username and password as prompted.
- After logging in to the client, you can run SQL statements.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot