# Postgres datastore connection issue

**URL:** <https://discourse.sensu.io/t/postgres-datastore-connection-issue/2028>\
**Category:** Sensu Go\
**Created:** [August 26, 2020, 6:22pm UTC](https://discourse.sensu.io/t/postgres-datastore-connection-issue/2028 "2020-08-26T18:22:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ohhfine](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/ohhfine/32/434_2.png) [@ohhfine](https://discourse.sensu.io/u/ohhfine)\
**Post date:** [August 26, 2020, 6:22pm UTC](https://discourse.sensu.io/t/postgres-datastore-connection-issue/2028/1 "2020-08-26T18:22:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![todd](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/todd/32/936_2.png) [@todd](https://discourse.sensu.io/u/todd)\
**Post date:** [August 26, 2020, 6:37pm UTC](https://discourse.sensu.io/t/postgres-datastore-connection-issue/2028/2 "2020-08-26T18:37:03Z")

</div>

Maybe try:

```auto
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.

---

<div class="post-metadata">

**Author:** ![ohhfine](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/ohhfine/32/434_2.png) [@ohhfine](https://discourse.sensu.io/u/ohhfine)\
**Post date:** [August 26, 2020, 7:39pm UTC](https://discourse.sensu.io/t/postgres-datastore-connection-issue/2028/3 "2020-08-26T19:39:56Z")

</div>

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
