Seahub频繁出现操作连接数据库失败

物理主机系统: Windows server 2019 Datecenter (v1809, 17763.805)
Docker: Docker for windows 2.2.0.3 (Engine: 19.03.5, Compose: 1.25.4)
MySQL: MySQL for win64 8.0.18 Community Server

除了MySQL,其余所有环境都在Docker内部,Mysql参数已经十分暴力地堆性能,依然解决不了问题

暂时还没尝试将MySQL也内置到Docker内,在网页端高频率切换页面、访问文件就会卡死在loading,必须等到OperationalError: (2003, “Can’t connect to MySQL server on ‘192.168.9.13’ (110)”)才有反应

Seahub.log如下:

2020-03-11 13:14:21,560 [ERROR] django.request:135 handle_uncaught_exception Internal Server Error: /thumbnail/cbc4110e-dbd2-4f92-a5d4-29349c009a3c/48/Camera Uploads/IMG_20150819_141438_FC3B.JPG
Traceback (most recent call last):
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/core/handlers/base.py", line 244, in _legacy_get_response
    response = middleware_method(request)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/middleware/locale.py", line 25, in process_request
    language = translation.get_language_from_request(request, check_path=i18n_patterns_used)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/utils/translation/__init__.py", line 211, in get_language_from_request
    return _trans.get_language_from_request(request, check_path)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/utils/translation/trans_real.py", line 519, in get_language_from_request
    lang_code = request.session.get(LANGUAGE_SESSION_KEY)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/contrib/sessions/backends/base.py", line 68, in get
    return self._session.get(key, default)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/contrib/sessions/backends/base.py", line 207, in _get_session
    self._session_cache = self.load()
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/contrib/sessions/backends/db.py", line 35, in load
    expire_date__gt=timezone.now()
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/models/query.py", line 374, in get
    num = len(clone)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/models/query.py", line 232, in __len__
    self._fetch_all()
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/models/query.py", line 1118, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/models/query.py", line 53, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/models/sql/compiler.py", line 887, in execute_sql
    cursor = self.connection.cursor()
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/backends/base/base.py", line 254, in cursor
    return self._cursor()
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/backends/base/base.py", line 229, in _cursor
    self.ensure_connection()
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/backends/base/base.py", line 213, in ensure_connection
    self.connect()
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/backends/base/base.py", line 213, in ensure_connection
    self.connect()
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/backends/base/base.py", line 189, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/backends/mysql/base.py", line 274, in get_new_connection
    conn = Database.connect(**conn_params)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/__init__.py", line 86, in Connect
    return Connection(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 204, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
OperationalError: (2003, "Can't connect to MySQL server on '192.168.9.13' (110)")
2020-03-11 13:14:21,561 [ERROR] django.request:135 handle_uncaught_exception Internal Server Error: /api/v2.1/repos/cbc4110e-dbd2-4f92-a5d4-29349c009a3c/repo-tags/
Traceback (most recent call last):
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/core/handlers/base.py", line 244, in _legacy_get_response
    response = middleware_method(request)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/middleware/locale.py", line 25, in process_request
    language = translation.get_language_from_request(request, check_path=i18n_patterns_used)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/utils/translation/__init__.py", line 211, in get_language_from_request
    return _trans.get_language_from_request(request, check_path)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/utils/translation/trans_real.py", line 519, in get_language_from_request
    lang_code = request.session.get(LANGUAGE_SESSION_KEY)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/contrib/sessions/backends/base.py", line 68, in get
    return self._session.get(key, default)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/contrib/sessions/backends/base.py", line 207, in _get_session
    self._session_cache = self.load()
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/contrib/sessions/backends/db.py", line 35, in load
    expire_date__gt=timezone.now()
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/models/query.py", line 374, in get
    num = len(clone)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/models/query.py", line 232, in __len__
    self._fetch_all()
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/models/query.py", line 1118, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/models/query.py", line 53, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/models/sql/compiler.py", line 887, in execute_sql
    cursor = self.connection.cursor()
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/backends/base/base.py", line 254, in cursor
    return self._cursor()
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/backends/base/base.py", line 229, in _cursor
    self.ensure_connection()
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/backends/base/base.py", line 213, in ensure_connection
    self.connect()
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/backends/base/base.py", line 213, in ensure_connection
    self.connect()
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/backends/base/base.py", line 189, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/backends/mysql/base.py", line 274, in get_new_connection
    conn = Database.connect(**conn_params)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/__init__.py", line 86, in Connect
    return Connection(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 204, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
OperationalError: (2003, "Can't connect to MySQL server on '192.168.9.13' (110)")
2020-03-11 13:14:25,657 [ERROR] django.request:135 handle_uncaught_exception Internal Server Error: /thumbnail/cbc4110e-dbd2-4f92-a5d4-29349c009a3c/48/Camera Uploads/IMG_20150818_195347_19C9.JPG
Traceback (most recent call last):
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/core/handlers/base.py", line 244, in _legacy_get_response
    response = middleware_method(request)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/middleware/locale.py", line 25, in process_request
    language = translation.get_language_from_request(request, check_path=i18n_patterns_used)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/utils/translation/__init__.py", line 211, in get_language_from_request
    return _trans.get_language_from_request(request, check_path)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/utils/translation/trans_real.py", line 519, in get_language_from_request
    lang_code = request.session.get(LANGUAGE_SESSION_KEY)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/contrib/sessions/backends/base.py", line 68, in get
    return self._session.get(key, default)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/contrib/sessions/backends/base.py", line 207, in _get_session
    self._session_cache = self.load()
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/contrib/sessions/backends/db.py", line 35, in load
    expire_date__gt=timezone.now()
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/models/query.py", line 374, in get
    num = len(clone)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/models/query.py", line 232, in __len__
    self._fetch_all()
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/models/query.py", line 1118, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/models/query.py", line 53, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/models/sql/compiler.py", line 887, in execute_sql
    cursor = self.connection.cursor()
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/backends/base/base.py", line 254, in cursor
    return self._cursor()
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/backends/base/base.py", line 229, in _cursor
    self.ensure_connection()
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/backends/base/base.py", line 213, in ensure_connection
    self.connect()
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/backends/base/base.py", line 213, in ensure_connection
    self.connect()
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/backends/base/base.py", line 189, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/opt/seafile/seafile-pro-server-7.0.13/seahub/thirdpart/django/db/backends/mysql/base.py", line 274, in get_new_connection
    conn = Database.connect(**conn_params)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/__init__.py", line 86, in Connect
    return Connection(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 204, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
OperationalError: (2003, "Can't connect to MySQL server on '192.168.9.13' (110)")

这个我又自问自答了,Windows的Docker始终在文件挂载访问上有很严重的问题,把数据库改用Mariadb 10.4.12并内建到Docker容器里就没问题了