Snuba and clickhouse

We are trying to use the 19.14 external clickhouse cluster for Snuba-api 20.7.2. When trying to connect, the following errors occur:

2020-07-30 14:32:55,591 Attempting to connect to Clickhouse cluster myclickhousehost:9440 (attempt 2)
2020-07-30 14:32:55,591 Connecting. Database: db. User: sentry_user
2020-07-30 14:32:55,705 Connecting. Database: db. User: sentry_user
2020-07-30 14:32:55,720 Connection to Clickhouse myclickhousehost:9440:port> failed (attempt 2)
Traceback (most recent call last):
File “/usr/src/snuba/snuba/cli/bootstrap.py”, line 110, in bootstrap
clickhouse.execute(“SELECT 1”)
File “/usr/src/snuba/snuba/clickhouse/native.py”, line 78, in execute
raise e
File “/usr/src/snuba/snuba/clickhouse/native.py”, line 69, in execute
result = conn.execute(*args, **kwargs)
File “/usr/local/lib/python3.7/site-packages/clickhouse_driver/client.py”, line 196, in execute
self.connection.force_connect()
File “/usr/local/lib/python3.7/site-packages/clickhouse_driver/connection.py”, line 171, in force_connect
self.connect()
File “/usr/local/lib/python3.7/site-packages/clickhouse_driver/connection.py”, line 237, in connect
self.receive_hello()
File “/usr/local/lib/python3.7/site-packages/clickhouse_driver/connection.py”, line 312, in receive_hello
packet_type = read_varint(self.fin)
File “/usr/local/lib/python3.7/site-packages/clickhouse_driver/reader.py”, line 30, in read_varint
i = f.read_one()
File “clickhouse_driver/bufferedreader.pyx”, line 66, in clickhouse_driver.bufferedreader.BufferedReader.read_one
File “clickhouse_driver/bufferedreader.pyx”, line 196, in clickhouse_driver.bufferedreader.BufferedSocketReader.read_into_buffer
EOFError: Unexpected EOF while reading bytes

What could be the reason for this error? Is the snuba compatible with clickhouse version 19.14?

Thx!

2 Likes

This seems like a network connectivity error to me.

There are no problems with the network.
How can we use a secure connection to the clickhouse?

Well, I cannot really debug your system from a forum thread :slight_smile: I’m just explaining what the error message suggests: Clickhouse is not accepting connections or abruptly terminates them.

Quick Googling brought this post to me: https://altinity.com/blog/2019/3/5/clickhouse-networking-part-2

It explains how to set up Clickhouse to accept secure connections that said I don’t think Snuba supports secure connections to Clickhouse yet: https://github.com/getsentry/snuba/blob/4cd98348a6d6ca8e069d5158b30f90560c8b53cd/snuba/clickhouse/native.py#L130-L140

@tkaemming may know more about this or whether there are any plans for implementing support for secure connections.