When installing Sentry, it cannot be installed because it is not connected to clickhouse

Hello, I’m installing version 21.6.1 and it keeps saying that I can’t connect to Clickhouse.

I’m attaching my installation log.


Docker images built.

▶ Turning things off ...
--no-ansi option is deprecated and will be removed in future versions. Use `--ansi never` instead.
Removing network onpremise_default
Network onpremise_default not found.
--no-ansi option is deprecated and will be removed in future versions. Use `--ansi never` instead.
Removing sentry_onpremise_kafka_1      ...
Removing sentry_onpremise_clickhouse_1 ...
Removing sentry_onpremise_redis_1      ...
Removing sentry_onpremise_zookeeper_1  ...
Removing sentry_onpremise_kafka_1      ... done
Removing sentry_onpremise_redis_1      ... done
Removing sentry_onpremise_zookeeper_1  ... done
Removing sentry_onpremise_clickhouse_1 ... done
Removing network sentry_onpremise_default

▶ Setting up Zookeeper ...
--no-ansi option is deprecated and will be removed in future versions. Use `--ansi never` instead.
Creating network "sentry_onpremise_default" with the default driver
Creating sentry_onpremise_zookeeper_run ...
Creating sentry_onpremise_zookeeper_run ... done
--no-ansi option is deprecated and will be removed in future versions. Use `--ansi never` instead.
Creating sentry_onpremise_zookeeper_run ...
Creating sentry_onpremise_zookeeper_run ... done
--no-ansi option is deprecated and will be removed in future versions. Use `--ansi never` instead.
Creating sentry_onpremise_zookeeper_run ...
Creating sentry_onpremise_zookeeper_run ... done

▶ Downloading and installing wal2json ...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  5416  100  5416    0     0  19106      0 --:--:-- --:--:-- --:--:-- 19070

▶ Bootstrapping and migrating Snuba ...
--no-ansi option is deprecated and will be removed in future versions. Use `--ansi never` instead.
Creating sentry_onpremise_clickhouse_1 ...
Creating sentry_onpremise_redis_1      ...
Creating sentry_onpremise_zookeeper_1  ...
Creating sentry_onpremise_clickhouse_1 ... done
Creating sentry_onpremise_zookeeper_1  ... done
Creating sentry_onpremise_redis_1      ... done
Creating sentry_onpremise_kafka_1      ...
Creating sentry_onpremise_kafka_1      ... done
Creating sentry_onpremise_snuba-api_run ...
Creating sentry_onpremise_snuba-api_run ... done
2021-06-30 08:51:49,161 Attempting to connect to Kafka (attempt 0)...
2021-06-30 08:51:51,163 Attempting to connect to Kafka (attempt 1)...
2021-06-30 08:51:51,336 Connected to Kafka on attempt 1
2021-06-30 08:51:51,336 Creating Kafka topics...
--no-ansi option is deprecated and will be removed in future versions. Use `--ansi never` instead.
Creating sentry_onpremise_snuba-api_run ...
Creating sentry_onpremise_snuba-api_run ... done
Failed to connect to clickhouse:9000
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/connection.py", line 260, in connect
    return self._init_connection(host, port)
  File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/connection.py", line 226, in _init_connection
    self.socket = self._create_socket(host, port)
  File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/connection.py", line 221, in _create_socket
    raise err
  File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/connection.py", line 212, in _create_socket
    sock.connect(sa)
socket.timeout: timed out
Failed to connect to clickhouse:9000
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/connection.py", line 260, in connect
    return self._init_connection(host, port)
  File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/connection.py", line 226, in _init_connection
    self.socket = self._create_socket(host, port)
  File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/connection.py", line 221, in _create_socket
    raise err
  File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/connection.py", line 212, in _create_socket
    sock.connect(sa)
socket.timeout: timed out
Connection to Clickhouse cluster clickhouse:9000 failed (attempt 0)
Traceback (most recent call last):
  File "/usr/src/snuba/snuba/clickhouse/native.py", line 80, in execute
    result: Sequence[Any] = conn.execute(
  File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/client.py", line 205, in execute
    self.connection.force_connect()
  File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/connection.py", line 180, in force_connect
    self.connect()
  File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/connection.py", line 279, in connect
    raise err
clickhouse_driver.errors.SocketTimeoutError: Code: 209. (clickhouse:9000)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/snuba/snuba/migrations/connect.py", line 30, in check_clickhouse_connections
    check_clickhouse(clickhouse)
  File "/usr/src/snuba/snuba/migrations/connect.py", line 49, in check_clickhouse
    ver = clickhouse.execute("SELECT version()")[0][0]
  File "/usr/src/snuba/snuba/clickhouse/native.py", line 95, in execute
    raise ClickhouseError(e.code, e.message) from e
snuba.clickhouse.errors.ClickhouseError: [209] (clickhouse:9000)
Failed to connect to clickhouse:9000

Server specifications perform much better than those required by Sentry.

These logs are not useful as they are not telling why they cannot connect to Clickhouse. Logs from Clickhouse itself would be more useful:

docker-compose logs clickhouse
clickhouse_1                                | Processing configuration file '/etc/clickhouse-server/config.xml'.
clickhouse_1                                | Merging configuration file '/etc/clickhouse-server/config.d/docker_related_config.xml'.
clickhouse_1                                | Merging configuration file '/etc/clickhouse-server/config.d/sentry.xml'.
clickhouse_1                                | Include not found: clickhouse_remote_servers
clickhouse_1                                | Include not found: clickhouse_compression
clickhouse_1                                | Logging information to /var/log/clickhouse-server/clickhouse-server.log
clickhouse_1                                | Logging errors to /var/log/clickhouse-server/clickhouse-server.err.log
clickhouse_1                                | Logging information to console
clickhouse_1                                | 2021.06.30 09:35:39.176391 [ 1 ] {} <Information> : Starting ClickHouse 20.3.9.70 with revision 54433
clickhouse_1                                | 2021.06.30 09:35:39.177919 [ 1 ] {} <Information> Application: starting up
clickhouse_1                                | Include not found: networks
clickhouse_1                                | 2021.06.30 09:35:39.181966 [ 1 ] {} <Information> Application: Loading metadata from /var/lib/clickhouse/
clickhouse_1                                | 2021.06.30 09:35:39.182684 [ 1 ] {} <Information> DatabaseOrdinary (system): Total 1 tables and 0 dictionaries.
clickhouse_1                                | 2021.06.30 09:35:39.185320 [ 47 ] {} <Information> BackgroundProcessingPool: Create BackgroundProcessingPool with 16 threads
clickhouse_1                                | 2021.06.30 09:35:39.193285 [ 1 ] {} <Information> DatabaseOrdinary (system): Starting up tables.
clickhouse_1                                | 2021.06.30 09:35:39.193817 [ 1 ] {} <Information> DatabaseOrdinary (default): Total 0 tables and 0 dictionaries.
clickhouse_1                                | 2021.06.30 09:35:39.193827 [ 1 ] {} <Information> DatabaseOrdinary (default): Starting up tables.
clickhouse_1                                | 2021.06.30 09:35:39.193864 [ 1 ] {} <Information> BackgroundSchedulePool: Create BackgroundSchedulePool with 16 threads
clickhouse_1                                | 2021.06.30 09:35:39.194241 [ 1 ] {} <Information> 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.
clickhouse_1                                | 2021.06.30 09:35:39.194257 [ 1 ] {} <Information> 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.
clickhouse_1                                | 2021.06.30 09:35:39.195484 [ 1 ] {} <Error> Application: Listen [::]:8123 failed: Poco::Exception. Code: 1000, e.code() = 0, e.displayText() = DNS error: EAI: -9 (version 20.3.9.70 (official build)). If it is an IPv6 or IPv4 address and your host has disabled IPv6 or IPv4, then consider to specify not disabled IPv4 or IPv6 address to listen in <listen_host> element of configuration file. Example for disabled IPv6: <listen_host>0.0.0.0</listen_host> . Example for disabled IPv4: <listen_host>::</listen_host>
clickhouse_1                                | 2021.06.30 09:35:39.195745 [ 1 ] {} <Error> Application: Listen [::]:9000 failed: Poco::Exception. Code: 1000, e.code() = 0, e.displayText() = DNS error: EAI: -9 (version 20.3.9.70 (official build)). If it is an IPv6 or IPv4 address and your host has disabled IPv6 or IPv4, then consider to specify not disabled IPv4 or IPv6 address to listen in <listen_host> element of configuration file. Example for disabled IPv6: <listen_host>0.0.0.0</listen_host> . Example for disabled IPv4: <listen_host>::</listen_host>
clickhouse_1                                | 2021.06.30 09:35:39.195967 [ 1 ] {} <Error> Application: Listen [::]:9009 failed: Poco::Exception. Code: 1000, e.code() = 0, e.displayText() = DNS error: EAI: -9 (version 20.3.9.70 (official build)). If it is an IPv6 or IPv4 address and your host has disabled IPv6 or IPv4, then consider to specify not disabled IPv4 or IPv6 address to listen in <listen_host> element of configuration file. Example for disabled IPv6: <listen_host>0.0.0.0</listen_host> . Example for disabled IPv4: <listen_host>::</listen_host>
clickhouse_1                                | 2021.06.30 09:35:39.196185 [ 1 ] {} <Error> Application: Listen [::]:9004 failed: Poco::Exception. Code: 1000, e.code() = 0, e.displayText() = DNS error: EAI: -9 (version 20.3.9.70 (official build)). If it is an IPv6 or IPv4 address and your host has disabled IPv6 or IPv4, then consider to specify not disabled IPv4 or IPv6 address to listen in <listen_host> element of configuration file. Example for disabled IPv6: <listen_host>0.0.0.0</listen_host> . Example for disabled IPv4: <listen_host>::</listen_host>
clickhouse_1                                | 2021.06.30 09:35:39.196245 [ 1 ] {} <Information> Application: Listening for http://0.0.0.0:8123
clickhouse_1                                | 2021.06.30 09:35:39.196269 [ 1 ] {} <Information> Application: Listening for connections with native protocol (tcp): 0.0.0.0:9000
clickhouse_1                                | 2021.06.30 09:35:39.196286 [ 1 ] {} <Information> Application: Listening for replica communication (interserver): http://0.0.0.0:9009
clickhouse_1                                | 2021.06.30 09:35:39.294034 [ 1 ] {} <Information> Application: Listening for MySQL compatibility protocol: 0.0.0.0:9004
clickhouse_1                                | 2021.06.30 09:35:39.294312 [ 1 ] {} <Information> Application: Available RAM: 62.74 GiB; physical cores: 32; logical cores: 32.
clickhouse_1                                | 2021.06.30 09:35:39.294319 [ 1 ] {} <Information> Application: Ready for connections.
clickhouse_1                                | Include not found: clickhouse_remote_servers
clickhouse_1                                | Include not found: clickhouse_compression

Looks like a networking/DNS issue to me. Have you retried the install?