In the third section of "clickhouse column", first install a stand-alone version of clickhouse, which is the basic content for subsequent learning of multi-copy or distributed cluster installation. But the basic clickhouse does not depend on zookeeper, only the clickhouse that involves cluster deployment will use zookeeper.
1. Preparation
There may be different linux operating system distributions in the preparation part, and the operating commands used are inconsistent, but basically the same, everyone adjusts according to their own operating system (I use CentOS linux).
Open the port that clickhouse needs to use in the host firewall (default is 9000), or close the firewall.
firewall-cmd --zone=public --add-port=9000/tcp --permanent firewall-cmd --reload
CentOS has a limit on the number of open files. Usually, it is necessary to increase the number of open files according to the general practice of big data.
/etc/security/limits.conf
Add the following to the end of the file (modify if it already exists)soft nofile 65536 hard nofile 65536 soft nproc 131072 hard nproc 131072
Install dependencies
yum install -y libtool; yum install -y *unixODBC*;
CentOS cancels SELINUX
Modify `SELINUX=disabled in
/etc/selinux/config
。修改这个配置需要重启,临时生效命令
setenforce 0查询状态命令
getenforce`
2. Download and install the installation package
The official website recommends using shell scripts, or yum and apt-get to install. However, this installation method needs to be connected to the Internet. In many cases, our installation environment does not have the Internet, or the linux distributions used are inconsistent, resulting in inconsistent operation commands. Therefore, it is more general to install through the rpm installation package.
The installation package can be downloaded through this link: https://repo.yandex.ru/clickhouse/rpm/stable/x86_64/ , the version number of the installation package should be the same. like:
- clickhouse-client-21.7.9.7-2.noarch.rpm
- clickhouse-common-static-21.7.9.7-2.x86_64.rpm
- clickhouse-server-21.7.9.7-2.noarch.rpm
Plan the host of the clickhouse cluster, and put the above installation package under the unified planning directory of the cluster. Such as: /root/clickhouse. Then execute the command in this directory on each host in the cluster to perform offline installation.
rpm -ivh *.rpm;
The installation process will prompt for the default user password, just enter it and remember your password. Run the command rpm -qa|grep clickhouse
to check the installation result. The result is as follows, indicating that the installation is successful.
clickhouse-common-static-21.7.9.7-2.x86_64
clickhouse-client-21.7.9.7-2.noarch
clickhouse-server-21.7.9.7-2.noarch
After rpm installation, the default related directory is (during the installation process, a new user clickhouse will be created by default. If you do not intend to use the default directory, the modification method will be provided below. It should be noted that if you create a new custom directory, make sure that read and write permissions for the clickhouse user):
- ck script directory: /usr/bin/
ck configuration directory: /etc/clickhouse-server/
- /etc/clickhouse-server/config.xml The core configuration file for clickhouse
- ck's data directory: /var/lib/clickhouse-server
- ck's log directory: /var/log/clickhouse-server
3. Basic configuration modification
First, increase the modifiable permission of the configuration file through the following command. The default is read-only permission.
chmod u+w /etc/clickhouse-server/config.xml
- Modify /etc/clickhouse-server/config.xml. Open the XML comment of the :: configured by listen_host, so that ClickHouse can be accessed by servers other than this machine
- The log configuration is also in the file /etc/clickhouse-server/config.xml, you can modify the log level and related storage directories
- In a production environment, usually the default data storage directory needs to be changed to an independently mounted disk directory
- Modify the time zone, find the timezone tag, and modify the content to Asia/Shanghai
<timezone>Asia/Shanghai</timezone>
4. Stand-alone startup and login verification
- Start command:
clickhouse start
- Stop command:
clickhouse stop
- View the status of the current host node of clickhouse: systemctl status clickhouse-server
- Client connection command:
clickhouse-client -m
, if there is a password set, useclickhouse-client -m --password Abcd1234
- Execute the command directly
clickhouse-client --password Abcd1234 --query "show databases;"
- Remote access on the server with clickhouse client installed:
clickhouse-client -h 192.168.132.14 --port 9000 -u default --password abcd1234
Recommended reading
Limited to the length of the blog post, I will not list more exciting content one by one, it is recommended to read
"Original high-quality video and supporting documents: springboot-recorded 97 sections (free)"
Etc., etc
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。