PostgreSQL在从14.04升级到Ubuntu 15.04后开始停止

时间:2022-09-27 22:55:26

I have a rails application that uses PostgreSQL. Today is the first time messing around with it after upgrading to Ubuntu 15.04 from 14.04 (I upgraded just about a week ago). When I try to start the rails server, it says:

我有一个使用PostgreSQL的rails应用程序。从14.04升级到Ubuntu 15.04(我大约一周前升级),今天是第一次搞乱它。当我尝试启动rails服务器时,它说:

"/home/nate/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `initialize': could not connect to server: Connection refused (PG::ConnectionBad)
    Is the server running on host "localhost" (127.0.0.1) and accepting
    TCP/IP connections on port 5432?"

Based on this message, I first tried rebooting and then when that did not work, ran this command to start the server:

基于此消息,我首先尝试重新启动,然后当它不起作用时,运行此命令以启动服务器:

sudo /etc/init.d/postgresql start

I ran the rails server and it worked! However, after clicking around a few times I got another similar message and noticed that the service had stopped again. I started it again and then a few minutes later it happened again.

我运行了rails服务器,它运行了!但是,在点击几次后,我收到了另一条类似的消息,并注意到该服务再次停止。我又开始了,几分钟后再次发生了。

Next, I checked the PostgreSQL log and found this. I see several "record with zero length at..." entries as well as "database system was interrupted" and "database was not properly shut down". After some more searching I found some posts that said to use "pg_resetxlog", but with no real details on how to issue the command (it requires additional parameters)...but other sites say only do that as a very last resort. So I'm not sure what to do. Any ideas? Here is the PostgreSQL log:

接下来,我检查了PostgreSQL日志并找到了这个。我看到几个“记录零长度......”条目以及“数据库系统被中断”和“数据库没有正确关闭”。经过一些搜索,我发现一些帖子说使用“pg_resetxlog”,但没有关于如何发出命令的真实细节(它需要额外的参数)......但是其他网站说只做这个作为最后的手段。所以我不知道该怎么做。有任何想法吗?这是PostgreSQL日志:

2015-05-14 14:46:40 CDT [12654-1] LOG:  database system was shut down at 2015-05-07 20:20:04 CDT
    2015-05-14 14:46:40 CDT [12655-1] [unknown]@[unknown] LOG:  incomplete startup packet
    2015-05-14 14:46:40 CDT [12659-1] LOG:  autovacuum launcher started
    2015-05-14 14:46:40 CDT [12653-1] LOG:  database system is ready to accept connections
    2015-05-14 14:49:42 CDT [12871-1] LOG:  database system was interrupted; last known up at 2015-05-14 14:46:40 CDT
    2015-05-14 14:49:42 CDT [12871-2] LOG:  database system was not properly shut down; automatic recovery in progress
    2015-05-14 14:49:42 CDT [12871-3] LOG:  record with zero length at 0/147A88F8
    2015-05-14 14:49:42 CDT [12871-4] LOG:  redo is not required
    2015-05-14 14:49:42 CDT [12875-1] LOG:  autovacuum launcher started
    2015-05-14 14:49:42 CDT [12870-1] LOG:  database system is ready to accept connections

1 个解决方案

#1


0  

  1. Please edit this file postgresql.conf listen_addresses = '*'
  2. 请编辑此文件postgresql.conf listen_addresses ='*'

  3. Edit this file pg_hba.conf and add host all all 127.0.0.1/32 md5
  4. 编辑此文件pg_hba.conf并添加所有127.0.0.1/32 md5的主机

#1


0  

  1. Please edit this file postgresql.conf listen_addresses = '*'
  2. 请编辑此文件postgresql.conf listen_addresses ='*'

  3. Edit this file pg_hba.conf and add host all all 127.0.0.1/32 md5
  4. 编辑此文件pg_hba.conf并添加所有127.0.0.1/32 md5的主机