首页 文章

如何在localhost服务器elasticsearch上有两个节点

提问于
浏览
0

我正在使用localhost,为了了解集群是什么以及节点是什么,我想在我的localhost上有两个节点 .

只是为了说清楚:当我从bin / elasticsear吃午餐时,我正在咀嚼一个簇,对吧?

如果是,那么节点在哪里?

以及如何在群集上拥有两个节点?

更新

你可能会问为什么我需要那个?

这是因为,正如您所知,elasticsearch集群中的每个索引都有shads . default是一个索引的5个分片,默认是每个索引有1个副本,因此每个索引默认有10个分片,5个用于原始数据,5个用于副本 . 在elasticsearch中,为了我的索引状态为黄色(不是绿色,不是红色),为什么我要将它变为绿色,因此我需要在我的集群中另一个节点放置分片,以便将副本's shards and the original shards on the same node. thus, in my case, i have one cluster running 5 original shards for each index, but i don'设为5副本's shards and the original shards on the same node. thus, in my case, i have one cluster running 5 original shards for each index, but i don' . 但我只有一个elasticsearch服务器(localhost),这就是为什么我需要在我的localhost elasticsearch服务器上的另一个节点

1 回答

  • 0

    无论何时启动elasticsearch服务器,默认情况下都会启动 master node . 为了运行另一个节点,只需转到另一个终端并再次启动弹性搜索服务器 . 确保:

    449 discovery.zen.ping.multicast.enabled: true in elasticsearch.yml .

    由于elasticsearch本质上是 distributed ,新添加的实例将由现有节点自动检测 . 您可以从终端验证这一点 .

    假设现有节点的名称为 node1 ,新添加的节点为 node2 .

    • 在运行 node1 的终端上,您将看到以下消息:

    [node1] added [node2]

    • 在已启动 node2 的终端上,您将看到消息:

    [node2] detected_master [node1]

    两个节点都自动检测到对方 . 您可以在意义上运行以下查询以检查运行的节点:

    GET /_cluster/state
    

    这将列出所有节点

相关问题