PostgreSQL Problem

Hello,
I hope you can help me

I have a problem in the PostgreSQL databse:

I always get this:
level=warning msg=“storage: ping PostgreSQL database error, will retry in 2s” error=“dial tcp xx.xxx…xx:xx connect: connection timed out”
Is this an error ?

What exactly does this mean

thanks

yes

that your postgresql isn’t running.

is there a command to start it because my postgresql is running in azure

Probably it is running, but ChirpStack can’t connect. Are you sure your PostgreSQL database is reachable from the machine on which ChirpStack is running?

yes , in Azure the resource group chirpstack_ns and chirpstack_as are inside. I have edited the steps and created the database. But I keep getting this timed out error. :confused:
What is the reason for this?
Maybe it has something to do with the timezone?

The issue is network related, not related to timezones.

1 Like

The both chirpstack-server is active(running) but the same problem with the connectuon. How can I find out if the network is the problem?
What can I try to get it to connect to the network.

i hope you can give me some tips to look up

can the problem also come from the config file if it is somewhere else than it should be ?

Can you provide your Postgresql dsn connection string from chripstack-network-server.toml?

I have a recent install of ChirpStack v4 on 32-bit Raspberry Pi OS 6.1.21-v8+.

It worked fine for several days. After a reboot I get the following which seems related to this issue:

Aug 25 19:59:26 Snyder1 systemd[1]: chirpstack.service: Scheduled restart job, restart counter is at 261.
Aug 25 19:59:26 Snyder1 systemd[1]: Stopped ChirpStack open-source LoRaWAN Network Server.
Aug 25 19:59:26 Snyder1 systemd[1]: Started ChirpStack open-source LoRaWAN Network Server.
Aug 25 19:59:26 Snyder1 chirpstack[5211]: 2023-08-26T02:59:26.440665Z INFO chirpstack::cmd::root: Starting ChirpStack LoRaWAN Network Server version=“4.4.3” docs=“https://www.chirpstack.io/
Aug 25 19:59:26 Snyder1 chirpstack[5211]: 2023-08-26T02:59:26.440773Z INFO chirpstack::storage: Setting up PostgreSQL connection pool
Aug 25 19:59:56 Snyder1 chirpstack[5211]: Error: Setup PostgreSQL connection pool error
Aug 25 19:59:56 Snyder1 chirpstack[5211]: Caused by:
Aug 25 19:59:56 Snyder1 chirpstack[5211]: timed out waiting for connection: could not connect to server: Connection refused
Aug 25 19:59:56 Snyder1 chirpstack[5211]: Is the server running on host “localhost” (::1) and accepting
Aug 25 19:59:56 Snyder1 chirpstack[5211]: TCP/IP connections on port 5432?
Aug 25 19:59:56 Snyder1 chirpstack[5211]: could not connect to server: Connection refused
Aug 25 19:59:56 Snyder1 chirpstack[5211]: Is the server running on host “localhost” (127.0.0.1) and accepting
Aug 25 19:59:56 Snyder1 chirpstack[5211]: TCP/IP connections on port 5432?
Aug 25 19:59:56 Snyder1 chirpstack[5211]:
Aug 25 19:59:56 Snyder1 systemd[1]: chirpstack.service: Main process exited, code=exited, status=1/FAILURE
Aug 25 19:59:56 Snyder1 systemd[1]: chirpstack.service: Failed with result ‘exit-code’.
Aug 25 19:59:56 Snyder1 systemd[1]: chirpstack.service: Scheduled restart job, restart counter is at 262.

The only way out of this I have found is to remove PostgreSQL and reinstall per the ChirpStack install instructions. Getting ready to deploy this in the field so need it to be rock solid. Any thoughts? I have read it is better to install Postgres on SSD vs SDcard.

DM

Maybe you need to enable PostgreSQL on boot? I’m not sure, you need to find out why PostgreSQL doesn’t start after a reboot.

Getting ready to deploy this in the field so need it to be rock solid. Any thoughts? I have read it is better to install Postgres on SSD vs SDcard.

You probably want to look into SD Card wear out. Continuous writing to a SD Card will have its impact on the lifespan of a SD Card. For testing purposes a SD Card might not be an issue, but for actual deployments I would consider a SSD instead.

Thanks for the reply, good suggestion on the SSD. It is a new system so SD Card should be OK at the moment - I’ve seen this on 2 systems (RPi4). postgresql is enabled on boot. I think what happened is someone powered the systems down without shutdown and some how corrupted the database. I need to learn more about postgresql to know how to recover without having to re-enter everything. Haven’t seen a backup and restore procedure for v4 ChirpStack data.