You will get this error when you reach the max connection count in PostgreSQL.
You need to increase the max connection count in the postgresql.conf file to fix the error.
You can learn the current max connection number by running the following command from the operating system.
cat postgresql.conf|grep max_conn
You can use the following command to find out where the postgresql.conf file is. It is in the directory after -D.
ps -ef | grep postgres
After entering the relevant directory with the command “cd”, you should enter the postgresql.conf file with the command below.
After finding the max_connections parameter, we press the insert key from the keyboard and increment the value.
To save and exit, we press Esc, wq, Enter, respectively. Then we restart the PostgreSQL service.
You can read the article “How To Stop, Start, Restart and Reload PostgreSQL Service” to restart the PostgreSQL service.
If you increase the Max_Connection parameter too much, you may not be able to start the service due to an error like the one below.
FATAL: could not create semaphores: No space left on device
You can read the article “FATAL: could not create semaphores: No space left on device” to solve this error.