Score:-2

After restarting server Postgres does not start

pl flag

I am running Postgres 14 on a Windows Server 2022 Standard. While DB operations were running such as inserting, my server restarted, and, now the Postgres does not start. I looked at the config file and the last lines of that are as follows:

2023-04-23 01:43:36.913 PDT [123528] LOG:  could not receive data from client: An existing connection was forcibly closed by the remote host.

    
2023-04-23 01:52:04.222 PDT [105764] LOG:  could not receive data from client: An existing connection was forcibly closed by the remote host.

    
2023-04-23 01:52:04.223 PDT [118464] LOG:  could not receive data from client: An existing connection was forcibly closed by the remote host.

    
2023-04-23 01:54:38.568 PDT [121492] LOG:  could not receive data from client: An existing connection was forcibly closed by the remote host.

    
2023-04-23 01:54:38.569 PDT [123696] LOG:  could not receive data from client: An existing connection was forcibly closed by the remote host.

    
2023-04-23 01:59:51.982 PDT [124252] LOG:  could not receive data from client: An existing connection was forcibly closed by the remote host.

    
2023-04-23 01:59:51.983 PDT [122440] LOG:  could not receive data from client: An existing connection was forcibly closed by the remote host.

    
2023-04-23 01:59:51.983 PDT [116252] LOG:  could not receive data from client: An existing connection was forcibly closed by the remote host.

    
2023-04-23 02:00:52.468 PDT [4988] LOG:  received fast shutdown request
2023-04-23 02:00:52.572 PDT [4988] LOG:  aborting any active transactions
2023-04-23 02:00:52.611 PDT [6172] FATAL:  terminating connection due to administrator command
2023-04-23 02:00:52.683 PDT [5984] ERROR:  canceling statement due to user request
2023-04-23 02:00:52.716 PDT [4988] LOG:  background worker "logical replication launcher" (PID 5984) exited with exit code 1
2023-04-23 02:00:52.903 PDT [5916] LOG:  shutting down
2023-04-23 02:00:55.161 PDT [4988] LOG:  database system is shut down

Also, as suggested by others I check Event Viewer and see:

2023-04-23 03:33:39.610 PDT [5804] FATAL:  configuration file "C:/Program Files/PostgreSQL/14/data/postgresql.conf" contains errors

Since I am using psycopg to work with db, I am getting the following errors:

File "C:\Python310\lib\site-packages\psycopg2\__init__.py", line 122, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) connection to server at "localhost" (::1), port 5432 failed: Connection refused (0x0000274D/10061)      
        Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused (0x0000274D/10061)
        Is the server running on that host and accepting TCP/IP connections?

config file

For size limitation, I removed all comments:

listen_addresses = '*'      # what IP address(es) to listen on;
port = 5432         # (change requires restart)
max_connections = 100           # (change requires restart)
shared_buffers = 4096MB         # min 128kB
work_mem = 2000MB               # min 64kB
maintenance_work_mem = 3000MB       # min 1MB
dynamic_shared_memory_type = windows    # the default is the first option
max_wal_size = 1GB
min_wal_size = 80MB
effective_cache_size = 4GB
log_destination = 'stderr'
logging_collector = on      # Enable capturing of stderr and csvlog
log_timezone = 'America/Los_Angeles'
datestyle = 'iso, mdy'
timezone = 'America/Los_Angeles'
lc_messages = 'English_United States.1252'          # locale for system error message
                    # strings
lc_monetary = 'English_United States.1252'          # locale for monetary formatting
lc_numeric = 'English_United States.1252'           # locale for number formatting
lc_time = 'English_United States.1252'              # locale for time formatting
default_text_search_config = 'pg_catalog.english'

I have not a recent DB backup. How should I conquer the problem?

keramat avatar
pl flag
Perhaps it is better to guide instead down vote. Let me know what is the problem with my question.
Nikita Kipriyanov avatar
za flag
Configuration file has a problem. Guess what to do? Hint: even if I wanted to help you to find an error in that file, I couldn't...
keramat avatar
pl flag
So, what should i do? My config file is almost as the original. I just changed some parameters for more memory. The changes were not placed recently, and every thing was working nice. I think the error is somehow misleading. Can, I find more information any where in the windows or logs?
Nikita Kipriyanov avatar
za flag
Show the file. No one can help with this other way than evaluate. Also, notice that Postgres combines configuration data from several files; this might be not the file you remember you've edited.
keramat avatar
pl flag
Thanks, attached the config. The size of text is more than limit of questions. please look at the question.
Nikita Kipriyanov avatar
za flag
Please attach it [into the question](https://serverfault.com/posts/1129471/edit). I think there might be people who are fine with walking several clicks away into obscure service to read the file, but here we want to have the question understandable without external resources. But it might be good to remove comments.
keramat avatar
pl flag
Added to question.
Score:0
pl flag

Thanks to @Nikita Kipriyanov, Solved the problem by replacing a new config file from another installation.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.