简体   繁体   中英

It is unable to restart postgresql in wsl(ubuntu)

I am using ubuntu 18.04 on Windows. I can not start postgresql status down to online. At the time I just installed postgres 11, the status was online at port 5433 and it seemed working well. Then it went down and never goes online again.

The postgresql status is now

11/main (port 5433): down

and when I try to restart by sudo pg_ctlcluster 11 main restart , sudo /etc/init.d/postgresql restart , then the error code goes like below.

Restarting PostgreSQL 11 database server
Error: /usr/lib/postgresql/11/bin/pg_ctl /usr/lib/postgresql/11/bin/pg_ctl 
start -D /var/lib/postgresql/11/main -l /var/log/postgresql/postgresql-11- 
main.log -s -o  -c config_file="/etc/postgresql/11/main/postgresql.conf"  
exited with status 1:
2019-04-02 19:36:27.783 DST [3195] LOG:  listening on IPv4 address 
"127.0.0.1", port 5433
2019-04-02 19:36:27.798 DST [3195] LOG:  listening on Unix socket 
"/var/run/postgresql/.s.PGSQL.5433"
2019-04-02 19:36:27.852 DST [3196] LOG:  database system was interrupted; 
last known up at 2019-04-02 18:39:14 DST
2019-04-02 19:36:27.853 DST [3196] PANIC:  could not flush dirty data: 
Function not implemented
2019-04-02 19:36:27.853 DST [3195] LOG:  startup process (PID 3196) was 
terminated by signal 6: Aborted
2019-04-02 19:36:27.853 DST [3195] LOG:  aborting startup due to startup 
process failure
2019-04-02 19:36:27.860 DST [3195] LOG:  database system is shut down
pg_ctl: could not start server
Examine the log output.

I thought the problem was related to port settings, so I looked up some files. At /etc/services, postgresql is set as 5432

postgresql      5432/tcp        postgres        # PostgreSQL Database
postgresql      5432/udp        postgres

and at /etc/postgresql/11/main/postgresql.conf, the port is set as 5433

port = 5433 

I don't know why the port number is set different with each other. Since there is nothing running on both port 5432, 5433, I really don't know why the postgresql cannot go on online status. Let me know if there is more informations to fix it.

I met the same problem.

And I just turn the fsync option to off (this option is in the postgresql.conf file), then everything turns okay. Becareful, this workaround is not suitable for production environment.

Check this for detail:

https://askubuntu.com/questions/1121820/postgresql-not-starting

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM