环境介绍
名称 |
版本 |
操作系统 |
Centos7.9 |
ClickHouse版本 |
21.9.7.2 |
主机IP |
192.168.1.100 |
操作系统准备工作
准备clickhouse数据盘
及挂载
1 2 3 4 5 6 7 8 9 10
| pvcreate /dev/sdb vgcreate data /dev/sdb lvcreate --name data_01 -l 100%FREE data mkfs.ext4 /dev/mapper/data-data_01 mkdir -p /data/clickhouse
cat >> /etc/fstab<<EOF /dev/mapper/data-data_01 /data ext4 defaults,noatime 0 EOF mount -a
|
修改
系统文件安全上限配置
及安装依赖
1 2 3 4 5 6 7
| $ vim /etc/security/limits.conf * soft nofile 65536 * hard nofile 65536 * soft nproc 131072 * hard nproc 131072
$ yum install -y libtool *unixODBC*
|
开始离线安装
https://repo.yandex.ru/clickhouse/rpm/stable/x86_64
下载离线rpm安装包,clickhouse-client*
、clickhouse-common-static*
、clickhouse-common-static-dbg*
、
clickhouse-server*
这四个安装包的版本要一致
我这里安装的是21.9.7.2
版本,下面是下载地址
1 2 3 4 5 6
| $ cd /usr/local/src wget https://repo.yandex.ru/clickhouse/rpm/stable/x86_64/clickhouse-client-21.9.7.2-2.noarch.rpm wget https://repo.yandex.ru/clickhouse/rpm/stable/x86_64/clickhouse-common-static-21.9.7.2-2.x86_64.rpm wget https://repo.yandex.ru/clickhouse/rpm/stable/x86_64/clickhouse-common-static-dbg-21.9.7.2-2.x86_64.rpm wget https://repo.yandex.ru/clickhouse/rpm/stable/x86_64/clickhouse-server-21.9.7.2-2.noarch.rpm wget https://repo.yandex.ru/clickhouse/rpm/stable/x86_64/clickhouse-test-21.9.7.2-2.noarch.rpm
|
执行安装
1 2 3 4 5
| $ yum install -y ./*.rpm
chown -R clickhouse:clickhouse /data/clickhouse/ && chmod 700 /data/clickhouse/
|
修改server.xml
配置
1 2 3 4 5 6
| $ vim /etc/clickhouse-server/config.xml
<listen_host>0.0.0.0</listen_host>
|
修改users.xml
文件,配置
连接用户密码
。
1 2 3
| $ vim /etc/clickhouse-server/users.xml
<password>putianhui</password>
|
服务启停管理命令
1 2 3 4
| $ /etc/init.d/clickhouse-server start $ /etc/init.d/clickhouse-server restart $ /etc/init.d/clickhouse-server stop $ /etc/init.d/clickhouse-server status
|
终端clickhouse-client命令
连接
1 2
| $ clickhouse-client -m --password 输入密码:putianhui
|
第三方Gui工具
连接
1 2
| 连接地址:192.168.1.100:8123 账号密码:default/putianhui
|
服务目录
数据目录
日志目录
1
| /var/log/clickhouse-server/clickhouse-server.log
|