ClickHouse安装(成功安装)

1.下载安装包

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

# 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二进制文件。

3.安装

以下安装均使用rpm包进行。

切换到安装包所在目录,执行如下命令。

# deb包
sudo dpkg -i clickhouse*

安装过程打印如下:

dpkg-deb: error: 'clickhouse-client-21.10.6.2-2.noarch.rpm' is not a Debian format archive
dpkg: error processing archive clickhouse-client-21.10.6.2-2.noarch.rpm (--install):
 dpkg-deb --control subprocess returned error exit status 2
Selecting previously unselected package clickhouse-client.
(Reading database ... 88991 files and directories currently installed.)
Preparing to unpack clickhouse-client_22.8.5.29_amd64.deb ...
Unpacking clickhouse-client (22.8.5.29) ...
dpkg-deb: error: 'clickhouse-common-static-21.10.6.2-2.x86_64.rpm' is not a Debian format archive
dpkg: error processing archive clickhouse-common-static-21.10.6.2-2.x86_64.rpm (--install):
 dpkg-deb --control subprocess returned error exit status 2
Selecting previously unselected package clickhouse-common-static.
Preparing to unpack clickhouse-common-static_22.8.5.29_amd64.deb ...
Unpacking clickhouse-common-static (22.8.5.29) ...
dpkg-deb: error: 'clickhouse-common-static-dbg-21.10.6.2-2.x86_64.rpm' is not a Debian format archive
dpkg: error processing archive clickhouse-common-static-dbg-21.10.6.2-2.x86_64.rpm (--install):
 dpkg-deb --control subprocess returned error exit status 2
Selecting previously unselected package clickhouse-common-static-dbg.
Preparing to unpack clickhouse-common-static-dbg_22.8.5.29_amd64.deb ...
Unpacking clickhouse-common-static-dbg (22.8.5.29) ...
dpkg-deb: error: 'clickhouse-server-21.10.6.2-2.noarch.rpm' is not a Debian format archive
dpkg: error processing archive clickhouse-server-21.10.6.2-2.noarch.rpm (--install):
 dpkg-deb --control subprocess returned error exit status 2
Selecting previously unselected package clickhouse-server.
Preparing to unpack clickhouse-server_22.8.5.29_amd64.deb ...
Unpacking clickhouse-server (22.8.5.29) ...
Setting up clickhouse-common-static (22.8.5.29) ...
Setting up clickhouse-common-static-dbg (22.8.5.29) ...
Setting up clickhouse-server (22.8.5.29) ...
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 /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 → /lib/systemd/system/clickhouse-server.service.
Setting up clickhouse-client (22.8.5.29) ...
Errors were encountered while processing:
 clickhouse-client-21.10.6.2-2.noarch.rpm
 clickhouse-common-static-21.10.6.2-2.x86_64.rpm
 clickhouse-common-static-dbg-21.10.6.2-2.x86_64.rpm
 clickhouse-server-21.10.6.2-2.noarch.rpm

安装完成,并没有自动启动,要启动

sudo clickhouse start

然后查看状态和进程pid

sudo clickhouse status

有个进程是看门狗的。有个进程是clickhouse-server的

然后,使用clickhouse-client访问,命令如下:

clickhouse-client --password

4.连接,使用客户端连接

要想远程,<listen_host>::</listen_host>这个配置要取消注释。然后重启。就可以在我本地连接我的腾讯云主机上的clickhouse了。

相关推荐
Ai 编码助手3 小时前
MySQL中distinct与group by之间的性能进行比较
数据库·mysql
陈燚_重生之又为程序员4 小时前
基于梧桐数据库的实时数据分析解决方案
数据库·数据挖掘·数据分析
caridle4 小时前
教程:使用 InterBase Express 访问数据库(五):TIBTransaction
java·数据库·express
白云如幻4 小时前
MySQL排序查询
数据库·mysql
萧鼎4 小时前
Python并发编程库:Asyncio的异步编程实战
开发语言·数据库·python·异步
^velpro^4 小时前
数据库连接池的创建
java·开发语言·数据库
荒川之神4 小时前
ORACLE _11G_R2_ASM 常用命令
数据库·oracle
IT培训中心-竺老师4 小时前
Oracle 23AI创建示例库
数据库·oracle
小白学大数据4 小时前
JavaScript重定向对网络爬虫的影响及处理
开发语言·javascript·数据库·爬虫
time never ceases5 小时前
使用docker方式进行Oracle数据库的物理迁移(helowin/oracle_11g)
数据库·docker·oracle