基本信息:System:Ubuntu 20.04.6 LTS x86_64(Py3.7.9)
odoo 16 社区版
postgresql 版本12
odoo 常用文件目录:/opt/odoo16
odoo 运行日志目录:/var/log/odoo
odoo 图片等文件目录:/opt/odoo16/.local/share/Odoo/filestore
postgresql 常用目录:/etc/postgresql/12/main
复制文件过程中注意文件权限,以及所属用户。
首先在复制源服务器中odoo自带的数据库管理中备份相关数据库,注意如果你的数据库有大量图片数据,则选择仅备份dump文件,然后在filestore中复制对应文件到新服务器。
在新服务器安装同样的odoo版本以及数据库之后,在odoo服务器管理数据库,选择恢复数据库,选择之前备份的文件并恢复。(选择数据库移动,不选择中性该数据库)
- 中性数据库仅用于测试数据库,测试过程不会触发任何邮件发送等行为。
在迁移过程中出现500服务器未响应 :
解决:经检查日志发现是point-of-sale插件问题,从复制源旧服务器中找到该插件并替换解决问题。(注意替换后重启odoo服务)
在日志中出现该错误:(重点缺失某filestore中的文件)
2024-03-27 10:46:54,098 2871925 ERROR almacen1 odoo.http: Exception during request handling. Traceback (most recent call last): File "/opt/odoo16/odoo/http.py", line 2044, in __call__ response = request._serve_db() File "/opt/odoo16/odoo/http.py", line 1633, in _serve_db return service_model.retrying(self._serve_ir_http, self.env) File "/opt/odoo16/odoo/service/model.py", line 133, in retrying result = func() File "/opt/odoo16/odoo/http.py", line 1660, in _serve_ir_http response = self.dispatcher.dispatch(rule.endpoint, args) File "/opt/odoo16/odoo/http.py", line 1774, in dispatch return self.request.registry['ir.http']._dispatch(endpoint) File "/opt/odoo16/odoo/addons/base/models/ir_http.py", line 154, in _dispatch result = endpoint(**request.params) File "/opt/odoo16/odoo/http.py", line 697, in route_wrapper result = endpoint(self, *args, **params_ok) File "/opt/odoo16/addons/web/controllers/binary.py", line 109, in content_assets stream = request.env['ir.binary']._get_stream_from(record, 'raw', filename) File "/opt/odoo16/odoo/addons/base/models/ir_binary.py", line 129, in _get_stream_from stream = self._record_to_stream(record, field_name) File "/opt/odoo16/odoo/addons/base/models/ir_binary.py", line 73, in _record_to_stream return Stream.from_attachment(record) File "/opt/odoo16/odoo/http.py", line 473, in from_attachment stat = os.stat(self.path) FileNotFoundError: [Errno 2] No such file or directory: '/opt/odoo16/.local/share/Odoo/filestore/almacen1/2c/2cad117145973aede2c8e689f9c3f978127c7b25'
解决:从复制源旧服务器找到并复制到对应目录。