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了。

相关推荐
vvvae12343 小时前
分布式数据库
数据库
雪域迷影4 小时前
PostgreSQL Docker Error – 5432: 地址已被占用
数据库·docker·postgresql
bug菌¹4 小时前
滚雪球学Oracle[4.2讲]:PL/SQL基础语法
数据库·oracle
逸巽散人5 小时前
SQL基础教程
数据库·sql·oracle
月空MoonSky5 小时前
Oracle中TRUNC()函数详解
数据库·sql·oracle
momo小菜pa5 小时前
【MySQL 06】表的增删查改
数据库·mysql
向上的车轮6 小时前
Django学习笔记二:数据库操作详解
数据库·django
编程老船长6 小时前
第26章 Java操作Mongodb实现数据持久化
数据库·后端·mongodb
全栈师7 小时前
SQL Server中关于个性化需求批量删除表的做法
数据库·oracle
Data 3177 小时前
Hive数仓操作(十七)
大数据·数据库·数据仓库·hive·hadoop