ClickHouse单机安装

进行安装前建议配置软件和硬件文件数量、进程数量参数

 

首先查看  ulimit -a

vim /etc/security/limits.conf

修改后重启电脑:

 修改完成。

1:官网地址:使用命令行安装

https://clickhouse.tech/docs/en/getting-started/install/

 安装过程如下:

$ grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported"

sudo apt-get install apt-transport-https ca-certificates dirmngr
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4

echo "deb https://repo.clickhouse.tech/deb/stable/ main/" | sudo tee \
    /etc/apt/sources.list.d/clickhouse.list
sudo apt-get update

sudo apt-get install -y clickhouse-server clickhouse-client

sudo service clickhouse-server start
clickhouse-client
cl01@cl01-VirtualBox:~$ grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported"
SSE 4.2 supported
cl01@cl01-VirtualBox:~$ sudo apt-get install apt-transport-https ca-certificates dirmngr
[sudo] cl01 的密码: 
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
正在读取状态信息... 完成                 
ca-certificates 已经是最新版 (20210119build1)。
dirmngr 已经是最新版 (2.2.20-1ubuntu3)。
dirmngr 已设置为手动安装。
下列【新】软件包将被安装:
  apt-transport-https
升级了 0 个软件包,新安装了 1 个软件包,要卸载 0 个软件包,有 19 个软件包未被升级。
需要下载 4,776 B 的归档。
解压缩后会消耗 166 kB 的额外空间。
您希望继续执行吗? [Y/n] y
获取:1 http://cn.archive.ubuntu.com/ubuntu hirsute-updates/universe amd64 apt-transport-https all 2.2.4ubuntu0.1 [4,776 B]
已下载 4,776 B,耗时 1秒 (5,165 B/s)     
正在选中未选择的软件包 apt-transport-https。
(正在读取数据库 ... 系统当前共安装有 205316 个文件和目录。)
准备解压 .../apt-transport-https_2.2.4ubuntu0.1_all.deb  ...
正在解压 apt-transport-https (2.2.4ubuntu0.1) ...
正在设置 apt-transport-https (2.2.4ubuntu0.1) ...
cl01@cl01-VirtualBox:~$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
Executing: /tmp/apt-key-gpghome.Udc32nvazS/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4
gpg: 密钥 C8F1E19FE0C56BD4:公钥 “ClickHouse Repository Key <milovidov@yandex-team.ru>” 已导入
gpg: 处理的总数:1
gpg:               已导入:1
cl01@cl01-VirtualBox:~$ echo "deb https://repo.clickhouse.tech/deb/stable/ main/" | sudo tee \
>     /etc/apt/sources.list.d/clickhouse.list
deb https://repo.clickhouse.tech/deb/stable/ main/
cl01@cl01-VirtualBox:~$ sudo apt-get update
命中:1 http://cn.archive.ubuntu.com/ubuntu hirsute InRelease
获取:2 http://security.ubuntu.com/ubuntu hirsute-security InRelease [101 kB]
获取:3 http://cn.archive.ubuntu.com/ubuntu hirsute-updates InRelease [109 kB]               
获取:4 http://cn.archive.ubuntu.com/ubuntu hirsute-backports InRelease [101 kB]                      
获取:5 http://cn.archive.ubuntu.com/ubuntu hirsute-updates/main amd64 Packages [287 kB]
获取:6 http://cn.archive.ubuntu.com/ubuntu hirsute-backports/universe amd64 DEP-11 Metadata [9,204 B]
忽略:7 https://repo.clickhouse.tech/deb/stable main/ InRelease             
获取:8 https://repo.clickhouse.tech/deb/stable main/ Release [749 B]
获取:9 https://repo.clickhouse.tech/deb/stable main/ Release.gpg [836 B]
获取:10 https://repo.clickhouse.tech/deb/stable main/ Packages [194 kB]
已下载 802 kB,耗时 5秒 (152 kB/s) 
正在读取软件包列表... 完成
cl01@cl01-VirtualBox:~$ sudo apt-get install -y clickhouse-server clickhouse-client
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
正在读取状态信息... 完成                 
将会同时安装下列软件:
  clickhouse-common-static
建议安装:
  clickhouse-common-static-dbg
下列【新】软件包将被安装:
  clickhouse-client clickhouse-common-static clickhouse-server
升级了 0 个软件包,新安装了 3 个软件包,要卸载 0 个软件包,有 19 个软件包未被升级。
需要下载 174 MB 的归档。
解压缩后会消耗 566 MB 的额外空间。
获取:1 https://repo.clickhouse.tech/deb/stable main/ clickhouse-common-static 21.7.4.18 [174 MB]
获取:2 https://repo.clickhouse.tech/deb/stable main/ clickhouse-client 21.7.4.18 [70.0 kB]           
获取:3 https://repo.clickhouse.tech/deb/stable main/ clickhouse-server 21.7.4.18 [90.6 kB]           
已下载 174 MB,耗时 27秒 (6,512 kB/s)                                                                
正在选中未选择的软件包 clickhouse-common-static。
(正在读取数据库 ... 系统当前共安装有 205320 个文件和目录。)
准备解压 .../clickhouse-common-static_21.7.4.18_amd64.deb  ...
正在解压 clickhouse-common-static (21.7.4.18) ...
正在选中未选择的软件包 clickhouse-client。
准备解压 .../clickhouse-client_21.7.4.18_all.deb  ...
正在解压 clickhouse-client (21.7.4.18) ...
正在选中未选择的软件包 clickhouse-server。
准备解压 .../clickhouse-server_21.7.4.18_all.deb  ...
正在解压 clickhouse-server (21.7.4.18) ...
正在设置 clickhouse-common-static (21.7.4.18) ...
正在设置 clickhouse-server (21.7.4.18) ...
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.
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.
 chown --recursive clickhouse:clickhouse '/etc/clickhouse-server'
Creating log directory /var/log/clickhouse-server/.
Creating data directory /var/lib/clickhouse/.
Creating pid directory /var/run/clickhouse-server.
 chown --recursive clickhouse:clickhouse '/var/log/clickhouse-server/'
 chown --recursive 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 --recursive clickhouse-bridge:clickhouse-bridge '/usr/bin/clickhouse-odbc-bridge'
 chown --recursive clickhouse-bridge:clickhouse-bridge '/usr/bin/clickhouse-library-bridge'
Enter password for default user: 
Password for default user is empty string. See /etc/clickhouse-server/users.xml and /etc/clickhouse-server/users.d to change it.
Setting capabilities for clickhouse binary. This is optional.

ClickHouse has been successfully installed.

Start clickhouse-server with:
 sudo clickhouse start

Start clickhouse-client with:
 clickhouse-client

Synchronizing state of clickhouse-server.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable clickhouse-server
Created symlink /etc/systemd/system/multi-user.target.wants/clickhouse-server.service → /etc/systemd/system/clickhouse-server.service.
正在设置 clickhouse-client (21.7.4.18) ...

配置文件 /etc/clickhouse-serve/config.xml 让其他电脑可以访问

clickhouse status 查看clickhouse状态

clickhouse start 启动clickhouse

clickhouse restart 重启clickhouse

clickhouse-client -m 客户端连接   退出使用quit;

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值