Postgres datastore connection issue

CentOS8
Postgres 12.1
sensu go 6.(latest)

Ive followed the postgres installation documents including creating a db and a user and granting them full access

I’ve also followed the instruction in the Doc to enable logging to the datastore with the following yaml

type: PostgresConfig
api_version: store/v1
metadata:
name: datastore-postgres
created_by: admin
spec:
dsn: “postgresql://datastore:datastore@postgres.kk.net:5432/datastore”
max_conn_lifetime: 5m
max_idle_conns: 2
pool_size: 20

sensuctl create -f datastore.yaml

generates the documented warning but also these errors

Aug 26 13:54:21 back61 sensu-backend[417530]: {“component”:“ent-store”,“error”:“Could not get DB version: pq: SSL is not enabled on the server”,“level”:“error”,“msg”:“error opening postgres store, retrying…”,“time”:“2020-08-26T13:54:21-04:00”}

so it is trying to connect and complaining there is no ssl, can that be turned off? also is it safe to assume sensu will go ahead and create its own table to log events too?

I am not seeing any db activity, have turned up a bit of logging

my backends are trying to connect but not going any further

all assistance appreciated

2020-08-26 13:58:15.030 EDT [496775] LOG: connection received: host=back63.kk.net port=43440
2020-08-26 13:58:15.030 EDT [496776] LOG: connection received: host=back61.kk.net port=50790
2020-08-26 13:58:15.035 EDT [496777] LOG: connection received: host=back62.kk.net port=35420
2020-08-26 13:58:15.038 EDT [496778] LOG: connection received: host=back61.kk.net port=50792
2020-08-26 13:58:15.041 EDT [496779] LOG: connection received: host=back62.kk.net port=35422
2020-08-26 13:58:16.034 EDT [496780] LOG: connection received: host=back63.kk.net port=43444
2020-08-26 13:58:16.037 EDT [496781] LOG: connection received: host=back63.kk.net port=43446
2020-08-26 13:58:16.042 EDT [496782] LOG: connection received: host=back61.kk.net port=50794
2020-08-26 13:58:16.046 EDT [496783] LOG: connection received: host=back62.kk.net port=35428
2020-08-26 13:58:16.047 EDT [496784] LOG: connection received: host=back61.kk.net port=50796
2020-08-26 13:58:16.050 EDT [496785] LOG: connection received: host=back62.kk.net port=35430

Maybe try:

dsn: “postgresql://datastore:datastore@postgres.kk.net:5432/datastore?sslmode=disable”

Or instead of disable you could use prefer and use SSL if the server supports it.

1 Like

Wow Todd, i literally just posted that, and showed it to Sean, he asked me “did you try what Todd said”, added, reloaded and its started right up, many thanks, might be worth a mention in your short doc as well.

Many thanks

1 Like