a year ago
My golang application cant connect to my scylladb database, getting this error:
unable to create session: unable to discover protocol version: dial tcp [::1]:9042: connect: cannot assign requested address
11 Replies
a year ago
you would need to use the private networking domain to connect to the database
a year ago
Hi thanks for the help, I've set my SCYLLA_HOST environment variable to my private networking domain and i'm still getting similar errors, any ideas?:
gocql: unable to create session: unable to discover protocol version: dial tcp [fd12:acd6:8e6c::b2:f62c:f9b6]:9042: connect: connection refused
dns error: lookup ticketing-api.railway.internal on [fd12::10]:53: dial udp [fd12::10]:53: connect: cannot assign requested address
gocql: unable to create session: failed to resolve any of the provided hostnames
a year ago
the private network is ipv6 only, scylla would need to listen on ipv6, please see this docs page, and then reference Scylla's own documentation on how to implement what is mentioned.
https://docs.railway.app/guides/private-networking#listen-on-ipv6
a year ago
Alright i've had a go at that and on my local it says this:
1008741ead0f scylladb/scylla "/docker-entrypoint.…" 29 minutes ago Up 8 minutes (healthy) 22/tcp, 7000-7001/tcp, 9160/tcp, 9180/tcp, 10000/tcp, 0.0.0.0:9042->9042/tcp, :::9042->9042/tcp scylla
So scylla should be listening on ipv6.
image: scylladb/scylla
container_name: scylla
ports:
- "${SCYLLA_PORT}:${SCYLLA_PORT}"
environment:
SCYLLA_API_ADDRESS: ${SCYLLA_API_ADDRESS}
SCYLLA_LISTEN_ADDRESS: ${SCYLLA_LISTEN_ADDRESS}
SCYLLA_RPC_ADDRESS: ${SCYLLA_LISTEN_ADDRESS}
volumes:
- scylla_data:/var/lib/scylla
healthcheck:
test: ["CMD", "cqlsh", "-u", "${SCYLLA_USERNAME}", "-p", "${SCYLLA_PASSWORD}", "-e", "DESCRIBE KEYSPACES"]
interval: 10s
timeout: 5s
retries: 10
this is my docker compose, am I right in thinking that the environment variables should be set to :: here?
cluster := gocql.NewCluster(os.Getenv("SCYLLA_HOST"))
clusterPort, err := strconv.Atoi(os.Getenv("SCYLLA_PORT"))
if err != nil {
log.Fatal("failed to parse scylla port:", err)
}
cluster.Port = clusterPort
cluster.Keyspace = os.Getenv("SCYLLA_KEYSPACE")
and heres the go code where i connect to the db, SCYLLAHOST is set to my private domain and SCYLLAPORT is 9024.
can you see any issues with this configuration? still getting these errors:
2024/03/10 19:00:50 failed to open scylla db connection:gocql: unable to create session: unable to discover protocol version: dial tcp [fd12:53c9:b73d::33:7a6d:51be]:9042: connect: connection refused
2024/03/10 19:00:51 gocql: dns error: lookup ticketing-api.railway.internal on [fd12::10]:53: dial udp [fd12::10]:53: connect: cannot assign requested address
2024/03/10 19:00:51 failed to open scylla db connection:gocql: unable to create session: failed to resolve any of the provided hostnames
a year ago
all listen addresses should be set to ::
SCYLLA_PORT is 9024.
is that a typo, where is 9024 coming from?
a year ago
Ok, yes all are set to ::
sorry the port is 9042.
Attachments
a year ago
I didn't actually make any changes I just clicked edit to see the port I had already set.
Still getting those errors :/
do you know of any projects with a similar setup to mine i can look at?
I've seen:
https://github.com/null2264/ScyllaDB-Railway
and based mine off this, and when i deploy it it seems to work but still not sure whats up with mine.
a year ago
not blue anymore, still same problem.
Attachments
a year ago
I may be colorblind, but that's still blue?
also, you keep mentioning docker-compose, but railway does not support docker-compose, so how are you running it on railway?