原创:ClickHouse集群部署实战

1.下载安装包

下面通过阿里镜像(https://mirrors.aliyun.com/clickhouse/rpm/lts/)进行下载,下载哪里,自行指定。

# rpm包下载使用如下4行
wget https://mirrors.aliyun.com/clickhouse/rpm/lts/clickhouse-server-22.8.5.29.x86_64.rpm \
wget https://mirrors.aliyun.com/clickhouse/rpm/lts/clickhouse-client-22.8.5.29.x86_64.rpm \
wget https://mirrors.aliyun.com/clickhouse/rpm/lts/clickhouse-common-static-dbg-22.8.5.29.x86_64.rpm \
wget https://mirrors.aliyun.com/clickhouse/rpm/lts/clickhouse-common-static-22.8.5.29.x86_64.rpm

# deb包下载使用如下4行
wget https://mirrors.aliyun.com/clickhouse/deb/pool/stable/clickhouse-client_22.8.5.29_amd64.deb \
wget https://mirrors.aliyun.com/clickhouse/deb/pool/stable/clickhouse-common-static-dbg_22.8.5.29_amd64.deb \
wget https://mirrors.aliyun.com/clickhouse/deb/pool/stable/clickhouse-common-static_22.8.5.29_amd64.deb \
wget https://mirrors.aliyun.com/clickhouse/deb/pool/stable/clickhouse-server_22.8.5.29_amd64.deb

2.安装包说明

● clickhouse-common-static — ClickHouse编译的二进制文件。
● clickhouse-server — 创建clickhouse-server软连接,并安装默认配置服务
● clickhouse-client — 创建clickhouse-client客户端工具软连接,并安装客户端配置文件。
● clickhouse-common-static-dbg — 带有调试信息的ClickHouse二进制文件。

下面我已经把安装包下载打包整理好,下载解压即可安装:

  • deb安装包
链接:https://pan.baidu.com/s/12QkmaK6s08H2Db31B3Q5cw 
提取码:6j59 
  • rpm安装包
链接:https://pan.baidu.com/s/1-AqSWID3JavX5DtDhiJwzg 
提取码:r5xh 

2.安装

以下安装均使用rpm包进行。
切换到安装包所在目录,执行如下命令。

# rpm包
sudo rpm -ivh clickhouse*

# deb包
sudo dpkg -i clickhouse*

安装过程中需要设置密码,可以自行根据提示输入即可(这里默认安装用户chdba密码chdba123456),如果不设置密码可以直接回车跳过。下面是安装输入日志。

Verifying...                          ################################# [100%]
准备中...                          ################################# [100%]
正在升级/安装...
   1:clickhouse-common-static-dbg-0:22################################# [ 25%]
   2:clickhouse-common-static-0:22.8.5################################# [ 50%]
   3:clickhouse-client-0:22.8.5.29-1  ################################# [ 75%]
   4:clickhouse-server-0:22.8.5.29-1  ################################# [100%]
ClickHouse binary is already located at /usr/bin/clickhouse
Symlink /usr/bin/clickhouse-server already exists but it points to /clickhouse. Will replace the old symlink to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-server to /usr/bin/clickhouse.
Symlink /usr/bin/clickhouse-client already exists but it points to /clickhouse. Will replace the old symlink to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-client to /usr/bin/clickhouse.
Symlink /usr/bin/clickhouse-local already exists but it points to /clickhouse. Will replace the old symlink to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-local to /usr/bin/clickhouse.
Symlink /usr/bin/clickhouse-benchmark already exists but it points to /clickhouse. Will replace the old symlink to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-benchmark to /usr/bin/clickhouse.
Symlink /usr/bin/clickhouse-copier already exists but it points to /clickhouse. Will replace the old symlink to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-copier to /usr/bin/clickhouse.
Symlink /usr/bin/clickhouse-obfuscator already exists but it points to /clickhouse. Will replace the old symlink to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-obfuscator to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-git-import to /usr/bin/clickhouse.
Symlink /usr/bin/clickhouse-compressor already exists but it points to /clickhouse. Will replace the old symlink to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-compressor to /usr/bin/clickhouse.
Symlink /usr/bin/clickhouse-format already exists but it points to /clickhouse. Will replace the old symlink to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-format to /usr/bin/clickhouse.
Symlink /usr/bin/clickhouse-extract-from-config already exists but it points to /clickhouse. Will replace the old symlink to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-extract-from-config to /usr/bin/clickhouse.
Symlink /usr/bin/clickhouse-keeper already exists but it points to /clickhouse. Will replace the old symlink to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-keeper to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-keeper-converter to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-disks to /usr/bin/clickhouse.
Creating clickhouse group if it does not exist.
 groupadd -r clickhouse
Creating clickhouse user if it does not exist.
 useradd -r --shell /bin/false --home-dir /nonexistent -g clickhouse clickhouse
Will set ulimits for clickhouse user in /etc/security/limits.d/clickhouse.conf.
Creating config directory /etc/clickhouse-server/config.d that is used for tweaks of main server configuration.
Creating config directory /etc/clickhouse-server/users.d that is used for tweaks of users configuration.
Config file /etc/clickhouse-server/config.xml already exists, will keep it and extract path info from it.
/etc/clickhouse-server/config.xml has /var/lib/clickhouse/ as data path.
/etc/clickhouse-server/config.xml has /var/log/clickhouse-server/ as log path.
Users config file /etc/clickhouse-server/users.xml already exists, will keep it and extract users info from it.
Creating log directory /var/log/clickhouse-server/.
Creating data directory /var/lib/clickhouse/.
Creating pid directory /var/run/clickhouse-server.
 chown -R clickhouse:clickhouse '/var/log/clickhouse-server/'
 chown -R clickhouse:clickhouse '/var/run/clickhouse-server'
 chown  clickhouse:clickhouse '/var/lib/clickhouse/'
 groupadd -r clickhouse-bridge
 useradd -r --shell /bin/false --home-dir /nonexistent -g clickhouse-bridge clickhouse-bridge
 chown -R clickhouse-bridge:clickhouse-bridge '/usr/bin/clickhouse-odbc-bridge'
 chown -R clickhouse-bridge:clickhouse-bridge '/usr/bin/clickhouse-library-bridge'
Enter password for default user: 
Password for default user is saved in file /etc/clickhouse-server/users.d/default-password.xml.
Setting capabilities for clickhouse binary. This is optional.
 chown -R clickhouse:clickhouse '/etc/clickhouse-server'

ClickHouse has been successfully installed.

Start clickhouse-server with:
 sudo clickhouse start

Start clickhouse-client with:
 clickhouse-client --password

Synchronizing state of clickhouse-server.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable clickhouse-server
Created symlink /etc/systemd/system/multi-user.target.wants/clickhouse-server.service → /usr/lib/systemd/system/clickhouse-server.service.

到此,安装成功!常用命令如下:

# 启动|停止|重启|查看状态
systemctl start|stop|restart|status clickhouse-server.service

3.配置

3.1 设置clickhouse支持外网访问

sudo vim /etc/clickhouse-server/config.xml

# 找到<listen_host>::</listen_host>配置,将注释打开即可!
<!-- Listen specified address.
     Use :: (wildcard IPv6 address), if you want to accept connections both with IPv4 and IPv6 from everywhere.
     Notes:
     If you open connections from wildcard address, make sure that at least one of the following measures applied:
     - server is protected by firewall and not accessible from untrusted networks;
     - all users ar
  • 4
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

计算机java编程

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值