例外:bus.Bus 不可用 Odoo 8 multiprocessing 与 nginx 作为代理服务器

Posted

技术标签:

【中文标题】例外:bus.Bus 不可用 Odoo 8 multiprocessing 与 nginx 作为代理服务器【英文标题】:Exception: bus.Bus unavailable Odoo 8 multiprocessing with nginx as a proxy server 【发布时间】:2016-09-29 06:35:28 【问题描述】:

我正在使用 nginx 作为代理服务器的多处理模式下开发 Odoo 8,我阅读了很多关于此错误的问题,但我仍然无法解决我的问题,我认为我无法运行 odoo在 gevent 模式下,我已经为 nginx 配置了 longpooling 位置,正如许多帖子所说,我的配置如下:-

nginx 配置:-

upstream odoo8 

server 127.0.0.1:8069 weight=1 fail_timeout=0;



upstream odoo8-im 

server 127.0.0.1:8072 weight=1 fail_timeout=0;



server 

listen 80;

server_name 138.201.xx.xx;

access_log /var/log/nginx/odoo.access.log;

error_log /var/log/nginx/odoo.error.log;

location /longpolling 

proxy_pass http://odoo8-im;

proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;

proxy_redirect off;

# set headers

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header X-Forwarded-Proto https;

proxy_connect_timeout 600;

proxy_send_timeout 600;

proxy_read_timeout 600;

send_timeout 600;



location / 

proxy_pass http://odoo8;

proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;

proxy_buffer_size 128k;

proxy_buffers 16 64k;

proxy_redirect off;

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

# proxy_set_header X-Forwarded-Proto https;

proxy_connect_timeout 600;

proxy_send_timeout 600;

proxy_read_timeout 600;

send_timeout 600;



location ~* /web/static/ 

proxy_buffering on;
proxy_pass 127.0.0.1:8069;




odoo.config:-

; This is the password that allows database operations:

; admin_passwd = admin

db_host = False

db_port = False

db_user = odoo

db_password = odoo

addons_path = /opt/odoo/addons,/opt/odoo/addons/sale-workflow-8.0,/opt/odoo/addons/product-attribute-8.0,/opt/odoo/addons/e-commerce-8.0,/opt/odoo/addons/connector-magento-8.0,/opt/odoo/addons/connector-ecommerce-8.0,/opt/odoo/addons/connector-8.0

logfile = /var/log/odoo/odoo-server.log

workers = 12

limit_time_real = 600

limit_time_cpu = 300

请注意,我将 odoo 服务器作为服务运行,配置如下:-

#!/bin/sh

### BEGIN INIT INFO

# Provides: odoo-server

# Required-Start: $remote_fs $syslog

# Required-Stop: $remote_fs $syslog

# Should-Start: $network

# Should-Stop: $network

# Default-Start: 2 3 4 5

# Default-Stop: 0 1 6

# Short-Description: Complete Business Application software

# Description: Odoo is a complete suite of business tools.

### END INIT INFO

PATH=/usr/local/bin:/bin:/sbin:/usr/bin

DAEMON=/opt/odoo/openerp-server

NAME=odoo-server

DESC=odoo-server

ODOO_CONNECTOR_CHANNELS=root:4,root.magento:2

# Specify the user name (Default: odoo).

USER=odoo

# Specify an alternate config file (Default: /etc/odoo-server.conf).

CONFIGFILE="/etc/odoo-server.conf"

# pidfile

PIDFILE=/var/run/$NAME.pid

# Additional options that are passed to the Daemon.

DAEMON_OPTS="-c $CONFIGFILE"

[ -x $DAEMON ] || exit 0

[ -f $CONFIGFILE ] || exit 0

checkpid() 

[ -f $PIDFILE ] || return 1

pid=`cat $PIDFILE`

[ -d /proc/$pid ] && return 0

return 1



case "$1" in
start)

echo -n "Starting $DESC: "

start-stop-daemon --start --quiet --pidfile $PIDFILE \

--chuid $USER --background --make-pidfile \

--exec $DAEMON -- $DAEMON_OPTS

echo "$NAME."

;;

stop)

echo -n "Stopping $DESC: "

start-stop-daemon --stop --quiet --pidfile $PIDFILE \

--oknodo

echo "$NAME."

;;

restart|force-reload)

echo -n "Restarting $DESC: "

start-stop-daemon --stop --quiet --pidfile $PIDFILE \

--oknodo

sleep 1

 start-stop-daemon --start --quiet --pidfile $PIDFILE \

--chuid $USER --background --make-pidfile \

--exec $DAEMON -- $DAEMON_OPTS

echo "$NAME."

;;

*)

N=/etc/init.d/$NAME

echo "Usage: $NAME start|stop|restart|force-reload" >&2

exit 1

;;

esac

exit 0

对不起,如果我的问题是重复的,但我真的无法解决它:(

【问题讨论】:

检查this post是否对您有帮助 谢谢@ChesuCR,我现在的配置与链接中提到的完全一样,除了 ssl 设置,因为我还没有设置 ssl 证书,但我的日志中仍然有这个错误:-2016/06/05 08:55:52 [error] 9703#0: *5 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.127, server: 192.168.1.127, request: "POST /longpolling/poll HTTP/1.1", upstream: "http://127.0.0.1:8072/longpolling/poll", host: "192.168.1.127", referrer: "http://192.168.1.127/web" 最新文档:odoo.com/documentation/12.0/setup/deploy.html#https 【参考方案1】:

在你的 nginx.conf 中

location /longpolling 

     proxy_pass http://odoo8-im:8072;

     

【讨论】:

【参考方案2】:

您的 Odoo 配置丢失:

proxy_mode = True

【讨论】:

谢谢@CZoellner 我将它添加到我的配置中,但仍然出现以下错误:- 2016/06/05 08:55:52 [error] 9703#0: *5 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.127, server: 192.168.1.127, request: "POST /longpolling/poll HTTP/1.1", upstream: "http://127.0.0.1:8072/longpolling/poll", host: "192.168.1.127", referrer: "http://192.168.1.127/web" 你在什么操作系统上?使用 12 个工作线程(配置)和 2 个 crons(默认),您的 odoo 进程必须有 15 个线程,包括一个 gevent 线程。如果您没有看到 gevent 线程,则安装 odoo 时出现问题。我在 debian 系统上遇到了同样的问题,并通过像 this 这样的手动安装解决了它,也许你也需要安装 psycogreen python lib。

以上是关于例外:bus.Bus 不可用 Odoo 8 multiprocessing 与 nginx 作为代理服务器的主要内容,如果未能解决你的问题,请参考以下文章

Wireless M-Bus介绍-摘自OMS

sd-bus API,sd_bus_request_name 返回权限被拒绝

g_bus_get_sync 返回 NULL 但 dbus_g_bus_get_private 有效

对缺失数据进行内部连接时的 SQL 删除

vue-bus全局事件中心简单Demo

如何导出DBUS_SESSION_BUS_ADDRESS