一、Installing ClickHouse-22.10.2.11 on openEuler1 地址

https://clickhouse.com

https://packages.clickhouse.com

https://github.com/ClickHouse/ClickHouse

2 Tgz安装包​

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

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

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

# wget 下载mkdir -p /opt/software/ClickHouse && cd /opt/software/ClickHousewget https://github.com/ClickHouse/ClickHouse/releases/download/v22.10.2.11-stable/clickhouse-client-22.10.2.11-amd64.tgzwget https://github.com/ClickHouse/ClickHouse/releases/download/v22.10.2.11-stable/clickhouse-common-static-22.10.2.11-amd64.tgzwget https://github.com/ClickHouse/ClickHouse/releases/download/v22.10.2.11-stable/clickhouse-common-static-dbg-22.10.2.11-amd64.tgzwget 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/ClickHousetar -zxvf /opt/software/ClickHouse/clickhouse-client-22.10.2.11-amd64.tgz -C /opt/ClickHousetar -zxvf /opt/software/ClickHouse/clickhouse-common-static-22.10.2.11-amd64.tgz -C /opt/ClickHousetar -zxvf /opt/software/ClickHouse/clickhouse-common-static-dbg-22.10.2.11-amd64.tgz -C /opt/ClickHousetar -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.shClickHouse binary is already located at /usr/bin/clickhouseSymlink /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 clickhouseCreating clickhouse user if it does not exist. useradd -r --shell /bin/false --home-dir /nonexistent -g clickhouse clickhouseWill 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]: yThe 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 startStart clickhouse-client with: clickhouse-client --passwordSynchronizing 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-serverCreated 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 --helpusage:clickhouse-server [OPTION] [-- [ARG]...]positional arguments can be used to rewrite config.xml properties, forexample, --http_port=8010-h, --help                        show help and exit-V, --version                     show version and exit-C, --config-file=    load configuration from a given file-L, --log-file=       use given log file-E, --errorlog-file=  use given log file for errors only-P, --pid-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.xmlProcessing 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.logLogging errors to /var/log/clickhouse-server/clickhouse-server.err.log2022.11.15 20:44:35.961690 [ 4036 ] {}  SentryWriter: Sending crash reports is disabled2022.11.15 20:44:35.971273 [ 4036 ] {}  Pipe: Pipe capacity is 1.00 MiB2022.11.15 20:44:36.120186 [ 4036 ] {}  : Starting ClickHouse 22.10.2.11 (revision: 54467, git hash: d2bfcaba0022ff70075078987cf253c6e0c12183, build id: 980C6F4C7EC4672BA0D63DCE7EA99C43523A5A7E), PID 40362022.11.15 20:44:36.120305 [ 4036 ] {}  Application: starting up2022.11.15 20:44:36.120328 [ 4036 ] {}  Application: OS name: Linux, version: 4.19.90-2003.4.0.0036.oe1.x86_64, architecture: x86_642022.11.15 20:44:36.130693 [ 4036 ] {}  Context: Linux transparent hugepages are set to "always". Check /sys/kernel/mm/transparent_hugepage/enabled2022.11.15 20:44:36.131091 [ 4036 ] {}  AsynchronousMetrics: Scanning /sys/class/thermal2022.11.15 20:44:36.131121 [ 4036 ] {}  AsynchronousMetrics: Scanning /sys/block2022.11.15 20:44:36.131169 [ 4036 ] {}  AsynchronousMetrics: Scanning /sys/devices/system/edac2022.11.15 20:44:36.131191 [ 4036 ] {}  AsynchronousMetrics: Scanning /sys/class/hwmon2022.11.15 20:44:36.293811 [ 4036 ] {}  Application: Integrity check of the executable successfully passed (checksum: 61AFDDE9B58A440D85A27CF2CFCBED9D)2022.11.15 20:44:36.293932 [ 4036 ] {}  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 ] {}  Application: The memory map of clickhouse executable has been mlock'ed, total 279.37 MiB2022.11.15 20:44:36.316017 [ 4036 ] {}  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 ] {}  Application: shutting down2022.11.15 20:44:36.316063 [ 4036 ] {}  Application: Uninitializing subsystem: Logging Subsystem2022.11.15 20:44:36.316106 [ 4037 ] {}  BaseDaemon: Received signal -22022.11.15 20:44:36.316161 [ 4037 ] {}  BaseDaemon: Stop SignalListener thread

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

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

5.3 root 用户启动失败

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

ll /etc/clickhouse-serverll /var/log/clickhouse-serverll /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 clickhouseclickho+    1803       1  0 20:17 ?        00:00:00 clickhouse-watchdog        --config=/etc/clickhouse-server/config.xml --pid-file=/run/clickhouse-server/clickhouse-server.pidclickho+    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.pidroot        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 --daemonWaiting for server to startWaiting for server to startServer started

7命令行客户端

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

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

# 没有密码可不加 --password[root@ecs-65685 ~]# clickhouse-client --passwordClickHouse 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 clickhouselrwxrwxrwx  1 root              root                10 Nov 15 15:14 clickhouse-benchmark -> clickhouselrwxrwxrwx  1 root              root                10 Nov 15 15:14 clickhouse-client -> clickhouselrwxrwxrwx  1 root              root                10 Nov 15 15:14 clickhouse-compressor -> clickhouselrwxrwxrwx  1 root              root                19 Nov 15 15:12 clickhouse-copier -> /usr/bin/clickhouse-rwx------  1 root              root               19M Nov 15 15:11 clickhouse-diagnosticslrwxrwxrwx  1 root              root                19 Nov 15 15:12 clickhouse-disks -> /usr/bin/clickhouselrwxrwxrwx  1 root              root                19 Nov 15 15:12 clickhouse-extract-from-config -> /usr/bin/clickhouselrwxrwxrwx  1 root              root                10 Nov 15 15:14 clickhouse-format -> clickhouselrwxrwxrwx  1 root              root                19 Nov 15 15:12 clickhouse-git-import -> /usr/bin/clickhouselrwxrwxrwx  1 root              root                19 Nov 15 15:12 clickhouse-keeper -> /usr/bin/clickhouselrwxrwxrwx  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-bridgelrwxrwxrwx  1 root              root                10 Nov 15 15:14 clickhouse-local -> clickhouselrwxrwxrwx  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-reportlrwxrwxrwx  1 root              root                19 Nov 15 15:12 clickhouse-server -> /usr/bin/clickhouse

2 配置文件目录

[root@ecs-65685 ~]# ll /etc/clickhouse-servertotal 88Kdr-x------ 2 clickhouse clickhouse 4.0K Nov 15 15:14 config.d-r-------- 1 clickhouse clickhouse  69K Nov 15 15:12 config.xmldr-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-servertotal 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/clickhousetotal 64Kdrwxr-x--- 2 clickhouse clickhouse 4.0K Nov 15 15:32 accessdrwxr-x--- 2 clickhouse clickhouse 4.0K Nov 15 15:17 coresdrwxr-x--- 4 clickhouse clickhouse 4.0K Nov 15 15:32 datadrwxr-x--- 2 clickhouse clickhouse 4.0K Nov 15 15:32 dictionaries_libdrwxr-x--- 2 clickhouse clickhouse 4.0K Nov 15 15:32 flagsdrwxr-x--- 2 clickhouse clickhouse 4.0K Nov 15 15:32 format_schemasdrwxr-x--- 4 clickhouse clickhouse 4.0K Nov 15 15:32 metadatadrwxr-x--- 2 clickhouse clickhouse 4.0K Nov 15 15:32 metadata_droppeddrwxr-x--- 2 clickhouse clickhouse 4.0K Nov 15 15:32 preprocessed_configs-rw-r----- 1 clickhouse clickhouse   60 Nov 15 15:35 statusdrwxr-x--- 8 clickhouse clickhouse 4.0K Nov 15 15:49 storedrwxr-x--- 2 clickhouse clickhouse 4.0K Nov 15 15:32 tmpdrwxr-x--- 2 clickhouse clickhouse 4.0K Nov 15 15:32 user_defineddrwxr-x--- 2 clickhouse clickhouse 4.0K Nov 15 15:32 user_filesdrwxr-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 firewalldfirewall-cmd --zone=public --add-port=8123/tcp --permanent# 配置立即生效firewall-cmd --reload# 重启防火墙生效systemctl restart firewalld

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

X、One Step SuccessY、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.pidProcessing 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.logLogging errors to /var/log/clickhouse-server/clickhouse-server.err.log2022.11.15 15:31:21.118852 [ 314492 ] {}  SentryWriter: Sending crash reports is disabled2022.11.15 15:31:21.127975 [ 314492 ] {}  Pipe: Pipe capacity is 1.00 MiBCode: 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 ] {}  BaseDaemon: Received signal -22022.11.15 15:31:21.175819 [ 314493 ] {}  BaseDaemon: Stop SignalListener thread[root@ecs-65685 ~]# ll /usr/lib/debug/usr/bintotal 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/bintotal 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.pidProcessing 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.logLogging errors to /var/log/clickhouse-server/clickhouse-server.err.log2022.11.15 15:32:11.442704 [ 314588 ] {}  SentryWriter: Sending crash reports is disabled2022.11.15 15:32:11.452552 [ 314588 ] {}  Pipe: Pipe capacity is 1.00 MiB2022.11.15 15:32:11.602884 [ 314588 ] {}  : Starting ClickHouse 22.10.2.11 (revision: 54467, git hash: d2bfcaba0022ff70075078987cf253c6e0c12183, build id: 980C6F4C7EC4672BA0D63DCE7EA99C43523A5A7E), PID 3145882022.11.15 15:32:11.603022 [ 314588 ] {}  Application: starting up2022.11.15 15:32:11.603047 [ 314588 ] {}  Application: OS name: Linux, version: 4.19.90-2003.4.0.0036.oe1.x86_64, architecture: x86_642022.11.15 15:32:11.720246 [ 314588 ] {}  Context: Linux transparent hugepages are set to "always". Check /sys/kernel/mm/transparent_hugepage/enabled2022.11.15 15:32:11.720676 [ 314588 ] {}  AsynchronousMetrics: Scanning /sys/class/thermal2022.11.15 15:32:11.720707 [ 314588 ] {}  AsynchronousMetrics: Scanning /sys/block2022.11.15 15:32:11.720743 [ 314588 ] {}  AsynchronousMetrics: Scanning /sys/devices/system/edac2022.11.15 15:32:11.720764 [ 314588 ] {}  AsynchronousMetrics: Scanning /sys/class/hwmon2022.11.15 15:32:12.467832 [ 314588 ] {}  Application: Integrity check of the executable successfully passed (checksum: 61AFDDE9B58A440D85A27CF2CFCBED9D)2022.11.15 15:32:12.468919 [ 314588 ] {}  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 ] {}  Application: rlimit on number of file descriptors is 10485762022.11.15 15:32:12.476453 [ 314588 ] {}  Application: rlimit on number of threads is 297292022.11.15 15:32:12.476483 [ 314588 ] {}  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 ] {}  Application: Initializing DateLUT.2022.11.15 15:32:12.476513 [ 314588 ] {}  Application: Initialized DateLUT with time zone 'Asia/Shanghai'.2022.11.15 15:32:12.476541 [ 314588 ] {}  Application: Setting up /var/lib/clickhouse/tmp/ to store temporary data in it2022.11.15 15:32:12.476860 [ 314588 ] {}  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 ] {}  Application: Initializing interserver credentials.2022.11.15 15:32:12.477028 [ 314588 ] {}  SensitiveDataMaskerConfigRead: 1 query masking rules loaded.2022.11.15 15:32:12.478838 [ 314588 ] {}  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 ] {}  ConfigReloader: Loaded config '/etc/clickhouse-server/config.xml', performing update on configuration2022.11.15 15:32:12.483413 [ 314588 ] {}  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 ] {}  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 ] {}  ConfigReloader: Loaded config '/etc/clickhouse-server/config.xml', performed update on configuration2022.11.15 15:32:12.487887 [ 314588 ] {}  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 ] {}  ConfigReloader: Loaded config '/etc/clickhouse-server/users.xml', performing update on configuration2022.11.15 15:32:12.488803 [ 314588 ] {}  ConfigReloader: Loaded config '/etc/clickhouse-server/users.xml', performed update on configuration2022.11.15 15:32:12.489059 [ 314588 ] {}  Access(user directories): Added users.xml access storage 'users.xml', path: /etc/clickhouse-server/users.xml2022.11.15 15:32:12.489141 [ 314588 ] {}  Access(local directory): File /var/lib/clickhouse/access/users.list doesn't exist2022.11.15 15:32:12.489159 [ 314588 ] {}  Access(local directory): Recovering lists in directory /var/lib/clickhouse/access/2022.11.15 15:32:12.489258 [ 314588 ] {}  Access(user directories): Added local directory access storage 'local directory', path: /var/lib/clickhouse/access/2022.11.15 15:32:12.489288 [ 314588 ] {}  Application: Uncompressed cache policy name2022.11.15 15:32:12.489303 [ 314588 ] {}  Application: Uncompressed cache size was lowered to 3.64 GiB because the system has low amount of memory2022.11.15 15:32:12.491692 [ 314588 ] {}  Context: Initialized background executor for merges and mutations with num_threads=16, num_tasks=322022.11.15 15:32:12.492037 [ 314588 ] {}  Context: Initialized background executor for move operations with num_threads=8, num_tasks=82022.11.15 15:32:12.492434 [ 314588 ] {}  Context: Initialized background executor for fetches with num_threads=8, num_tasks=82022.11.15 15:32:12.493313 [ 314588 ] {}  Context: Initialized background executor for common operations (e.g. clearing old parts) with num_threads=8, num_tasks=82022.11.15 15:32:12.493499 [ 314588 ] {}  Application: Mark cache size was lowered to 3.64 GiB because the system has low amount of memory2022.11.15 15:32:12.493608 [ 314588 ] {}  BackgroundSchedulePool/BgSchPool: Create BackgroundSchedulePool with 128 threads2022.11.15 15:32:12.504101 [ 314588 ] {}  DNSCacheUpdater: Update period 15 seconds2022.11.15 15:32:12.504135 [ 314588 ] {}  Application: Loading metadata from /var/lib/clickhouse/2022.11.15 15:32:12.504220 [ 314639 ] {}  DNSResolver: Updating DNS cache2022.11.15 15:32:12.507126 [ 314639 ] {}  DNSResolver: Updated DNS cache2022.11.15 15:32:12.515442 [ 314588 ] {}  DatabaseAtomic (system): Metadata processed, database system has 0 tables and 0 dictionaries in total.2022.11.15 15:32:12.515469 [ 314588 ] {}  TablesLoader: Parsed metadata of 0 tables in 1 databases in 8.1882e-05 sec2022.11.15 15:32:12.515509 [ 314588 ] {}  TablesLoader: Loading 0 tables with 0 dependency level2022.11.15 15:32:12.516817 [ 314588 ] {}  SystemLog: Not creating system.text_log since corresponding section 'text_log' is missing from config2022.11.15 15:32:12.518166 [ 314588 ] {}  SystemLog: Not creating system.filesystem_cache_log since corresponding section 'filesystem_cache_log' is missing from config2022.11.15 15:32:12.518677 [ 314588 ] {}  SystemLog: Not creating system.zookeeper_log since corresponding section 'zookeeper_log' is missing from config2022.11.15 15:32:12.518703 [ 314588 ] {}  SystemLog: Not creating system.session_log since corresponding section 'session_log' is missing from config2022.11.15 15:32:12.518719 [ 314588 ] {}  SystemLog: Not creating system.transactions_info_log since corresponding section 'transactions_info_log' is missing from config2022.11.15 15:32:12.534139 [ 314588 ] {}  DatabaseCatalog: Found 0 partially dropped tables. Will load them and retry removal.2022.11.15 15:32:12.537305 [ 314588 ] {}  DatabaseAtomic (default): Metadata processed, database default has 0 tables and 0 dictionaries in total.2022.11.15 15:32:12.537332 [ 314588 ] {}  TablesLoader: Parsed metadata of 0 tables in 1 databases in 6.2905e-05 sec2022.11.15 15:32:12.537362 [ 314588 ] {}  TablesLoader: Loading 0 tables with 0 dependency level2022.11.15 15:32:12.537376 [ 314588 ] {}  DatabaseAtomic (default): Starting up tables.2022.11.15 15:32:12.537392 [ 314588 ] {}  DatabaseAtomic (system): Starting up tables.2022.11.15 15:32:12.538464 [ 314588 ] {}  UserDefinedSQLObjectsLoaderFromDisk: Loading user defined objects from /var/lib/clickhouse/user_defined/2022.11.15 15:32:12.538510 [ 314588 ] {}  UserDefinedSQLObjectsLoaderFromDisk: User defined objects loaded2022.11.15 15:32:12.538521 [ 314588 ] {}  Application: Loaded metadata.2022.11.15 15:32:12.538550 [ 314588 ] {}  Pipe: Pipe capacity is 1.00 MiB2022.11.15 15:32:12.538572 [ 314588 ] {}  Application: Tasks stats provider: procfs2022.11.15 15:32:12.538587 [ 314588 ] {}  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 ] {}  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 ] {}  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 ] {}  MySQLHandlerFactory: Generating new RSA key pair.2022.11.15 15:32:12.587458 [ 314588 ] {}  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 ] {}  AsynchronousMetrics: MemoryTracking: was 11.57 MiB, peak 15.97 MiB, will set to 526.04 MiB (RSS), difference: 505.96 MiB2022.11.15 15:32:12.588056 [ 314588 ] {}  Application: Shutting down storages.2022.11.15 15:32:12.588156 [ 314769 ] {}  SystemLog (system.query_log): Terminating2022.11.15 15:32:12.588244 [ 314777 ] {}  SystemLog (system.query_thread_log): Terminating2022.11.15 15:32:12.588295 [ 314772 ] {}  SystemLog (system.part_log): Terminating2022.11.15 15:32:12.588365 [ 314767 ] {}  SystemLog (system.trace_log): Flushing system log, 1 entries to flush up to offset 12022.11.15 15:32:12.588406 [ 314767 ] {}  SystemLog (system.trace_log): Creating new table system.trace_log for TraceLog2022.11.15 15:32:12.589343 [ 314767 ] {}  StoragePolicy (default): Storage policy default created, total volumes 12022.11.15 15:32:12.592456 [ 314767 ] {}  system.trace_log (f608a8db-8edf-46eb-b056-149ebb09c40b): Loading data parts2022.11.15 15:32:12.592593 [ 314767 ] {}  system.trace_log (f608a8db-8edf-46eb-b056-149ebb09c40b): Found 0 parts for disk 'default' to load2022.11.15 15:32:12.592629 [ 314767 ] {}  system.trace_log (f608a8db-8edf-46eb-b056-149ebb09c40b): There are no data parts2022.11.15 15:32:12.595633 [ 314767 ] {}  system.trace_log (f608a8db-8edf-46eb-b056-149ebb09c40b): Trying to reserve 1.00 MiB using storage policy from min volume index 02022.11.15 15:32:12.595680 [ 314767 ] {}  DiskLocal: Reserved 1.00 MiB on local disk `default`, having unreserved 17.59 GiB.2022.11.15 15:32:12.595934 [ 314767 ] {}  MergedBlockOutputStream: filled checksums 202211_1_1_0 (state Temporary)2022.11.15 15:32:12.596568 [ 314767 ] {}  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 ] {}  SystemLog (system.trace_log): Flushed system log up to offset 12022.11.15 15:32:12.596718 [ 314767 ] {}  SystemLog (system.trace_log): Terminating2022.11.15 15:32:12.596786 [ 314776 ] {}  SystemLog (system.crash_log): Terminating2022.11.15 15:32:13.519852 [ 314771 ] {}  SystemLog (system.metric_log): Flushing system log, 1 entries to flush up to offset 12022.11.15 15:32:13.519928 [ 314771 ] {}  SystemLog (system.metric_log): Creating new table system.metric_log for MetricLog2022.11.15 15:32:13.528837 [ 314771 ] {}  system.metric_log (fa3ecf81-1bce-4be0-989a-07239a96472b): Loading data parts2022.11.15 15:32:13.528983 [ 314771 ] {}  system.metric_log (fa3ecf81-1bce-4be0-989a-07239a96472b): Found 0 parts for disk 'default' to load2022.11.15 15:32:13.529032 [ 314771 ] {}  system.metric_log (fa3ecf81-1bce-4be0-989a-07239a96472b): There are no data parts2022.11.15 15:32:13.541563 [ 314771 ] {}  system.metric_log (fa3ecf81-1bce-4be0-989a-07239a96472b): Trying to reserve 1.00 MiB using storage policy from min volume index 02022.11.15 15:32:13.541624 [ 314771 ] {}  DiskLocal: Reserved 1.00 MiB on local disk `default`, having unreserved 17.59 GiB.2022.11.15 15:32:13.544491 [ 314771 ] {}  MergedBlockOutputStream: filled checksums 202211_1_1_0 (state Temporary)2022.11.15 15:32:13.545009 [ 314771 ] {}  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 ] {}  SystemLog (system.metric_log): Flushed system log up to offset 12022.11.15 15:32:13.546046 [ 314771 ] {}  SystemLog (system.metric_log): Terminating2022.11.15 15:32:13.546105 [ 314775 ] {}  SystemLog (system.asynchronous_metric_log): Terminating2022.11.15 15:32:13.546178 [ 314778 ] {}  SystemLog (system.opentelemetry_span_log): Terminating2022.11.15 15:32:13.546230 [ 314768 ] {}  SystemLog (system.query_views_log): Terminating2022.11.15 15:32:13.546279 [ 314770 ] {}  SystemLog (system.processors_profile_log): Terminating2022.11.15 15:32:13.546320 [ 314773 ] {}  SystemLog (system.asynchronous_insert_log): Terminating2022.11.15 15:32:13.547816 [ 314588 ] {}  BackgroundSchedulePool/BgSchPool: Waiting for threads to finish.2022.11.15 15:32:13.548944 [ 314588 ] {}  MemoryTracker: Peak memory usage (for query): 71.56 KiB.2022.11.15 15:32:13.549010 [ 314588 ] {}  Application: Shut down storages.2022.11.15 15:32:13.549024 [ 314588 ] {}  AsynchronousInsertQueue: Shutting down the asynchronous insertion queue2022.11.15 15:32:13.549050 [ 314588 ] {}  AsynchronousInsertQueue: Asynchronous insertion queue finished2022.11.15 15:32:13.549324 [ 314588 ] {}  Application: Destroyed global context.2022.11.15 15:32:13.550859 [ 314588 ] {}  Application: DB::ErrnoException: Could not calculate available disk space (statvfs), errno: 13, strerror: Permission denied2022.11.15 15:32:13.550883 [ 314588 ] {}  Application: shutting down2022.11.15 15:32:13.550893 [ 314588 ] {}  Application: Uninitializing subsystem: Logging Subsystem2022.11.15 15:32:13.551424 [ 314589 ] {}  BaseDaemon: Received signal -22022.11.15 15:32:13.551457 [ 314589 ] {}  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-clientClickHouse 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.xmland 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 --passwordClickHouse 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