odoo系统一直起不来,提示我地址被占用
odoo@vm:~/odoo12$ ./odoo-bin -i base -d odoo
2022-01-21 07:14:23,048 7984 INFO ? odoo: Odoo version 12.0
2022-01-21 07:14:23,049 7984 INFO ? odoo: addons paths: ['/opt/odoo/.local/share/Odoo/addons/12.0', '/opt/odoo/odoo12/odoo/addons', '/opt/odoo/odoo12/addons']
2022-01-21 07:14:23,049 7984 INFO ? odoo: database: default@default:default
2022-01-21 07:14:23,303 7984 INFO ? odoo.addons.base.models.ir_actions_report: You need Wkhtmltopdf to print a pdf version of the reports.
Exception in thread odoo.service.httpd:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/opt/odoo/odoo12/odoo/service/server.py", line 437, in http_thread
self.httpd = ThreadedWSGIServerReloadable(self.interface, self.port, app)
File "/opt/odoo/odoo12/odoo/service/server.py", line 150, in __init__
handler=RequestHandler)
File "/opt/odoo/.local/lib/python3.6/site-packages/werkzeug/serving.py", line 698, in __init__
HTTPServer.__init__(self, server_address, handler)
File "/usr/lib/python3.6/socketserver.py", line 456, in __init__
self.server_bind()
File "/opt/odoo/odoo12/odoo/service/server.py", line 165, in server_bind
super(ThreadedWSGIServerReloadable, self).server_bind()
File "/usr/lib/python3.6/http/server.py", line 136, in server_bind
socketserver.TCPServer.server_bind(self)
File "/usr/lib/python3.6/socketserver.py", line 470, in server_bind
self.socket.bind(self.server_address)
OSError: [Errno 98] Address already in use
通过命令查看
odoo@vm:~/odoo12$ netstat -anp |grep 8069
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:8069 0.0.0.0:* LISTEN 3292/python
确实被python占用了
再确认一遍
odoo@vm:~/odoo12$ netstat -nultp
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:25324 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:81 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:8883 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:43013 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:8069 0.0.0.0:* LISTEN 3292/python
tcp 0 0 0.0.0.0:5671 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:5000 0.0.0.0:* LISTEN -
tcp6 0 0 :::81 :::* LISTEN -
tcp6 0 0 :::8883 :::* LISTEN -
tcp6 0 0 :::22 :::* LISTEN -
tcp6 0 0 :::5432 :::* LISTEN -
tcp6 0 0 :::443 :::* LISTEN -
tcp6 0 0 :::5671 :::* LISTEN -
tcp6 0 0 :::5000 :::* LISTEN -
udp 0 0 127.0.0.1:25224 0.0.0.0:* -
udp 0 0 127.0.0.53:53 0.0.0.0:* -
udp 0 0 10.0.0.5:68 0.0.0.0:* -
无误,使用kill命令杀掉该进程
odoo@vm:~/odoo12$ kill -9 3292
odoo@vm:~/odoo12$
odoo@vm:~/odoo12$ netstat -anp |grep 8069
(No info could be read for "-p": geteuid()=990 but you should be root.)
稍后重启系统,发现可以正常启动。
PS:
如果netstat 查看到pid进程号为空,则可以通过 top 命令查看系统进程。
或者 ps -u odoo 命令找到odoo 用户占用 的 python3 pid,则它就是需要被kill 的pid。
参见:
https://www.cnblogs.com/hindy/p/7249234.html