3

I've successfully gotten stellar-core itself to connect to my postgresql database using a Unix socket, like this: DATABASE="postgresql://dbname=stellarb user=stellarb host=/var/run/postgresql" Now, I want Horizon to connect over the socket as well, but horizon keeps saying that the database at /var/run/postgresql/horizon can't be found. Here is my connection string: --db-url postgresql://horizon@/var/run/postgresql/horizon

How would I modify this connection to point to the socket successfully? Does Horizon support connecting over Unix sockets? I'm performing a stress test and think connecting over sockets will speed up the response time of Horizon somewhat. Right now I'm connecting over localhost.

0

Horizon is using github.com/lib/pq Golang package to connect to Postgres. This package is using a different connection string. From the docs:

host - The host to connect to. Values that start with / are for unix domain sockets. (default is localhost)

So for you, the connection string should look like:

user=horizon host=/var/run/postgresql/horizon

Please note that when using spaces in CLI command params you may need to enquote them like:

--db-url="user=horizon host=/var/run/postgresql/horizon"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.