3

我正在尝试在 lxc 容器内的 ubuntu 12.04 上安装 openerp 7。数据库服务器位于主机上。一切正常,但是当我第一次尝试访问 webclient 时,我在浏览器中(也在终端中)出现错误,即 openerp 无法连接到数据库服务器。这是我的 openerp-server.conf 文件:

[options]
; This is the password that allows database operations:
; admin_passwd = admin
debug_mode = True
db_host = '10.0.3.1'
db_port = 5432
db_user = openerp
db_password = openerp
db_name = openerp
logfile = /var/log/openerp/openerp-server.log

我也试过

db_host = 10.0.3.1

当我启动服务器时,我收到了以下信息消息:

2013-01-08 22:46:39,688 654 INFO ? openerp: OpenERP version 7.0-20130106-001538
2013-01-08 22:46:39,688 654 INFO ? openerp: addons paths: /opt/openerp/server/openerp/addons
2013-01-08 22:46:39,688 654 INFO ? openerp: database hostname: localhost
2013-01-08 22:46:39,688 654 INFO ? openerp: database port: 5432
2013-01-08 22:46:39,688 654 INFO ? openerp: database user: openerp
2013-01-08 22:46:40,106 654 INFO ? openerp.service.wsgi_server: HTTP service (werkzeug) running on 0.0.0.0:8069
2013-01-08 22:46:40,106 654 INFO ? openerp: OpenERP server is running, waiting for connections...

日志文件有 777 权限,为空。当我尝试从浏览器访问 openerp 时,这是错误的一部分:

ERROR postgres openerp.sql_db: Connection to the database failed
Traceback (most recent call last):
  File "/opt/openerp/server/openerp/sql_db.py", line 433, in borrow
    result = psycopg2.connect(dsn=dsn, connection_factory=PsycoConnection)
  File "/usr/lib/python2.7/dist-packages/psycopg2/__init__.py", line 179, in connect
    connection_factory=connection_factory, async=async)
OperationalError: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

2013-01-08 22:48:21,553 654 ERROR postgres openerp.netsvc: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Traceback (most recent call last):
  File "/opt/openerp/server/openerp/netsvc.py", line 289, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/opt/openerp/server/openerp/service/web_services.py", line 122, in dispatch
    return fn(*params)

db 服务器正在接受来自 lxc 容器的连接,我创建了一个小的 python 脚本来测试它并且它有效。

谢谢

4

3 回答 3

4

您输出的第三行表明 OpenERP 正在寻找数据库服务器localhost。我猜 OE 没有看到你的配置文件。作为一项快速测试,您可以手动运行 OE,例如:

/usr/local/bin/openerp-server --conf /path/to/config_file

看看这是否有效。如果是这样,请找到适当的启动脚本并使用您的配置文件和日志文件参数对其进行调整。

于 2013-01-08T23:57:33.557 回答
2

我最近安装了 OpenERP v7.0,这个博客对我帮助很大。请参阅在 Ubuntu 上安装 OpenERP 7.0

希望这会帮助你。

于 2013-01-09T06:05:21.077 回答
0

我通过修改这个文件解决了同样的问题:

/usr/lib/python2.6/site-packages/openerp-7.0_20130211_002141-py2.6.egg/openerp/tools/config.py

里面有一段:

    if self.options['db_password']:
        if sys.platform == 'win32' and not self.options['db_host']:
            self.options['db_host'] = 'localhost'
        #if self.options['db_host']:
        #    self._generate_pgpassfile()

    if opt.save:
        self.save()

在“if op.save:”之前添加:

    self.options['db_host'] = '<address_of_db_host>'
于 2013-02-11T10:36:17.803 回答