clickhouse centos7安装
参考:
[root@node2 local]# cd clickhouse/
[root@node2 clickhouse]# ll
总用量 0
[root@node2 clickhouse]# ll
总用量 0
[root@node2 clickhouse]# sudo yum install -y yum-utils
已加载插件:langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
base | 3.6 kB 00:00:00
docker-ce | 3.5 kB 00:00:00
docker-ce-stable | 3.5 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/3): docker-ce-stable/x86_64/primary_db | 81 kB 00:00:00
(2/3): docker-ce/x86_64/primary_db | 81 kB 00:00:01
(3/3): updates/7/x86_64/primary_db | 17 MB 00:00:29
软件包 yum-utils-1.1.31-54.el7_8.noarch 已安装并且是最新版本
无须任何处理
[root@node2 clickhouse]#
[root@node2 clickhouse]# sudo yum-config-manager --add-repo https://packages.clickhouse.com/rpm/clickhouse.repo
已加载插件:langpacks, product-id, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
adding repo from: https://packages.clickhouse.com/rpm/clickhouse.repo
grabbing file https://packages.clickhouse.com/rpm/clickhouse.repo to /etc/yum.repos.d/clickhouse.repo
repo saved to /etc/yum.repos.d/clickhouse.repo
[root@node2 clickhouse]# sudo yum install -y clickhouse-server clickhouse-client
已加载插件:langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
clickhouse-stable/signature | 821 B 00:00:00
从 https://packages.clickhouse.com/rpm/stable/repodata/repomd.xml.key 检索密钥
导入 GPG key 0x2B48D754:
用户ID : "ClickHouse Inc. Repositories Key <packages@clickhouse.com>"
指纹 : 3a9e a119 3a97 b548 be14 57d4 8919 f6bd 2b48 d754
来自 : https://packages.clickhouse.com/rpm/stable/repodata/repomd.xml.key
clickhouse-stable/signature | 1.4 kB 00:00:00 !!!
clickhouse-stable/primary | 33 kB 00:00:00
clickhouse-stable 274/274
正在解决依赖关系
--> 正在检查事务
---> 软件包 clickhouse-client.x86_64.0.22.8.2.11-1 将被 安装
--> 正在处理依赖关系 clickhouse-common-static = 22.8.2.11,它被软件包 clickhouse-client-22.8.2.11-1.x86_64 需要
---> 软件包 clickhouse-server.x86_64.0.22.8.2.11-1 将被 安装
--> 正在检查事务
---> 软件包 clickhouse-common-static.x86_64.0.22.8.2.11-1 将被 安装
--> 解决依赖关系完成
依赖关系解决
====================================================================================================================================
Package 架构 版本 源 大小
====================================================================================================================================
正在安装:
clickhouse-client x86_64 22.8.2.11-1 clickhouse-stable 75 k
clickhouse-server x86_64 22.8.2.11-1 clickhouse-stable 100 k
为依赖而安装:
clickhouse-common-static x86_64 22.8.2.11-1 clickhouse-stable 253 M
事务概要
====================================================================================================================================
安装 2 软件包 (+1 依赖软件包)
总下载量:253 M
安装大小:737 M
Downloading packages:
(1/3): clickhouse-client-22.8.2.11.x86_64.rpm | 75 kB 00:00:09
(2/3): clickhouse-server-22.8.2.11.x86_64.rpm | 100 kB 00:00:00
(3/3): clickhouse-common-static-22.8.2.11.x86_64.rpm | 253 MB 00:00:25
------------------------------------------------------------------------------------------------------------------------------------
总计 10 MB/s | 253 MB 00:00:25
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : clickhouse-server-22.8.2.11-1.x86_64 2/3Cannot set 'net_admin' or 'ipc_lock' or 'sys_nice' or 'net_bind_service' capability for clickhouse binary. This is optional. Taskstats accounting will be disabled. To enable taskstats accounting you may add the required capability later manually.
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.
Creating symlink /usr/bin/clickhouse-client to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-local 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.
Creating symlink /usr/bin/clickhouse-obfuscator to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-git-import to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-compressor 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'
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.
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
Created symlink from /etc/systemd/system/multi-user.target.wants/clickhouse-server.service to /usr/lib/systemd/system/clickhouse-server.service.
验证中 : clickhouse-common-static-22.8.2.11-1.x86_64 1/3
验证中 : clickhouse-server-22.8.2.11-1.x86_64 2/3
验证中 : clickhouse-client-22.8.2.11-1.x86_64 3/3
已安装:
clickhouse-client.x86_64 0:22.8.2.11-1 clickhouse-server.x86_64 0:22.8.2.11-1
作为依赖被安装:
clickhouse-common-static.x86_64 0:22.8.2.11-1
完毕!
[root@node2 clickhouse]# ll
总用量 0
[root@node2 clickhouse]# cd /etc/init.d/
[root@node2 init.d]# ll
总用量 52
-rwxrwxr-x. 1 root root 5238 8月 23 05:50 clickhouse-server
-rw-r--r--. 1 root root 18281 8月 19 2019 functions
-rwxr-xr-x. 1 root root 4569 8月 19 2019 netconsole
-rwxr-xr-x. 1 root root 7928 8月 19 2019 network
-rw-r--r--. 1 root root 1160 8月 7 2020 README
-rwxr-xr-x. 1 root root 1715 12月 23 2019 redis_6379
[root@node2 init.d]# cd /opt/clickhouse/data
-bash: cd: /opt/clickhouse/data: 没有那个文件或目录
[root@node2 init.d]# ll
总用量 52
-rwxrwxr-x. 1 root root 5238 8月 23 05:50 clickhouse-server
-rw-r--r--. 1 root root 18281 8月 19 2019 functions
-rwxr-xr-x. 1 root root 4569 8月 19 2019 netconsole
-rwxr-xr-x. 1 root root 7928 8月 19 2019 network
-rw-r--r--. 1 root root 1160 8月 7 2020 README
-rwxr-xr-x. 1 root root 1715 12月 23 2019 redis_6379
[root@node2 init.d]# ./clickhouse-server start
chown -R clickhouse: '/var/run/clickhouse-server/'
Will run clickhouse su 'clickhouse' /usr/bin/clickhouse-server --config-file /etc/clickhouse-server/config.xml --pid-file /var/run/clickhouse-server/clickhouse-server.pid --daemon
Waiting for server to start
Waiting for server to start
Server started
sed:无法读取 /etc/cron.d/clickhouse-server:没有那个文件或目录
[root@node2 init.d]# ll
总用量 52
-rwxrwxr-x. 1 root root 5238 8月 23 05:50 clickhouse-server
-rw-r--r--. 1 root root 18281 8月 19 2019 functions
-rwxr-xr-x. 1 root root 4569 8月 19 2019 netconsole
-rwxr-xr-x. 1 root root 7928 8月 19 2019 network
-rw-r--r--. 1 root root 1160 8月 7 2020 README
-rwxr-xr-x. 1 root root 1715 12月 23 2019 redis_6379
[root@node2 init.d]# sudo /etc/init.d/clickhouse-server start
/var/run/clickhouse-server/clickhouse-server.pid file exists and contains pid = 7087.
The process with pid = 7087 is already running.
[root@node2 init.d]# ps -ef | grep clickhouse-server
clickho+ 7086 1 0 11:51 ? 00:00:00 clickhouse-watchdog --config-file /etc/clickhouse-server/config.xml --pid-file /var/run/clickhouse-server/clickhouse-server.pid --daemon
clickho+ 7087 7086 4 11:51 ? 00:00:01 /usr/bin/clickhouse-server --config-file /etc/clickhouse-server/config.xml --pid-file /var/run/clickhouse-server/clickhouse-server.pid --daemon
root 7555 3863 0 11:52 pts/0 00:00:00 grep --color=auto clickhouse-server
[root@node2 init.d]#
[root@node2 init.d]#
[root@node2 init.d]#
[root@node2 init.d]# cd /var/log/clickhouse-server/
[root@node2 clickhouse-server]# ll
总用量 44
-rw-r-----. 1 clickhouse root 723 8月 28 11:51 clickhouse-server.err.log
-rw-r-----. 1 clickhouse root 35892 8月 28 11:52 clickhouse-server.log
-rw-------. 1 clickhouse root 451 8月 28 11:51 stderr.log
-rw-r-----. 1 clickhouse root 0 8月 28 11:51 stdout.log
[root@node2 clickhouse-server]# clickhouse-client
ClickHouse client version 22.8.2.11 (official build).
Connecting to localhost:9000 as user default.
Connected to ClickHouse server version 22.8.2 revision 54460.
Warnings:
* Linux transparent hugepages are set to "always". Check /sys/kernel/mm/transparent_hugepage/enabled
* Linux threads max count is too low. Check /proc/sys/kernel/threads-max
* Maximum number of threads is lower than 30000. There could be problems with handling a lot of simultaneous queries.
node2.cluster.local :)
node2.cluster.local :)
node2.cluster.local :)
node2.cluster.local :)
node2.cluster.local :)
node2.cluster.local :) show databases
SHOW DATABASES
Query id: 5afc4b12-0852-46ff-aeff-c862464f5952
┌─name───────────────┐
│ INFORMATION_SCHEMA │
│ default │
│ information_schema │
│ system │
└────────────────────┘
4 rows in set. Elapsed: 0.001 sec.
node2.cluster.local :)
打开,
类似mysql,这样别的远程才能访问
测试访问:
本机
web