ClickHouse is a column-based database oriented to online analysis and processing. It supports SQL query and provides good query performance. The aggregation analysis and query performance based on large and wide tables is excellent, which is one order of magnitude faster than other analytical databases.
The client has been installed in a directory, for example, /opt/client. The client directory in the following operations is only an example. Change it to the actual installation directory. Before using the client, download and update the client configuration file, and ensure that the active management node of Manager is available.
cd /opt/client
source bigdata_env
kinit Component service user
Example: kinit clickhouseuser
Run the clickhouse -h command to view the command help of ClickHouse.
The command output is as follows:
Use one of the following commands:clickhouse local [args]clickhouse client [args]clickhouse benchmark [args]clickhouse server [args]clickhouse performance-test [args]clickhouse extract-from-config [args]clickhouse compressor [args]clickhouse format [args]clickhouse copier [args]clickhouse obfuscator [args]...
Run the clickhouse client command to connect to the ClickHouse server. The port used in the following commands for connecting to the ClickHouse server is an open-source port. If a customized port is used during cluster creation, replace it by referring to FAQs. clickhouse client --host IP address of the ClickHouse instance --port 9000 --user Username --password Enter the user password. There are no default users in clusters with Kerberos authentication enabled. You must create a user on FusionInsight Manager. clickhouse client --host IP address of the ClickHouse instance --port 9440 --user Username --password --secure Enter the user password.
Run the quit; command to exit the ClickHouse server.
The following table describes the parameters of the clickhouse client command.
Parameter | Description |
|---|---|
--host | Host name of the server. The default value is localhost. You can use the host name or IP address of the node where the ClickHouse instance is located. NOTE: You can log in to FusionInsight Manager and choose Cluster > Services > ClickHouse > Instance to obtain the service IP address of the ClickHouseServer instance. |
--port | Port for connection.
|
--user | Username. You can create a user on FusionInsight Manager and bind roles to it.
|
--password | Password. The default password is an empty string. This parameter is used together with the --user parameter. You can set a password when creating a user on Manager. |
--query | Query to process when using non-interactive mode. |
--database | Current default database. The default value is default, which is the default configuration on the server. |
--multiline | If this parameter is specified, multiline queries are allowed. (Enter only indicates line feed and does not indicate that the query statement is complete.) |
--multiquery | If this parameter is specified, multiple queries separated with semicolons (;) can be processed. This parameter is valid only in non-interactive mode. |
--format | Specified default format used to output the result. |
--vertical | If this parameter is specified, the result is output in vertical format by default. In this format, each value is printed on a separate line, which helps to display a wide table. |
--time | If this parameter is specified, the query execution time is printed to stderr in non-interactive mode. |
--stacktrace | If this parameter is specified, stack trace information will be printed when an exception occurs. |
--config-file | Name of the configuration file. |
--secure | If this parameter is specified, the server will be connected in SSL mode. |
--history_file | Path of files that record command history. |
--param_<name> | Query with parameters. Pass values from the client to the server. |
Check whether the current cluster is a customized port. (Set Component Port to Custom when creating a cluster.) . If the port is customized, replace the port used in the command for connecting to the ClickHouse component client with the customized default port in the following table.
Parameter | Default Open Source Port | Default Custom Port | Port Description |
|---|---|---|---|
interserver_http_port | 9009 | 9009 | HTTP port for the communication between ClickHouse servers. |
interserver_https_port | 9010 | 9010 | HTTPS port for the communication between ClickHouse servers. |
http_port | 8123 | 8123 | Port for connecting to the ClickHouse server through HTTP. |
https_port | 8443 | 8443 | Port for connecting to the ClickHouse server through HTTPS. |
tcp_port | 9000 | 9000 | Port for connecting the client to the ClickHouse server through TCP. |
tcp_port_secure | 9440 | 9440 | Port for connecting the client to the ClickHouse server through TCP SSL. |
lb_tcp_port | 21424 | 21424 | TCP port listened by ClickHouseBalancer |
lb_http_port | 21425 | 21425 | HTTP port listened by ClickHouseBalancer |
lb_https_port | 21426 | 21426 | HTTPS port listened by ClickHouseBalancer |
lb_tcp_secure_port | 21428 | 21428 | TCP SSL port listened by ClickHouseBalancer |