簡體   English   中英

無法為 Wagtail 設置 Elasticsearch

[英]Unable to set up Elasticsearch for Wagtail

到目前為止,我使用了以下指南:

http://docs.wagtail.io/en/v1.9/advanced_topics/performance.html

我補充說:

WAGTAILSEARCH_BACKENDS = {
    'default': {
        'BACKEND': 'wagtail.wagtailsearch.backends.elasticsearch',
        'INDEX': '{{ project_name }}',
    },
}

到我的 base.py。 當我運行$ ./manage.py update_index ,我得到以下輸出:

Updating backend: default
default: Rebuilding index {{ project_name }}
Traceback (most recent call last):
  File "./manage.py", line 12, in <module>
    execute_from_command_line(sys.argv)
  File "/home/emtr0/Env/emtr0dotcom/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/home/emtr0/Env/emtr0dotcom/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/emtr0/Env/emtr0dotcom/local/lib/python2.7/site-packages/django/core/management/base.py", line 294, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/emtr0/Env/emtr0dotcom/local/lib/python2.7/site-packages/django/core/management/base.py", line 345, in execute
    output = self.handle(*args, **options)
  File "/home/emtr0/Env/emtr0dotcom/local/lib/python2.7/site-packages/wagtail/wagtailsearch/management/commands/update_index.py", line 120, in handle
    self.update_backend(backend_name, schema_only=options.get('schema_only', False))
  File "/home/emtr0/Env/emtr0dotcom/local/lib/python2.7/site-packages/wagtail/wagtailsearch/management/commands/update_index.py", line 73, in update_backend
    index = rebuilder.start()
  File "/home/emtr0/Env/emtr0dotcom/local/lib/python2.7/site-packages/wagtail/wagtailsearch/backends/elasticsearch.py", line 613, in start
    self.reset_index()
  File "/home/emtr0/Env/emtr0dotcom/local/lib/python2.7/site-packages/wagtail/wagtailsearch/backends/elasticsearch.py", line 609, in reset_index
    self.index.reset()
  File "/home/emtr0/Env/emtr0dotcom/local/lib/python2.7/site-packages/wagtail/wagtailsearch/backends/elasticsearch.py", line 598, in reset
    self.delete()
  File "/home/emtr0/Env/emtr0dotcom/local/lib/python2.7/site-packages/wagtail/wagtailsearch/backends/elasticsearch.py", line 499, in delete
    self.es.indices.delete(self.name)
  File "/home/emtr0/Env/emtr0dotcom/local/lib/python2.7/site-packages/elasticsearch/client/utils.py", line 73, in _wrapped
    return func(*args, params=params, **kwargs)
  File "/home/emtr0/Env/emtr0dotcom/local/lib/python2.7/site-packages/elasticsearch/client/indices.py", line 200, in delete
    params=params)
  File "/home/emtr0/Env/emtr0dotcom/local/lib/python2.7/site-packages/elasticsearch/transport.py", line 318, in perform_request
    status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout)
  File "/home/emtr0/Env/emtr0dotcom/local/lib/python2.7/site-packages/elasticsearch/connection/http_urllib3.py", line 123, in perform_request
    raise ConnectionError('N/A', str(e), e)
elasticsearch.exceptions.ConnectionError: ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f3b708fa210>: Failed to establish a new connection: [Errno 111] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f3b708fa210>: Failed to establish a new connection: [Errno 111] Connection refused)

提前致謝。

編輯更新:

看起來我的 Linode 可能沒有足夠的 RAM。 在全局安裝后嘗試使用 ./bin/elasticsearch 運行 ES 時出現以下錯誤:

OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 2060255232 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /home/emtr0/elasticsearch-5.3.0/hs_err_pid24719.log

謝謝。

對於仍有問題的人,請確保您的 Elasticsearch 版本和 elasticsearch-py 版本相同。 elasticsearch 和 py 版本都需要安裝。 那為我修好了。

抱歉,我沒有足夠的聲譽直接在您的問題下發表評論,希望這能幫助您解決問題:

  • 在本地安裝 elasticsearch,運行它,然后使用簡單的curl http://localhost:9200檢查它是否正在運行(應該在端口 9200 上)。 如果你得到一個 JSON 響應,它正在運行 🎉

或者

  • 設置一個 bonsai ( http://bonsai.io ) 實例以運行托管的 elasticsearch 服務器,只需將 bonsai 的服務器 URL 復制粘貼到您的配置中,但它可能需要更多設置(SSL 等),並且在 elasticsearch 版本方面更受限制

獎勵:如果你是一個Mac系統用戶,安裝/運行彈性搜索是一樣簡單brew install elasticsearch (也許設置一個特定的版本雖然),然后elasticsearch ,如果你不介意有它在前台運行。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM