Installation ClickHouse-22.10.2.11 on openEuler

一、Installation ClickHouse-22.10.2.11 on openEuler

1 地址

2 Tgz安装包​

如果您的操作系统不支持安装deb或rpm包,建议使用官方预编译的 tgz 软件包。

所需的版本可以通过 curl 或 wget 从存储库 https://github.com/ClickHouse/ClickHouse下载。

下载后解压缩下载资源文件并使用安装脚本进行安装。以下是一个最新稳定版本的安装。

# wget 下载
mkdir -p /opt/software/ClickHouse && cd /opt/software/ClickHouse
wget https://github.com/ClickHouse/ClickHouse/releases/download/v22.10.2.11-stable/clickhouse-client-22.10.2.11-amd64.tgz
wget https://github.com/ClickHouse/ClickHouse/releases/download/v22.10.2.11-stable/clickhouse-common-static-22.10.2.11-amd64.tgz
wget https://github.com/ClickHouse/ClickHouse/releases/download/v22.10.2.11-stable/clickhouse-common-static-dbg-22.10.2.11-amd64.tgz
wget https://github.com/ClickHouse/ClickHouse/releases/download/v22.10.2.11-stable/clickhouse-server-22.10.2.11-amd64.tgz

对于生产环境,建议使用最新的stable版本。

可以在GitHub页面 https://github.com/ClickHouse/ClickHouse/tags 找到它,它以后缀`-stable`标志。

3 解压

mkdir /opt/ClickHouse
tar -zxvf /opt/software/ClickHouse/clickhouse-client-22.10.2.11-amd64.tgz -C /opt/ClickHouse
tar -zxvf /opt/software/ClickHouse/clickhouse-common-static-22.10.2.11-amd64.tgz -C /opt/ClickHouse
tar -zxvf /opt/software/ClickHouse/clickhouse-common-static-dbg-22.10.2.11-amd64.tgz -C /opt/ClickHouse
tar -zxvf /opt/software/ClickHouse/clickhouse-server-22.10.2.11-amd64.tgz -C /opt/ClickHouse

4 运行 doinst.sh

# 找到 doinst.sh 并执行sh
/opt/ClickHouse/clickhouse-common-static-22.10.2.11/install/doinst.sh
/opt/ClickHouse/clickhouse-common-static-dbg-22.10.2.11/install/doinst.sh
/opt/ClickHouse/clickhouse-server-22.10.2.11/install/doinst.sh
/opt/ClickHouse/clickhouse-client-22.10.2.11/install/doinst.sh

# 运行clickhouse-server后,clickhouse会默认创建一个default的用户,让你设置密码,不设置密码可以按回车
[root@ecs-65685 ~]# /opt/ClickHouse/clickhouse-server-22.10.2.11/install/doinst.sh
ClickHouse binary is already located at /usr/bin/clickhouse
Symlink /usr/bin/clickhouse-server already exists but it points to /root/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 /root/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 /root/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 /root/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.
Cannot 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.
# 允许服务器接受来自网络的连接(默认为仅本地主机)
Allow server to accept connections from the network (default is localhost only), [y/N]: y
The choice is saved in file /etc/clickhouse-server/config.d/listen.xml.
 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.

5 启动

5.1 如果没有service,可以运行如下命令在后台启动服务

# 查看命令
[root@ecs-65685 ~]# clickhouse-server --help
usage:
clickhouse-server [OPTION] [-- [ARG]...]
positional arguments can be used to rewrite config.xml properties, for
example, --http_port=8010

-h, --help                        show help and exit
-V, --version                     show version and exit
-C<file>, --config-file=<file>    load configuration from a given file
-L<file>, --log-file=<file>       use given log file
-E<file>, --errorlog-file=<file>  use given log file for errors only
-P<file>, --pid-file=<file>       use given pidfile
--daemon                          Run application as a daemon.
--umask=mask                      Set the daemon's umask (octal, e.g. 027).
--pidfile=path                    Write the process ID of the application to given file.

# 启动
sudo /etc/init.d/clickhouse-server start

# 停止
sudo /etc/init.d/clickhouse-server stop

日志文件将输出在 /var/log/clickhouse-server 文件夹。

如果服务器没有启动,检查 /etc/clickhouse-server/config.xml 中的配置。

5.2 手动从控制台启动服务器

[root@ecs-65685 ~]# clickhouse-server --config-file=/etc/clickhouse-server/config.xml
Processing configuration file '/etc/clickhouse-server/config.xml'.
Merging configuration file '/etc/clickhouse-server/config.d/listen.xml'.
Logging trace to /var/log/clickhouse-server/clickhouse-server.log
Logging errors to /var/log/clickhouse-server/clickhouse-server.err.log
2022.11.15 20:44:35.961690 [ 4036 ] {} <Information> SentryWriter: Sending crash reports is disabled
2022.11.15 20:44:35.971273 [ 4036 ] {} <Trace> Pipe: Pipe capacity is 1.00 MiB
2022.11.15 20:44:36.120186 [ 4036 ] {} <Information> : Starting ClickHouse 22.10.2.11 (revision: 54467, git hash: d2bfcaba0022ff70075078987cf253c6e0c12183, build id: 980C6F4C7EC4672BA0D63DCE7EA99C43523A5A7E), PID 4036
2022.11.15 20:44:36.120305 [ 4036 ] {} <Information> Application: starting up
2022.11.15 20:44:36.120328 [ 4036 ] {} <Information> Application: OS name: Linux, version: 4.19.90-2003.4.0.0036.oe1.x86_64, architecture: x86_64
2022.11.15 20:44:36.130693 [ 4036 ] {} <Warning> Context: Linux transparent hugepages are set to "always". Check /sys/kernel/mm/transparent_hugepage/enabled
2022.11.15 20:44:36.131091 [ 4036 ] {} <Trace> AsynchronousMetrics: Scanning /sys/class/thermal
2022.11.15 20:44:36.131121 [ 4036 ] {} <Trace> AsynchronousMetrics: Scanning /sys/block
2022.11.15 20:44:36.131169 [ 4036 ] {} <Trace> AsynchronousMetrics: Scanning /sys/devices/system/edac
2022.11.15 20:44:36.131191 [ 4036 ] {} <Trace> AsynchronousMetrics: Scanning /sys/class/hwmon
2022.11.15 20:44:36.293811 [ 4036 ] {} <Information> Application: Integrity check of the executable successfully passed (checksum: 61AFDDE9B58A440D85A27CF2CFCBED9D)
2022.11.15 20:44:36.293932 [ 4036 ] {} <Trace> Application: Will do mlock to prevent executable memory from being paged out. It may take a few seconds.
2022.11.15 20:44:36.314733 [ 4036 ] {} <Trace> Application: The memory map of clickhouse executable has been mlock'ed, total 279.37 MiB
2022.11.15 20:44:36.316017 [ 4036 ] {} <Error> Application: DB::Exception: Effective user of the process (root) does not match the owner of the data (clickhouse). Run under 'sudo -u clickhouse'.
2022.11.15 20:44:36.316052 [ 4036 ] {} <Information> Application: shutting down
2022.11.15 20:44:36.316063 [ 4036 ] {} <Debug> Application: Uninitializing subsystem: Logging Subsystem
2022.11.15 20:44:36.316106 [ 4037 ] {} <Trace> BaseDaemon: Received signal -2
2022.11.15 20:44:36.316161 [ 4037 ] {} <Information> BaseDaemon: Stop SignalListener thread

在这种情况下,日志将被打印到控制台,这在开发过程中很方便。

如果配置文件在当前目录中,则不需要指定——config-file参数。默认情况下,它的路径为./config.xml

5.3 root 用户启动失败

检查 ClickHouse 相关的用户目录,会发现用户都是ClickHouse

ll /etc/clickhouse-server
ll /var/log/clickhouse-server
ll /var/lib/clickhouse

5.4 clickhouse 用户启动

用 clickhouse 用户来启动 clickhouse server

sudo -u 'clickhouse' /usr/bin/clickhouse-server --config-file /etc/clickhouse-server/config.xml --pid-file /var/run/clickhouse-server/clickhouse-server.pid

# 查看进程
[root@ecs-65685 ~]# ps -ef |grep clickhouse
clickho+    1803       1  0 20:17 ?        00:00:00 clickhouse-watchdog        --config=/etc/clickhouse-server/config.xml --pid-file=/run/clickhouse-server/clickhouse-server.pid
clickho+    2479    1803  5 20:17 ?        00:00:07 /usr/bin/clickhouse-server --config=/etc/clickhouse-server/config.xml --pid-file=/run/clickhouse-server/clickhouse-server.pid
root        3079    2949  0 20:19 pts/0    00:00:00 grep --color=auto clickhouse

6 root 用户启动

将 ClickHouse 相关的用户目录全部设置成 root

chown -R root:root /var/lib/clickhouse /var/log/clickhouse-server /etc/clickhouse-server /etc/clickhouse-client

6.1 使用root用户命令启动

[root@ecs-65685 ~]# sudo /etc/init.d/clickhouse-server start
 chown -R clickhouse: '/var/run/clickhouse-server/'
Will run sudo -u '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

7 命令行客户端

ClickHouse 提供了一个原生命令行客户端 clickhouse-client 客户端支持命令行。

安装部署后,系统默认会安装 clickhouse-client(同时它属于clickhouse-client安装包中)。

# 没有密码可不加 --password
[root@ecs-65685 ~]# clickhouse-client --password
ClickHouse client version 22.10.2.11 (official build).
Password for user (default):
Connecting to localhost:9000 as user default.
Connected to ClickHouse server version 22.10.2 revision 54460.

Warnings:
 * Linux transparent hugepages are set to "always". Check /sys/kernel/mm/transparent_hugepage/enabled
 * Maximum number of threads is lower than 30000. There could be problems with handling a lot of simultaneous queries.

ecs-65685 :)

不同的客户端和服务器版本彼此兼容,但是一些特性可能在旧客户机中不可用。建议使用与服务器应用相同版本的客户端。

默认情况下,使用default用户并不携带密码连接到localhost:9000

还可以使用--host参数连接到指定服务器。终端必须使用 UTF-8 编码。

二、ClickHouse 相关目录

1 命令目录

[root@ecs-65685 bin]# pwd
/usr/bin
[root@ecs-65685 bin]# ll |grep clickhouse
-r-xr-xr-x  1 root              root              401M Nov 15 15:11 clickhouse
lrwxrwxrwx  1 root              root                10 Nov 15 15:14 clickhouse-benchmark -> clickhouse
lrwxrwxrwx  1 root              root                10 Nov 15 15:14 clickhouse-client -> clickhouse
lrwxrwxrwx  1 root              root                10 Nov 15 15:14 clickhouse-compressor -> clickhouse
lrwxrwxrwx  1 root              root                19 Nov 15 15:12 clickhouse-copier -> /usr/bin/clickhouse
-rwx------  1 root              root               19M Nov 15 15:11 clickhouse-diagnostics
lrwxrwxrwx  1 root              root                19 Nov 15 15:12 clickhouse-disks -> /usr/bin/clickhouse
lrwxrwxrwx  1 root              root                19 Nov 15 15:12 clickhouse-extract-from-config -> /usr/bin/clickhouse
lrwxrwxrwx  1 root              root                10 Nov 15 15:14 clickhouse-format -> clickhouse
lrwxrwxrwx  1 root              root                19 Nov 15 15:12 clickhouse-git-import -> /usr/bin/clickhouse
lrwxrwxrwx  1 root              root                19 Nov 15 15:12 clickhouse-keeper -> /usr/bin/clickhouse
lrwxrwxrwx  1 root              root                19 Nov 15 15:12 clickhouse-keeper-converter -> /usr/bin/clickhouse
-rwx------  1 clickhouse-bridge clickhouse-bridge 134M Nov 15 15:11 clickhouse-library-bridge
lrwxrwxrwx  1 root              root                10 Nov 15 15:14 clickhouse-local -> clickhouse
lrwxrwxrwx  1 root              root                10 Nov 15 15:14 clickhouse-obfuscator -> clickhouse
-rwx------  1 clickhouse-bridge clickhouse-bridge 135M Nov 15 15:11 clickhouse-odbc-bridge
-rwx------  1 root              root              2.0K Nov 15 15:12 clickhouse-report
lrwxrwxrwx  1 root              root                19 Nov 15 15:12 clickhouse-server -> /usr/bin/clickhouse

2 配置文件目录

[root@ecs-65685 ~]# ll /etc/clickhouse-server
total 88K
dr-x------ 2 clickhouse clickhouse 4.0K Nov 15 15:14 config.d
-r-------- 1 clickhouse clickhouse  69K Nov 15 15:12 config.xml
dr-x------ 2 clickhouse clickhouse 4.0K Nov 15 15:44 users.d
-r-------- 1 clickhouse clickhouse 5.3K Nov 15 15:47 users.xml

3 日志目录

[root@ecs-65685 ~]# ll /var/log/clickhouse-server
total 1.8M
-rw-r----- 1 clickhouse clickhouse  11K Nov 15 15:47 clickhouse-server.err.log
-rw-r----- 1 clickhouse clickhouse 1.8M Nov 15 16:14 clickhouse-server.log
-rw------- 1 clickhouse clickhouse  398 Nov 15 15:17 stderr.log
-rw-r----- 1 clickhouse clickhouse    0 Nov 15 15:17 stdout.log

4 数据文件目录

[root@ecs-65685 ~]# ll /var/lib/clickhouse
total 64K
drwxr-x--- 2 clickhouse clickhouse 4.0K Nov 15 15:32 access
drwxr-x--- 2 clickhouse clickhouse 4.0K Nov 15 15:17 cores
drwxr-x--- 4 clickhouse clickhouse 4.0K Nov 15 15:32 data
drwxr-x--- 2 clickhouse clickhouse 4.0K Nov 15 15:32 dictionaries_lib
drwxr-x--- 2 clickhouse clickhouse 4.0K Nov 15 15:32 flags
drwxr-x--- 2 clickhouse clickhouse 4.0K Nov 15 15:32 format_schemas
drwxr-x--- 4 clickhouse clickhouse 4.0K Nov 15 15:32 metadata
drwxr-x--- 2 clickhouse clickhouse 4.0K Nov 15 15:32 metadata_dropped
drwxr-x--- 2 clickhouse clickhouse 4.0K Nov 15 15:32 preprocessed_configs
-rw-r----- 1 clickhouse clickhouse   60 Nov 15 15:35 status
drwxr-x--- 8 clickhouse clickhouse 4.0K Nov 15 15:49 store
drwxr-x--- 2 clickhouse clickhouse 4.0K Nov 15 15:32 tmp
drwxr-x--- 2 clickhouse clickhouse 4.0K Nov 15 15:32 user_defined
drwxr-x--- 2 clickhouse clickhouse 4.0K Nov 15 15:32 user_files
drwxr-x--- 2 clickhouse clickhouse 4.0K Nov 15 15:32 user_scripts
-rw-r----- 1 clickhouse clickhouse   36 Nov 15 15:32 uuid

 

三、允许远程访问

1 ClickHouse 默认不允许远程访问,需要修改配置文件

2 重启 ClickHouse

clickhouse restart

3 使用浏览器验证一下,服务器 IP:8123

四、使用DBeaver连接 ClickHouse

 

 

第一次链接要安装相应驱动,填写对应IP和端口,用户名,密码[没有设置可以不填]。

 

测试连接

 

五、防火墙

# 关闭防火墙
systemctl stop firewalld

firewall-cmd --zone=public --add-port=8123/tcp --permanent

# 配置立即生效
firewall-cmd --reload

# 重启防火墙生效
systemctl restart firewalld

云主机配置安全组,在入方向规则,允许8123放行。

X、One Step Success 

 

Y、Error message

1 DB::ErrnoException: Could not calculate available disk space (statvfs), errno: 13, strerror: Permission denied

[root@ecs-65685 ~]# sudo -u 'clickhouse' /usr/bin/clickhouse-server --config-file /etc/clickhouse-server/config.xml --pid-file /var/run/clickhouse-server/clickhouse-server.pid
Processing configuration file '/etc/clickhouse-server/config.xml'.
Merging configuration file '/etc/clickhouse-server/config.d/listen.xml'.
Logging trace to /var/log/clickhouse-server/clickhouse-server.log
Logging errors to /var/log/clickhouse-server/clickhouse-server.err.log
2022.11.15 15:31:21.118852 [ 314492 ] {} <Information> SentryWriter: Sending crash reports is disabled
2022.11.15 15:31:21.127975 [ 314492 ] {} <Trace> Pipe: Pipe capacity is 1.00 MiB
Code: 76. DB::ErrnoException: Cannot open file /usr/lib/debug/usr/bin/clickhouse.debug, errno: 13, strerror: Permission denied. (CANNOT_OPEN_FILE), Stack trace (when copying this message, always include the lines below):

 (version 22.10.2.11 (official build))
2022.11.15 15:31:21.175767 [ 314493 ] {} <Trace> BaseDaemon: Received signal -2
2022.11.15 15:31:21.175819 [ 314493 ] {} <Information> BaseDaemon: Stop SignalListener thread
[root@ecs-65685 ~]# ll /usr/lib/debug/usr/bin
total 3.1G
-rw------- 1 root root 1.7G Nov 15 15:11 clickhouse.debug
-rw------- 1 root root 700M Nov 15 15:12 clickhouse-library-bridge.debug
-rw------- 1 root root 705M Nov 15 15:11 clickhouse-odbc-bridge.debug
[root@ecs-65685 ~]# chown -R clickhouse:clickhouse /usr/lib/debug/usr/bin
[root@ecs-65685 ~]# ll /usr/lib/debug/usr/bin
total 3.1G
-rw------- 1 clickhouse clickhouse 1.7G Nov 15 15:11 clickhouse.debug
-rw------- 1 clickhouse clickhouse 700M Nov 15 15:12 clickhouse-library-bridge.debug
-rw------- 1 clickhouse clickhouse 705M Nov 15 15:11 clickhouse-odbc-bridge.debug
[root@ecs-65685 ~]# sudo -u 'clickhouse' /usr/bin/clickhouse-server --config-file /etc/clickhouse-server/config.xml --pid-file /var/run/clickhouse-server/clickhouse-server.pid
Processing configuration file '/etc/clickhouse-server/config.xml'.
Merging configuration file '/etc/clickhouse-server/config.d/listen.xml'.
Logging trace to /var/log/clickhouse-server/clickhouse-server.log
Logging errors to /var/log/clickhouse-server/clickhouse-server.err.log
2022.11.15 15:32:11.442704 [ 314588 ] {} <Information> SentryWriter: Sending crash reports is disabled
2022.11.15 15:32:11.452552 [ 314588 ] {} <Trace> Pipe: Pipe capacity is 1.00 MiB
2022.11.15 15:32:11.602884 [ 314588 ] {} <Information> : Starting ClickHouse 22.10.2.11 (revision: 54467, git hash: d2bfcaba0022ff70075078987cf253c6e0c12183, build id: 980C6F4C7EC4672BA0D63DCE7EA99C43523A5A7E), PID 314588
2022.11.15 15:32:11.603022 [ 314588 ] {} <Information> Application: starting up
2022.11.15 15:32:11.603047 [ 314588 ] {} <Information> Application: OS name: Linux, version: 4.19.90-2003.4.0.0036.oe1.x86_64, architecture: x86_64
2022.11.15 15:32:11.720246 [ 314588 ] {} <Warning> Context: Linux transparent hugepages are set to "always". Check /sys/kernel/mm/transparent_hugepage/enabled
2022.11.15 15:32:11.720676 [ 314588 ] {} <Trace> AsynchronousMetrics: Scanning /sys/class/thermal
2022.11.15 15:32:11.720707 [ 314588 ] {} <Trace> AsynchronousMetrics: Scanning /sys/block
2022.11.15 15:32:11.720743 [ 314588 ] {} <Trace> AsynchronousMetrics: Scanning /sys/devices/system/edac
2022.11.15 15:32:11.720764 [ 314588 ] {} <Trace> AsynchronousMetrics: Scanning /sys/class/hwmon
2022.11.15 15:32:12.467832 [ 314588 ] {} <Information> Application: Integrity check of the executable successfully passed (checksum: 61AFDDE9B58A440D85A27CF2CFCBED9D)
2022.11.15 15:32:12.468919 [ 314588 ] {} <Information> Application: It looks like the process has no CAP_IPC_LOCK capability, binary mlock will be disabled. It could happen due to incorrect ClickHouse package installation. You could resolve the problem manually with 'sudo setcap cap_ipc_lock=+ep /usr/bin/clickhouse'. Note that it will not work on 'nosuid' mounted filesystems.
2022.11.15 15:32:12.476417 [ 314588 ] {} <Debug> Application: rlimit on number of file descriptors is 1048576
2022.11.15 15:32:12.476453 [ 314588 ] {} <Debug> Application: rlimit on number of threads is 29729
2022.11.15 15:32:12.476483 [ 314588 ] {} <Warning> Context: Maximum number of threads is lower than 30000. There could be problems with handling a lot of simultaneous queries.
2022.11.15 15:32:12.476503 [ 314588 ] {} <Debug> Application: Initializing DateLUT.
2022.11.15 15:32:12.476513 [ 314588 ] {} <Trace> Application: Initialized DateLUT with time zone 'Asia/Shanghai'.
2022.11.15 15:32:12.476541 [ 314588 ] {} <Debug> Application: Setting up /var/lib/clickhouse/tmp/ to store temporary data in it
2022.11.15 15:32:12.476860 [ 314588 ] {} <Debug> Application: Configuration parameter 'interserver_http_host' doesn't exist or exists and empty. Will use 'ecs-65685' as replica host.
2022.11.15 15:32:12.476883 [ 314588 ] {} <Debug> Application: Initializing interserver credentials.
2022.11.15 15:32:12.477028 [ 314588 ] {} <Information> SensitiveDataMaskerConfigRead: 1 query masking rules loaded.
2022.11.15 15:32:12.478838 [ 314588 ] {} <Debug> ConfigReloader: Loading config '/etc/clickhouse-server/config.xml'
Processing configuration file '/etc/clickhouse-server/config.xml'.
Merging configuration file '/etc/clickhouse-server/config.d/listen.xml'.
Saved preprocessed configuration to '/var/lib/clickhouse/preprocessed_configs/config.xml'.
2022.11.15 15:32:12.481753 [ 314588 ] {} <Debug> ConfigReloader: Loaded config '/etc/clickhouse-server/config.xml', performing update on configuration
2022.11.15 15:32:12.483413 [ 314588 ] {} <Information> Application: Setting max_server_memory_usage was set to 6.56 GiB (7.29 GiB available * 0.90 max_server_memory_usage_to_ram_ratio)
2022.11.15 15:32:12.486133 [ 314588 ] {} <Information> CertificateReloader: One of paths is empty. Cannot apply new configuration for certificates. Fill all paths and try again.
2022.11.15 15:32:12.486164 [ 314588 ] {} <Debug> ConfigReloader: Loaded config '/etc/clickhouse-server/config.xml', performed update on configuration
2022.11.15 15:32:12.487887 [ 314588 ] {} <Debug> ConfigReloader: Loading config '/etc/clickhouse-server/users.xml'
Processing configuration file '/etc/clickhouse-server/users.xml'.
Merging configuration file '/etc/clickhouse-server/users.d/default-password.xml'.
Saved preprocessed configuration to '/var/lib/clickhouse/preprocessed_configs/users.xml'.
2022.11.15 15:32:12.488299 [ 314588 ] {} <Debug> ConfigReloader: Loaded config '/etc/clickhouse-server/users.xml', performing update on configuration
2022.11.15 15:32:12.488803 [ 314588 ] {} <Debug> ConfigReloader: Loaded config '/etc/clickhouse-server/users.xml', performed update on configuration
2022.11.15 15:32:12.489059 [ 314588 ] {} <Debug> Access(user directories): Added users.xml access storage 'users.xml', path: /etc/clickhouse-server/users.xml
2022.11.15 15:32:12.489141 [ 314588 ] {} <Warning> Access(local directory): File /var/lib/clickhouse/access/users.list doesn't exist
2022.11.15 15:32:12.489159 [ 314588 ] {} <Warning> Access(local directory): Recovering lists in directory /var/lib/clickhouse/access/
2022.11.15 15:32:12.489258 [ 314588 ] {} <Debug> Access(user directories): Added local directory access storage 'local directory', path: /var/lib/clickhouse/access/
2022.11.15 15:32:12.489288 [ 314588 ] {} <Information> Application: Uncompressed cache policy name
2022.11.15 15:32:12.489303 [ 314588 ] {} <Information> Application: Uncompressed cache size was lowered to 3.64 GiB because the system has low amount of memory
2022.11.15 15:32:12.491692 [ 314588 ] {} <Information> Context: Initialized background executor for merges and mutations with num_threads=16, num_tasks=32
2022.11.15 15:32:12.492037 [ 314588 ] {} <Information> Context: Initialized background executor for move operations with num_threads=8, num_tasks=8
2022.11.15 15:32:12.492434 [ 314588 ] {} <Information> Context: Initialized background executor for fetches with num_threads=8, num_tasks=8
2022.11.15 15:32:12.493313 [ 314588 ] {} <Information> Context: Initialized background executor for common operations (e.g. clearing old parts) with num_threads=8, num_tasks=8
2022.11.15 15:32:12.493499 [ 314588 ] {} <Information> Application: Mark cache size was lowered to 3.64 GiB because the system has low amount of memory
2022.11.15 15:32:12.493608 [ 314588 ] {} <Information> BackgroundSchedulePool/BgSchPool: Create BackgroundSchedulePool with 128 threads
2022.11.15 15:32:12.504101 [ 314588 ] {} <Information> DNSCacheUpdater: Update period 15 seconds
2022.11.15 15:32:12.504135 [ 314588 ] {} <Information> Application: Loading metadata from /var/lib/clickhouse/
2022.11.15 15:32:12.504220 [ 314639 ] {} <Debug> DNSResolver: Updating DNS cache
2022.11.15 15:32:12.507126 [ 314639 ] {} <Debug> DNSResolver: Updated DNS cache
2022.11.15 15:32:12.515442 [ 314588 ] {} <Information> DatabaseAtomic (system): Metadata processed, database system has 0 tables and 0 dictionaries in total.
2022.11.15 15:32:12.515469 [ 314588 ] {} <Information> TablesLoader: Parsed metadata of 0 tables in 1 databases in 8.1882e-05 sec
2022.11.15 15:32:12.515509 [ 314588 ] {} <Information> TablesLoader: Loading 0 tables with 0 dependency level
2022.11.15 15:32:12.516817 [ 314588 ] {} <Debug> SystemLog: Not creating system.text_log since corresponding section 'text_log' is missing from config
2022.11.15 15:32:12.518166 [ 314588 ] {} <Debug> SystemLog: Not creating system.filesystem_cache_log since corresponding section 'filesystem_cache_log' is missing from config
2022.11.15 15:32:12.518677 [ 314588 ] {} <Debug> SystemLog: Not creating system.zookeeper_log since corresponding section 'zookeeper_log' is missing from config
2022.11.15 15:32:12.518703 [ 314588 ] {} <Debug> SystemLog: Not creating system.session_log since corresponding section 'session_log' is missing from config
2022.11.15 15:32:12.518719 [ 314588 ] {} <Debug> SystemLog: Not creating system.transactions_info_log since corresponding section 'transactions_info_log' is missing from config
2022.11.15 15:32:12.534139 [ 314588 ] {} <Information> DatabaseCatalog: Found 0 partially dropped tables. Will load them and retry removal.
2022.11.15 15:32:12.537305 [ 314588 ] {} <Information> DatabaseAtomic (default): Metadata processed, database default has 0 tables and 0 dictionaries in total.
2022.11.15 15:32:12.537332 [ 314588 ] {} <Information> TablesLoader: Parsed metadata of 0 tables in 1 databases in 6.2905e-05 sec
2022.11.15 15:32:12.537362 [ 314588 ] {} <Information> TablesLoader: Loading 0 tables with 0 dependency level
2022.11.15 15:32:12.537376 [ 314588 ] {} <Information> DatabaseAtomic (default): Starting up tables.
2022.11.15 15:32:12.537392 [ 314588 ] {} <Information> DatabaseAtomic (system): Starting up tables.
2022.11.15 15:32:12.538464 [ 314588 ] {} <Information> UserDefinedSQLObjectsLoaderFromDisk: Loading user defined objects from /var/lib/clickhouse/user_defined/
2022.11.15 15:32:12.538510 [ 314588 ] {} <Debug> UserDefinedSQLObjectsLoaderFromDisk: User defined objects loaded
2022.11.15 15:32:12.538521 [ 314588 ] {} <Debug> Application: Loaded metadata.
2022.11.15 15:32:12.538550 [ 314588 ] {} <Trace> Pipe: Pipe capacity is 1.00 MiB
2022.11.15 15:32:12.538572 [ 314588 ] {} <Information> Application: Tasks stats provider: procfs
2022.11.15 15:32:12.538587 [ 314588 ] {} <Information> Application: It looks like the process has no CAP_SYS_NICE capability, the setting 'os_thread_priority' will have no effect. It could happen due to incorrect ClickHouse package installation. You could resolve the problem manually with 'sudo setcap cap_sys_nice=+ep /usr/bin/clickhouse'. Note that it will not work on 'nosuid' mounted filesystems.
2022.11.15 15:32:12.538902 [ 314588 ] {} <Trace> MySQLHandlerFactory: Failed to create SSL context. SSL will be disabled. Error: Poco::Exception. Code: 1000, e.code() = 0, SSL Exception: Configuration error: no certificate file has been specified (version 22.10.2.11 (official build))
2022.11.15 15:32:12.538986 [ 314588 ] {} <Trace> MySQLHandlerFactory: Failed to read RSA key pair from server certificate. Error: Code: 139. DB::Exception: Certificate file is not set. (NO_ELEMENTS_IN_CONFIG) (version 22.10.2.11 (official build))
2022.11.15 15:32:12.538998 [ 314588 ] {} <Trace> MySQLHandlerFactory: Generating new RSA key pair.
2022.11.15 15:32:12.587458 [ 314588 ] {} <Information> CertificateReloader: One of paths is empty. Cannot apply new configuration for certificates. Fill all paths and try again.
2022.11.15 15:32:12.587732 [ 314588 ] {} <Trace> AsynchronousMetrics: MemoryTracking: was 11.57 MiB, peak 15.97 MiB, will set to 526.04 MiB (RSS), difference: 505.96 MiB
2022.11.15 15:32:12.588056 [ 314588 ] {} <Information> Application: Shutting down storages.
2022.11.15 15:32:12.588156 [ 314769 ] {} <Trace> SystemLog (system.query_log): Terminating
2022.11.15 15:32:12.588244 [ 314777 ] {} <Trace> SystemLog (system.query_thread_log): Terminating
2022.11.15 15:32:12.588295 [ 314772 ] {} <Trace> SystemLog (system.part_log): Terminating
2022.11.15 15:32:12.588365 [ 314767 ] {} <Trace> SystemLog (system.trace_log): Flushing system log, 1 entries to flush up to offset 1
2022.11.15 15:32:12.588406 [ 314767 ] {} <Debug> SystemLog (system.trace_log): Creating new table system.trace_log for TraceLog
2022.11.15 15:32:12.589343 [ 314767 ] {} <Trace> StoragePolicy (default): Storage policy default created, total volumes 1
2022.11.15 15:32:12.592456 [ 314767 ] {} <Debug> system.trace_log (f608a8db-8edf-46eb-b056-149ebb09c40b): Loading data parts
2022.11.15 15:32:12.592593 [ 314767 ] {} <Information> system.trace_log (f608a8db-8edf-46eb-b056-149ebb09c40b): Found 0 parts for disk 'default' to load
2022.11.15 15:32:12.592629 [ 314767 ] {} <Debug> system.trace_log (f608a8db-8edf-46eb-b056-149ebb09c40b): There are no data parts
2022.11.15 15:32:12.595633 [ 314767 ] {} <Trace> system.trace_log (f608a8db-8edf-46eb-b056-149ebb09c40b): Trying to reserve 1.00 MiB using storage policy from min volume index 0
2022.11.15 15:32:12.595680 [ 314767 ] {} <Trace> DiskLocal: Reserved 1.00 MiB on local disk `default`, having unreserved 17.59 GiB.
2022.11.15 15:32:12.595934 [ 314767 ] {} <Trace> MergedBlockOutputStream: filled checksums 202211_1_1_0 (state Temporary)
2022.11.15 15:32:12.596568 [ 314767 ] {} <Trace> system.trace_log (f608a8db-8edf-46eb-b056-149ebb09c40b): Renaming temporary part tmp_insert_202211_1_1_0 to 202211_1_1_0.
2022.11.15 15:32:12.596702 [ 314767 ] {} <Trace> SystemLog (system.trace_log): Flushed system log up to offset 1
2022.11.15 15:32:12.596718 [ 314767 ] {} <Trace> SystemLog (system.trace_log): Terminating
2022.11.15 15:32:12.596786 [ 314776 ] {} <Trace> SystemLog (system.crash_log): Terminating
2022.11.15 15:32:13.519852 [ 314771 ] {} <Trace> SystemLog (system.metric_log): Flushing system log, 1 entries to flush up to offset 1
2022.11.15 15:32:13.519928 [ 314771 ] {} <Debug> SystemLog (system.metric_log): Creating new table system.metric_log for MetricLog
2022.11.15 15:32:13.528837 [ 314771 ] {} <Debug> system.metric_log (fa3ecf81-1bce-4be0-989a-07239a96472b): Loading data parts
2022.11.15 15:32:13.528983 [ 314771 ] {} <Information> system.metric_log (fa3ecf81-1bce-4be0-989a-07239a96472b): Found 0 parts for disk 'default' to load
2022.11.15 15:32:13.529032 [ 314771 ] {} <Debug> system.metric_log (fa3ecf81-1bce-4be0-989a-07239a96472b): There are no data parts
2022.11.15 15:32:13.541563 [ 314771 ] {} <Trace> system.metric_log (fa3ecf81-1bce-4be0-989a-07239a96472b): Trying to reserve 1.00 MiB using storage policy from min volume index 0
2022.11.15 15:32:13.541624 [ 314771 ] {} <Trace> DiskLocal: Reserved 1.00 MiB on local disk `default`, having unreserved 17.59 GiB.
2022.11.15 15:32:13.544491 [ 314771 ] {} <Trace> MergedBlockOutputStream: filled checksums 202211_1_1_0 (state Temporary)
2022.11.15 15:32:13.545009 [ 314771 ] {} <Trace> system.metric_log (fa3ecf81-1bce-4be0-989a-07239a96472b): Renaming temporary part tmp_insert_202211_1_1_0 to 202211_1_1_0.
2022.11.15 15:32:13.546021 [ 314771 ] {} <Trace> SystemLog (system.metric_log): Flushed system log up to offset 1
2022.11.15 15:32:13.546046 [ 314771 ] {} <Trace> SystemLog (system.metric_log): Terminating
2022.11.15 15:32:13.546105 [ 314775 ] {} <Trace> SystemLog (system.asynchronous_metric_log): Terminating
2022.11.15 15:32:13.546178 [ 314778 ] {} <Trace> SystemLog (system.opentelemetry_span_log): Terminating
2022.11.15 15:32:13.546230 [ 314768 ] {} <Trace> SystemLog (system.query_views_log): Terminating
2022.11.15 15:32:13.546279 [ 314770 ] {} <Trace> SystemLog (system.processors_profile_log): Terminating
2022.11.15 15:32:13.546320 [ 314773 ] {} <Trace> SystemLog (system.asynchronous_insert_log): Terminating
2022.11.15 15:32:13.547816 [ 314588 ] {} <Trace> BackgroundSchedulePool/BgSchPool: Waiting for threads to finish.
2022.11.15 15:32:13.548944 [ 314588 ] {} <Debug> MemoryTracker: Peak memory usage (for query): 71.56 KiB.
2022.11.15 15:32:13.549010 [ 314588 ] {} <Debug> Application: Shut down storages.
2022.11.15 15:32:13.549024 [ 314588 ] {} <Trace> AsynchronousInsertQueue: Shutting down the asynchronous insertion queue
2022.11.15 15:32:13.549050 [ 314588 ] {} <Trace> AsynchronousInsertQueue: Asynchronous insertion queue finished
2022.11.15 15:32:13.549324 [ 314588 ] {} <Debug> Application: Destroyed global context.
2022.11.15 15:32:13.550859 [ 314588 ] {} <Error> Application: DB::ErrnoException: Could not calculate available disk space (statvfs), errno: 13, strerror: Permission denied
2022.11.15 15:32:13.550883 [ 314588 ] {} <Information> Application: shutting down
2022.11.15 15:32:13.550893 [ 314588 ] {} <Debug> Application: Uninitializing subsystem: Logging Subsystem
2022.11.15 15:32:13.551424 [ 314589 ] {} <Trace> BaseDaemon: Received signal -2
2022.11.15 15:32:13.551457 [ 314589 ] {} <Information> BaseDaemon: Stop SignalListener thread

添加clickhouse用户到root用户组重新启动即可

usermod -a -G root clickhouse

 

2 password is incorrect or there is no user with such name

[root@ecs-65685 ~]# clickhouse-client
ClickHouse client version 22.10.2.11 (official build).
Connecting to localhost:9000 as user default.

If you have installed ClickHouse and forgot password you can reset it in the configuration file.
The password for default user is typically located at /etc/clickhouse-server/users.d/default-password.xml
and deleting this file will reset the password.
See also /etc/clickhouse-server/users.xml on the server where ClickHouse is installed.

Code: 516. DB::Exception: Received from localhost:9000. DB::Exception: default: Authentication failed: password is incorrect or there is no user with such name. (AUTHENTICATION_FAILED)

 解决

[root@ecs-65685 ~]# clickhouse-client --password
ClickHouse client version 22.10.2.11 (official build).
Password for user (default):
Connecting to localhost:9000 as user default.
Connected to ClickHouse server version 22.10.2 revision 54460.

Warnings:
 * Linux transparent hugepages are set to "always". Check /sys/kernel/mm/transparent_hugepage/enabled
 * Maximum number of threads is lower than 30000. There could be problems with handling a lot of simultaneous queries.

ecs-65685 :) exit

 

Z、Related Links

 

posted @ 2022-11-15 16:29  娇小赤雅  阅读(3317)  评论(0编辑  收藏  举报