Docker 官网安装好后,网页正常,但ElasticSearch 服务起不来。

按照官网的教程,将原cenots 7.8下的二进制转为Docker 模式,网页,客户端正常,但ElasticSearch 服务一直不能正常工作。

[root@yunpan opt]# docker ps
CONTAINER ID   IMAGE                                                      COMMAND                   CREATED          STATUS          PORTS                                       NAMES
5ac075655ef6   docker.seafile.top/seafileltd/seafile-pro-mc:10.0-latest   "/sbin/my_init -- /s…"   36 minutes ago   Up 36 minutes   80/tcp, 0.0.0.0:88->88/tcp, :::88->88/tcp   seafile
3ca1b75ec884   docker.seafile.top/seafileltd/elasticsearch:8.6.2          "/bin/tini -- /usr/l…"   36 minutes ago   Up 36 minutes   9200/tcp, 9300/tcp                          seafile-elasticsearch
1a73135654d7   docker.seafile.top/seafileltd/memcached:1.6.18             "memcached -m 256"        36 minutes ago   Up 36 minutes   11211/tcp                                   seafile-memcached

显示ElasticSearch 8.6.2 镜像已经起来了。但后台无数据显示。
运行 ./pro/pro.py search --update 报错。

root@5ac075655ef6:/opt/seafile/seafile-server-latest# ./pro/pro.py search --update

Updating search index, this may take a while...

09/10/2024 03:50:14 [INFO] seafes:210 main: storage: using filesystem storage backend
09/10/2024 03:50:14 [INFO] seafes:212 main: index office pdf: True
09/10/2024 03:50:14 [INFO] elastic_transport.transport:359 perform_request: HEAD http://127.0.0.1:9200/repo_head [status:N/A duration:0.001s]
09/10/2024 03:50:14 [WARNING] elastic_transport.node_pool:246 mark_dead: Node <Urllib3HttpNode(http://127.0.0.1:9200)> has failed for 1 times in a row, putting on 1 second timeout
09/10/2024 03:50:14 [WARNING] elastic_transport.transport:396 perform_request: Retrying request after failure (attempt 0 of 3)
Traceback (most recent call last):
  File "/opt/seafile/seafile-pro-server-10.0.16/pro/python/elastic_transport/_transport.py", line 329, in perform_request
    meta, raw_data = node.perform_request(
  File "/opt/seafile/seafile-pro-server-10.0.16/pro/python/elastic_transport/_node/_http_urllib3.py", line 199, in perform_request
    raise err from None
elastic_transport.ConnectionError: Connection error caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7fbc40071880>: Failed to establish a new connection: [Errno 111] Connection refused)
09/10/2024 03:50:14 [INFO] elastic_transport.transport:359 perform_request: HEAD http://127.0.0.1:9200/repo_head [status:N/A duration:0.001s]
09/10/2024 03:50:14 [WARNING] elastic_transport.node_pool:246 mark_dead: Node <Urllib3HttpNode(http://127.0.0.1:9200)> has failed for 2 times in a row, putting on 2 second timeout
09/10/2024 03:50:14 [WARNING] elastic_transport.transport:396 perform_request: Retrying request after failure (attempt 1 of 3)
Traceback (most recent call last):
  File "/opt/seafile/seafile-pro-server-10.0.16/pro/python/elastic_transport/_transport.py", line 329, in perform_request
    meta, raw_data = node.perform_request(
  File "/opt/seafile/seafile-pro-server-10.0.16/pro/python/elastic_transport/_node/_http_urllib3.py", line 199, in perform_request
    raise err from None
elastic_transport.ConnectionError: Connection error caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7fbc40071b20>: Failed to establish a new connection: [Errno 111] Connection refused)
09/10/2024 03:50:14 [INFO] elastic_transport.transport:359 perform_request: HEAD http://127.0.0.1:9200/repo_head [status:N/A duration:0.001s]
09/10/2024 03:50:14 [WARNING] elastic_transport.node_pool:246 mark_dead: Node <Urllib3HttpNode(http://127.0.0.1:9200)> has failed for 3 times in a row, putting on 4 second timeout
09/10/2024 03:50:14 [WARNING] elastic_transport.transport:396 perform_request: Retrying request after failure (attempt 2 of 3)
Traceback (most recent call last):
  File "/opt/seafile/seafile-pro-server-10.0.16/pro/python/elastic_transport/_transport.py", line 329, in perform_request
    meta, raw_data = node.perform_request(
  File "/opt/seafile/seafile-pro-server-10.0.16/pro/python/elastic_transport/_node/_http_urllib3.py", line 199, in perform_request
    raise err from None
elastic_transport.ConnectionError: Connection error caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7fbc400840a0>: Failed to establish a new connection: [Errno 111] Connection refused)
09/10/2024 03:50:14 [INFO] elastic_transport.transport:359 perform_request: HEAD http://127.0.0.1:9200/repo_head [status:N/A duration:0.001s]
09/10/2024 03:50:14 [WARNING] elastic_transport.node_pool:246 mark_dead: Node <Urllib3HttpNode(http://127.0.0.1:9200)> has failed for 4 times in a row, putting on 8 second timeout
09/10/2024 03:50:14 [ERROR] seafes:158 start_index_local: Index process init error: Connection error caused by: ConnectionError(Connection error caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7fbc40071880>: Failed to establish a new connection: [Errno 111] Connection refused)).
root@5ac075655ef6:/opt/seafile/seafile-server-latest# 

运行 ./pro/pro.py search --clear 也报错。

root@5ac075655ef6:/opt/seafile/seafile-server-latest# ./pro/pro.py search --clear
Delete seafile search index ([y]/n)? y

Delete search index, this may take a while...

09/10/2024 03:51:20 [INFO] seafes:210 main: storage: using filesystem storage backend
09/10/2024 03:51:20 [INFO] seafes:212 main: index office pdf: True
09/10/2024 03:51:20 [INFO] elastic_transport.transport:359 perform_request: HEAD http://127.0.0.1:9200/repo_head [status:N/A duration:0.001s]
09/10/2024 03:51:20 [WARNING] elastic_transport.node_pool:246 mark_dead: Node <Urllib3HttpNode(http://127.0.0.1:9200)> has failed for 1 times in a row, putting on 1 second timeout
09/10/2024 03:51:20 [WARNING] elastic_transport.transport:396 perform_request: Retrying request after failure (attempt 0 of 3)
Traceback (most recent call last):
  File "/opt/seafile/seafile-pro-server-10.0.16/pro/python/elastic_transport/_transport.py", line 329, in perform_request
    meta, raw_data = node.perform_request(
  File "/opt/seafile/seafile-pro-server-10.0.16/pro/python/elastic_transport/_node/_http_urllib3.py", line 199, in perform_request
    raise err from None
elastic_transport.ConnectionError: Connection error caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7fbf42e9a160>: Failed to establish a new connection: [Errno 111] Connection refused)
09/10/2024 03:51:20 [INFO] elastic_transport.transport:359 perform_request: HEAD http://127.0.0.1:9200/repo_head [status:N/A duration:0.001s]
09/10/2024 03:51:20 [WARNING] elastic_transport.node_pool:246 mark_dead: Node <Urllib3HttpNode(http://127.0.0.1:9200)> has failed for 2 times in a row, putting on 2 second timeout
09/10/2024 03:51:20 [WARNING] elastic_transport.transport:396 perform_request: Retrying request after failure (attempt 1 of 3)
Traceback (most recent call last):
  File "/opt/seafile/seafile-pro-server-10.0.16/pro/python/elastic_transport/_transport.py", line 329, in perform_request
    meta, raw_data = node.perform_request(
  File "/opt/seafile/seafile-pro-server-10.0.16/pro/python/elastic_transport/_node/_http_urllib3.py", line 199, in perform_request
    raise err from None
elastic_transport.ConnectionError: Connection error caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7fbf42e9a3d0>: Failed to establish a new connection: [Errno 111] Connection refused)
09/10/2024 03:51:20 [INFO] elastic_transport.transport:359 perform_request: HEAD http://127.0.0.1:9200/repo_head [status:N/A duration:0.001s]
09/10/2024 03:51:20 [WARNING] elastic_transport.node_pool:246 mark_dead: Node <Urllib3HttpNode(http://127.0.0.1:9200)> has failed for 3 times in a row, putting on 4 second timeout
09/10/2024 03:51:20 [WARNING] elastic_transport.transport:396 perform_request: Retrying request after failure (attempt 2 of 3)
Traceback (most recent call last):
  File "/opt/seafile/seafile-pro-server-10.0.16/pro/python/elastic_transport/_transport.py", line 329, in perform_request
    meta, raw_data = node.perform_request(
  File "/opt/seafile/seafile-pro-server-10.0.16/pro/python/elastic_transport/_node/_http_urllib3.py", line 199, in perform_request
    raise err from None
elastic_transport.ConnectionError: Connection error caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7fbf42e9a910>: Failed to establish a new connection: [Errno 111] Connection refused)
09/10/2024 03:51:20 [INFO] elastic_transport.transport:359 perform_request: HEAD http://127.0.0.1:9200/repo_head [status:N/A duration:0.001s]
09/10/2024 03:51:20 [WARNING] elastic_transport.node_pool:246 mark_dead: Node <Urllib3HttpNode(http://127.0.0.1:9200)> has failed for 4 times in a row, putting on 8 second timeout
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/opt/seafile/seafile-pro-server-10.0.16/pro/python/seafes/index_local.py", line 264, in <module>
    main()
  File "/opt/seafile/seafile-pro-server-10.0.16/pro/python/seafes/index_local.py", line 214, in main
    args.func()
  File "/opt/seafile/seafile-pro-server-10.0.16/pro/python/seafes/index_local.py", line 174, in delete_indices
    if es.indices.exists(index=idx):
  File "/opt/seafile/seafile-pro-server-10.0.16/pro/python/elasticsearch/_sync/client/utils.py", line 414, in wrapped
    return api(*args, **kwargs)
  File "/opt/seafile/seafile-pro-server-10.0.16/pro/python/elasticsearch/_sync/client/indices.py", line 1111, in exists
    return self.perform_request(  # type: ignore[return-value]
  File "/opt/seafile/seafile-pro-server-10.0.16/pro/python/elasticsearch/_sync/client/_base.py", line 390, in perform_request
    return self._client.perform_request(
  File "/opt/seafile/seafile-pro-server-10.0.16/pro/python/elasticsearch/_sync/client/_base.py", line 286, in perform_request
    meta, resp_body = self.transport.perform_request(
  File "/opt/seafile/seafile-pro-server-10.0.16/pro/python/elastic_transport/_transport.py", line 329, in perform_request
    meta, raw_data = node.perform_request(
  File "/opt/seafile/seafile-pro-server-10.0.16/pro/python/elastic_transport/_node/_http_urllib3.py", line 199, in perform_request
    raise err from None
elastic_transport.ConnectionError: Connection error caused by: ConnectionError(Connection error caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7fbf42e9a160>: Failed to establish a new connection: [Errno 111] Connection refused))
root@5ac075655ef6:/opt/seafile/seafile-server-latest# 

seafevents.conf 中相关设置如下:

index_office_pdf = true

external_es_server = true

es_host = 127.0.0.1

es_port = 9200

其中 shards = 10 # default is 5 这个参数不能开,一开网页不显示,直接"internal server error"

麻烦大神帮忙看看,什么问题。为什么ElasticSearch 服务起不

您可以将es_host 改为 elasticsearch, 然后看下容器启动时有什么报错

1 个赞

谢谢,改成es_host = elasticsearch 可以用了。这是什么原因啊。

Elasticsearch 实例运行在同一个 Docker 网络中的另一个容器中,你需要使用容器的名字。 127.0.0.1指的是虚拟环境内部,而不是外部宿主机,这样无法访问

非常感谢。谢谢。