简体   繁体   中英

'OperationalError: could not connect to server: Connection refused.' after Odoo install

I'm a PostgreSQL novice trying to install the community version of Odoo 9 on Windows Server 2003. I ran the 'all in one' installer, which apparently succeeded, but when Odoo launched after the end of the installation, I got the following message:

Internal Server Error The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

Looking into the server logs seems to indicate that there is a problem with postgre:

I found this in the openerp-server.log:

2016-05-26 20:05:57,515 4060 INFO ? openerp.addons.bus.models.bus: Bus.loop listen imbus on db postgres

2016-05-26 20:05:58,608 4060 INFO ? openerp.sql_db: Connection to the database failed

2016-05-26 20:05:58,608 4060 ERROR ? openerp.addons.bus.models.bus: Bus.loop error, sleep and retry

Traceback (most recent call last):

File "C:\Odoo 9.0-20160523\server\openerp\addons\bus\models\bus.py", line 168, in run

File "C:\Odoo 9.0-20160523\server\openerp\addons\bus\models\bus.py", line 146, in loop

File "C:\Odoo 9.0-20160523\server\.\openerp\sql_db.py", line 630, in cursor

File "C:\Odoo 9.0-20160523\server\.\openerp\sql_db.py", line 164, in
__init__

File "C:\Odoo 9.0-20160523\server\.\openerp\sql_db.py", line 513, in
_locked

File "C:\Odoo 9.0-20160523\server\.\openerp\sql_db.py", line 581, in borrow

File "psycopg2\__init__.pyc", line 164, in connect

OperationalError: could not connect to server: Connection refused (0x0000274D/10061)

Is the server running on host "localhost" (127.0.0.1) and accepting

TCP/IP connections on port 5432?

It looks pretty obvious that Odoo can't connect to Postgresql. Here is what I've tried:

  • Connecting to the postgresql server through the PgAdmin III application that was installed with Odoo, but I get the same 'could not connect' message, which got me thinking that postgre may not be running,
  • I ran the command pg_ctl -D "c:\\Odoo 9.0-20160523\\PostgreSQL\\data" -l logfile start , to which I got a response "server starting". The symptoms did not change after this.
  • I found a post suggesting that postgre should be listed as a windows service and should be running. It was not listed as a service, so I ran this command: pg_ctl.exe register -N postgres -U postgres -P postgrespass -D "c:/Odoo 9.0-20160523/PostgreSQL/data" . This created the service, but when I started it manually, I get the message

The postgres service on Local Computer started and then stopped. Some services stop automatically if they have no work to do, for example, the Performance Logs and Alerts service.

  • Looking in the windows eventss, I see an event that contains this:

postgres cannot access the server configuration file "c:/Odoo 9.0-20160523/PostgreSQL/data/postgresql.conf": No such file or directory'. Looking for this error, I found some suggestions to search for this file, so I did and found 'postgresql.conf.sample

so I copied it, dropped it in the data folder, removed the .sample extension and attempted to start the service again. This lead to more errors in the event log, including this:

'FATAL: "c:/Odoo 9.0-20160523/PostgreSQL/data" is not a valid data directory DETAIL: File "c:/Odoo 9.0-20160523/PostgreSQL/data/PG_VERSION" is missing.'

  • I found on postgresql.com that suggested that the data directory should have other contents (mine currently has only the postgresql.conf file that I dropped in there).

I also found this in the openerp-server.conf:

db_host = localhost
db_maxconn = 64 
db_name = False 
db_password = openpgpwd 
db_port = 5432 
db_template = template1 
db_user = openpg

Does that look correct? Should db_name = false ?

I'm not sure how to proceed from here. Any suggestions?

UPDATE

Installing on Windows 7 works as expected with the same installation file. Could this be a compatibility issue with Server 2003? I saw no system requirements for Odoo or PostgreSQL that indicated an incompatibility with Windows Server 2003.

I've solved this problem after installing pg_agent package, to do that :

  1. go to yourOdooFoalder/ PostgreSQL/ bin
  2. run stackbuilder.exe application.
  3. install pg_agent package ( look at the picture ).
  4. restart your computer.

The server should automatically starts, if not start it manually.

pg_Agent

Best regards

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