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.
- Switch to the IoTDB client installation directory, for example, /opt/client.
cd /opt/client
- Run the following command to configure environment variables:
source bigdata_env
- If this is your first time logging in to the IoTDB client, perform the following steps to generate an 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
- The default RPC port number of IoTDBServer is 22260, which can be configured in the IOTDB_SERVER_RPC_PORT parameter.
- Obtain the default password of user root from the system administrator.
- 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