目前,我在不同的计算机上有两个不同的数据库,显示以下错误。第一次出现是几个月前,偶尔出现在日志中,有时连续多次出现,其他时间只出现一天。
只有在运行带有proxy_mode = True和/或工作人员数量的Odoo时才会发生这种情况。 0.禁用代理时,错误将停止。
Traceback (most recent call last):
File "/odoo/odoo-server/odoo/http.py", line 638, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/odoo/odoo-server/odoo/http.py", line 675, in dispatch
result = self._call_function(**self.params)
File "/odoo/odoo-server/odoo/http.py", line 331, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/odoo/odoo-server/odoo/service/model.py", line 119, in wrapper
return f(dbname, *args, **kwargs)
File "/odoo/odoo-server/odoo/http.py", line 324, in checked_call
result = self.endpoint(*a, **kw)
File "/odoo/odoo-server/odoo/http.py", line 933, in __call__
return self.method(*args, **kw)
File "/odoo/odoo-server/odoo/http.py", line 504, in response_wrap
response = f(*args, **kw)
File "/odoo/odoo-server/addons/bus/controllers/main.py", line 35, in poll
raise Exception("bus.Bus unavailable")
Exception: bus.Bus unavailable
这是我目前的Nginx配置:
upstream odoo10 {
server myipaddres:8069 weight=1 fail_timeout=0;
}
upstream odoo10-im {
server myipaddres:8072 weight=1 fail_timeout=0;
}
## http redirects to https ##
server {
listen 80;
server_name mydomain.com;
# Strict Transport Security
add_header Strict-Transport-Security max-age=2592000;
rewrite ^/.*$ https://$host$request_uri? permanent;
}
server {
# server port and name
listen 443 ssl;
server_name mydomain.com;
# Specifies the maximum accepted body size of a client request,
# as indicated by the request header Content-Length.
client_max_body_size 200m;
# add ssl specific settings
keepalive_timeout 60;
ssl on;
ssl_certificate /etc/ssl/nginx/mydomain.crt;
ssl_certificate_key /etc/ssl/nginx/mydomain.key;
# limit ciphers
ssl_ciphers HIGH:!ADH:!MD5;
ssl_protocols SSLv3 TLSv1;
ssl_prefer_server_ciphers on;
# increase proxy buffer to handle some OpenERP web requests
proxy_buffers 16 64k;
proxy_buffer_size 128k;
#general proxy settings
# force timeouts if the backend dies
proxy_connect_timeout 600s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
# set headers
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
# Let the OpenERP web service know that we’re using HTTPS, otherwise
# it will generate URL using http:// and not https://
proxy_set_header X-Forwarded-Proto https;
# by default, do not forward anything
proxy_redirect off;
proxy_buffering off;
location / {
proxy_pass http://odoo10;
}
location /longpolling {
proxy_pass http://odoo10-im;
}
# cache some static data in memory for 60mins.
# under heavy load this should relieve stress on the OpenERP web interface a bit.
location /web/static/ {
proxy_cache_valid 200 60m;
proxy_buffering on;
expires 864000;
proxy_pass http://odoo10;
}
}
与etc / odoo-conf相关的部分与表现有关:
[options]
# ...
db_maxconn = 64
limit_memory_hard = 2684354560
limit_memory_soft = 2147483648
limit_request = 8192
limit_time_cpu = 600 limit_time_real = 1200 limit_time_real_cron = 2400
max_cron_threads = 2
osv_memory_age_limit = 1.0
osv_memory_count_limit = False
proxy_mode = True
workers = 5 xmlrpc = True
xmlrpc_interface = myipaddress
netrpc_interface = myipaddress
# ...
目前在数字海洋基础设施上运行,在具有2GB内存和2个CPU内核的机器上运行。
答案 0 :(得分:0)
您需要很多行
最新文档:https://www.odoo.com/documentation/12.0/setup/deploy.html#https
一些值得注意的odoo.conf设置,db maxconn可能会导致postgres问题,其余部分假定至少有8GB RAM四核服务器,请参见此处的详细信息:https://gist.github.com/Guidoom/d5db0a76ce669b139271a528a8a2a27f
db_maxconn = 256
proxy_mode = True
limit_memory_hard = 1395864371
limit_memory_soft = 572662306
limit_request = 8192
limit_time_cpu = 1800
limit_time_real = 1800
workers = 9
这是一个有效的nginx配置,代理超时和上游内容似乎也很重要。但是,代理缓冲区值得商:: https://stackoverflow.com/a/50891625/1689770
请勿复制由certbot自动生成的certbot内容,我只是将其留在此处以供上下文参考
upstream odoo {
server 127.0.0.1:8069;
}
upstream odoochat {
server 127.0.0.1:8072;
}
server {
server_name example.com;
proxy_buffers 16 64k;
proxy_buffer_size 128k;
proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;
# Add Headers for odoo proxy mode
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
keepalive_timeout 600;
# Redirect longpoll requests to odoo longpolling port
location /longpolling {
proxy_pass http://odoochat;
}
# Redirect requests to odoo backend server
location / {
proxy_redirect off;
proxy_pass http://odoo;
}
# common gzip
gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
gzip on;
#location ~* /web/static/ {
# proxy_cache_valid 200 60m;
# proxy_buffering on;
# expires 864000;
# proxy_pass http://127.0.0.1/;
#}
# managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate mypath/fullchain.pem; # managed by Certbot
ssl_certificate_key mypath/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name example.com;
listen 80;
return 404; # managed by Certbot
}
答案 1 :(得分:-1)
在您的nginx.conf文件中,添加以下几行:
location /longpolling {
proxy_pass http://127.0.0.1:8072;
}
location / {
proxy_pass http://127.0.0.1:8069;
}