Closed gagangoku closed 1 month ago
Hi @gagangoku
Cloud connection issues
The code snippet provided in Cloud UI needs to be corrected. It assumes you use the default TCP protocol, but the port provided (8443
) is an HTTPS port. 9443
is a port for secure TCP. I will follow up on this in an internal issue.
Local issues
This is specifically related to whether clickhouse-server
correctly exposes a secure TCP port. By default it does not expose 9440
port. You can refer to the docs page: https://clickhouse.com/docs/en/guides/sre/configuring-ssl
The snippet provided in Cloud UI is helping to onboard to Cloud specifically and it will not cover all ClickHouse use cases.
Setting TLS config as nil and talking to 9000 port instead also works.
I also can't connect to clickhouse through library
Port: '8123'
Error connecting to database: tls: first record does not look like a TLS handshake
In the same time dbeaver connects to the server and port 8123 and works correctly
func ConnectDb(dbHost string, dbPort int, dbName string, dbUser string, dbPass string) (*clickhouse.Conn, error) {
var (
ctx = context.Background()
conn, err = clickhouse.Open(&clickhouse.Options{
Addr: []string{dbHost + ":" + strconv.Itoa(dbPort)},
Auth: clickhouse.Auth{
Database: dbName,
Username: dbUser,
Password: dbPass,
},
ClientInfo: clickhouse.ClientInfo{
Products: []struct {
Name string
Version string
}{
{Name: "ClickHouse-Importer", Version: "0.1"},
},
},
Debugf: func(format string, v ...interface{}) {
fmt.Printf(format, v)
},
TLS: nil,
})
)
if err != nil {
return nil, err
}
if err := conn.Ping(ctx); err != nil {
if exception, ok := err.(*clickhouse.Exception); ok {
fmt.Printf("Exception [%d] %s \n%s\n", exception.Code, exception.Message, exception.StackTrace)
}
return nil, err
}
return &conn, nil
}
@ytigiev 8123
(by default) is HTTP protocol. You configured your client to use ClickHouse native TCP protocol. Either yo use 9000
(native) or set Protocol: clickhouse.HTTP
.
Apologies, it was my mistake. I resolved the issue by opening port 9000 on the server's firewall.
Hi, today I spent more than 2 hours just trying to connect to clickhouse cloud, but it kept throwing all sorts of errors. Can someone please make which ports to connect to a little clear.
Cloud connection issues
On clickhouse cloud, the basic code in Connect section itself doesn't work:
This throws the error:
After a lot of trial and error, changed the port to 9440 and it worked !
Local issues
But when I run clickhouse locally using
and try to connect using:
it throws the following error:
But the following works:
Why is connecting to clickhouse so confusing ?
Btw, I'm using Macbook pro.