foreword
Install and configure Clickhouse based on Linux server environment
Install
First create the clickhouse folder under the /opt/software folder
cd /opt/software
mkdir clickhouse
cd clickhouse
Then go to the clickhouse official website to download the installation file: URL
There are four files to download in total, xxx is the version number:
clickhourse-client-xxx.noarch.rpm
clickhourse-common-static-xxx.x86-64.rpm
clickhourse-common-static-dbg-xxx.x86-64.rpm
clickhourse-server-xxx.noarch.rpm
After downloading, upload it to the clickhouse folder of the server, or use wget directly, and then you can install it
rpm -ivh *.rpm
Here is a brief introduction to the various folders of clickhouse, and its various files are scattered in different places in the system
bin/ => /usr/bin
conf/ => /etc/clickhouse-server/
lib/ => /var/lib/clickhouse
log/ => /var/log/clickhouse
Of course, these paths can also be modified in the configuration file, so I won’t introduce more here
The next step is to modify the core configuration file
vim /etc/clickhouse-server/config.xml
The content of the file is a bit much, you can directly search for the keyword listen
Find the first <listen_host> to untie the comment, and change the content to 0.0.0.0, because clickhouse can only be accessed locally by default
Note: Some tutorials use <listen_host>::</listen_host>, if the server does not support Ipv6, an error will be reported when starting later, so it is recommended to use 0.0.0.0
After the configuration is complete, it can be started. The startup command is as follows
systemctl start clickhouse-server
After starting, no information will be printed, you can query the status of clickhouse through the command
systemctl status clickhouse-server
If the following information appears, the startup is successful
configuration password
The default user of clickhouse is default, and there is no password by default. If you need to configure a password, you can configure it in users.xml
Clickhouse encrypts the password for transmission, and the encrypted password can be generated by the following command
echo -n <需要加密的密码> | sha256sum | tr -d '-'
Copy the generated encrypted string and enter users.xml to configure the password
vim /etc/clickhouse-server/users.xml
Comment out the password in the file and add
<password_sha256_hex>加密后的密码</password_sha256_hex>
Restart clickhouse after saving
Log in to the clickhouse client with a password
clickhouse-client -u default --password xxxxxx -m
Reference article:
[Linux] linux | install clickhouse | clickhouse configuration | set password | version upgrade
Error records caused by some configurations encountered by ClickHouse