# TL;dr 打印日志到控制台 ```xml trace 1 /var/log/clickhouse-server/clickhouse-server.log /var/log/clickhouse-server/clickhouse-server.err.log 1000M 10 ``` 端口 ```xml 8123 9000 9009 ``` ```bash root@demo-clickhouse-0:/# ss -tunlp Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port tcp LISTEN 0 64 0.0.0.0:9009 0.0.0.0:* users:(("clickhouse-serv",pid=1,fd=12)) tcp LISTEN 0 64 0.0.0.0:8123 0.0.0.0:* users:(("clickhouse-serv",pid=1,fd=10)) tcp LISTEN 0 64 0.0.0.0:9000 0.0.0.0:* users:(("clickhouse-serv",pid=1,fd=11)) root@demo-clickhouse-0:/# ### ### root@demo-clickhouse-0:/# ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND clickho+ 1 0.0 2.7 3467192 220544 ? Ssl May06 1:20 /usr/bin/clickhouse-server --config-file=/etc/clickhouse-server/config.xml root 78 0.0 0.0 20312 3936 pts/0 Ss 07:21 0:00 bash root 514 0.0 0.0 36076 3340 pts/0 R+ 07:27 0:00 ps aux root@demo-clickhouse-0:/# ### ### root@demo-clickhouse-0:/# pstree -a clickhouse-serv --config-file=/etc/clickhouse-server/config.xml └─36*[{clickhouse-serv}] ### ### root@demo-clickhouse-0:/# pstree -p clickhouse-serv(1)─┬─{clickhouse-serv}(42) ├─{clickhouse-serv}(43) ├─{clickhouse-serv}(44) ├─{clickhouse-serv}(45) ├─{clickhouse-serv}(46) ├─{clickhouse-serv}(47) ├─{clickhouse-serv}(48) ├─{clickhouse-serv}(49) ├─{clickhouse-serv}(50) ├─{clickhouse-serv}(51) ├─{clickhouse-serv}(52) ├─{clickhouse-serv}(53) ├─{clickhouse-serv}(54) ├─{clickhouse-serv}(55) ├─{clickhouse-serv}(56) ├─{clickhouse-serv}(57) ├─{clickhouse-serv}(58) ├─{clickhouse-serv}(59) ├─{clickhouse-serv}(60) ├─{clickhouse-serv}(61) ├─{clickhouse-serv}(62) ├─{clickhouse-serv}(63) ├─{clickhouse-serv}(64) ├─{clickhouse-serv}(65) ├─{clickhouse-serv}(66) ├─{clickhouse-serv}(67) ├─{clickhouse-serv}(68) ├─{clickhouse-serv}(69) ├─{clickhouse-serv}(70) ├─{clickhouse-serv}(71) ├─{clickhouse-serv}(72) ├─{clickhouse-serv}(73) ├─{clickhouse-serv}(74) ├─{clickhouse-serv}(75) ├─{clickhouse-serv}(76) └─{clickhouse-serv}(77) ``` 配置 ```bash /etc/clickhouse-server/config.xml /etc/clickhouse-server/users.xml /etc/clickhouse-server/config.d /etc/clickhouse-server/metrica.d /etc/clickhouse-server/users.d # https://clickhouse.tech/docs/en/operations/configuration-files/ ``` ```bash ## 设置密码 PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha256sum | tr -d '-' ``` ```bash 2020.05.06 15:55:43.022422 [ 1 ] {} Application: DB::Exception: More than one field of 'password', 'password_sha256_hex', 'password_double_sha1_hex' is used to specify password for user default. Must be only one of them. ``` ```bash 2020.05.06 17:00:41.494205 [ 12 ] {} HTTPHandler: Code: 193, e.displayText() = DB::Exception: Wrong password for user default, Stack trace: 0. 0x55bfc1b7b9d0 StackTrace::StackTrace() /usr/bin/clickhouse 1. 0x55bfc1b7b7a5 DB::Exception::Exception(std::__cxx11::basic_string, std::allocator > const&, int) /usr/bin/clickhouse 2. 0x55bfc1927f7f ? /usr/bin/clickhouse 3. 0x55bfc1928187 ? /usr/bin/clickhouse 4. 0x55bfc4da75d8 DB::Context::setUser(std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&, Poco::Net::SocketAddress const&, std::__cxx11::basic_string, std::allocator > const&) /usr/bin/clickhouse 5. 0x55bfc1bfd9a3 DB::HTTPHandler::processQuery(Poco::Net::HTTPServerRequest&, HTMLForm&, Poco::Net::HTTPServerResponse&, DB::HTTPHandler::Output&) /usr/bin/clickhouse 6. 0x55bfc1c00f99 DB::HTTPHandler::handleRequest(Poco::Net::HTTPServerRequest&, Poco::Net::HTTPServerResponse&) /usr/bin/clickhouse 7. 0x55bfc59d2ef9 Poco::Net::HTTPServerConnection::run() /usr/bin/clickhouse 8. 0x55bfc59cdcd0 Poco::Net::TCPServerConnection::start() /usr/bin/clickhouse 9. 0x55bfc59ce3ed Poco::Net::TCPServerDispatcher::run() /usr/bin/clickhouse 10. 0x55bfc70b1701 Poco::PooledThread::run() /usr/bin/clickhouse 11. 0x55bfc70af4ac Poco::ThreadImpl::runnableEntry(void*) /usr/bin/clickhouse 12. 0x55bfc7824d20 ? /usr/bin/clickhouse 13. 0x7f720181a6db start_thread /lib/x86_64-linux-gnu/libpthread-2.27.so 14. 0x7f720113788f clone /lib/x86_64-linux-gnu/libc-2.27.so (version 19.14.9.12 (official build)) ``` ```bash 2020.05.06 17:00:32.728649 [ 1 ] {} Application: It looks like the process has no CAP_NET_ADMIN capability, 'taskstats' performance statistics will be disabled. It could happen due to incorrect ClickHouse package installation. You could resolve the problem manually with 'sudo setcap cap_net_admin=+ep /usr/bin/clickhouse'. Note that it will not work on 'nosuid' mounted filesystems. It also doesn't work if you run clickhouse-server inside network namespace as it happens in some containers. 2020.05.06 17:00:32.728669 [ 1 ] {} Application: It looks like the process has no CAP_SYS_NICE capability, the setting 'os_thread_nice' 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. ``` # ref * [ClickHouse](https://github.com/ClickHouse/ClickHouse/tree/master/docker) * http://blog.olei.me/2018/01/23/clickhouse%E8%AE%BE%E7%BD%AE%E5%AF%86%E7%A0%81%E7%99%BB%E5%BD%95%E4%BB%A5%E5%8F%8A%E5%8F%AA%E8%AF%BB%E8%B4%A6%E5%8F%B7/ * https://hub.helm.sh/charts/liwenhe/clickhouse