我想使用新配置重新启动elasticsearch节点。正常关闭节点的最佳方法是什么?

关闭进程是关闭服务器的最佳方法,还是我可以使用一些神奇的URL关闭节点?

最佳答案

更新了答案。
_shutdown API已在Elasticsearch 2.x中删除。

一些选项:

  • 在您的终端中(基本上是开发模式),只需键入“Ctrl-C”
  • 如果您将其作为守护程序(-d)启动,请找到PID并终止进程:SIGTERM将彻底关闭Elasticsearch(kill -15 PID)
  • 如果作为服务运行,请运行类似于service elasticsearch stop的内容:
  • Linux
  • Windows

  • 上一个答案。现在从1.6开始不推荐使用。

    是的参见admin cluster nodes shutdown documentation

    基本上:
    # Shutdown local node
    $ curl -XPOST 'http://localhost:9200/_cluster/nodes/_local/_shutdown'
    
    # Shutdown all nodes in the cluster
    $ curl -XPOST 'http://localhost:9200/_shutdown'
    

    07-24 09:39
    查看更多