macos - 将 ElasticSearch 集群变为绿色(OS X 上的集群设置)

标签 macos elasticsearch

我有installed ElasticSearch on Mac OS X using Homebrew .有用。集群以“绿色”开始 health .但是,刚添加完数据,就变“黄”了。

The cluster health is status is: green, yellow or red. On the shard level, a red status indicates that the specific shard is not allocated in the cluster, yellow means that the primary shard is allocated but replicas are not, and green means that all shards are allocated. The index level status is controlled by the worst shard status. The cluster status is controlled by the worst index status.

所以,我的副本分片没有分配。我如何分配它们? (我正在大声思考。)

根据 Shay 在 "I keep getting cluster health status of Yellow" 上的说法: “分片分配机制不会在同一节点上分配分片及其副本,尽管它会在同一节点上分配不同的分片。因此,您将需要两个节点才能获得绿色的集群状态。”

所以,我需要启动第二个节点。我这样做了:

cd ~/Library/LaunchAgents/
cp homebrew.mxcl.elasticsearch.plist homebrew.mxcl.elasticsearch-2.plist
# change line 8 to: homebrew.mxcl.elasticsearch-2
launchctl load -wF ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch-2.plist

Now I have "Korvus" on http://localhost:9200/ and "Iron Monger" on http://localhost:9201/. Woot. But, I don't see any indications that they know about each other. How do I connect / introduce them to each other?

Note: I read Zen Discovery, but do not feel enlightened yet.

Update 2012-08-13 11:30 PM EST:

Here are my two nodes:

curl "http://localhost:9200/_cluster/health?pretty=true"
{
  "cluster_name" : "elasticsearch_david",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 0,
  "active_shards" : 0,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0
}

curl "http://localhost:9201/_cluster/health?pretty=true"
{
  "cluster_name" : "elasticsearch_david",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 0,
  "active_shards" : 0,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0
}

更新 2012-08-13 11:35 PM EST:

澄清一下,我的问题不是如何通过设置index.number_of_replicas: 0 来“忽略”问题。我想要连接多个节点。

更新 2012-08-13 11:48 PM EST:

我刚刚发布了一个double gist that includes elasticsearch.yml and elasticsearch_david.log .在我看来,两个节点都称自己为“主人”。这是我应该期待的吗?

更新 2012-08-14 12:36 AM EST:

小说还在继续! :) 如果我断开我的 Mac 与所有外部网络的连接,然后重新启动节点,然后它们就会找到彼此。双Woot。这让我认为问题出在我的网络/多播配置上。目前我的配置中有这个:network.host: 127.0.0.1。也许这是不正确的?

最佳答案

已解决。不要使用 network.host: 127.0.0.1。将该行注释掉以使其自动派生。

默认的 elasticsearch.yml 是正确的。 configuration tweak by the Homebrew installer指定 127.0.0.1 环回接口(interface):

# Set up ElasticSearch for local development:
inreplace "#{prefix}/config/elasticsearch.yml" do |s|
  # ...
  # 3. Bind to loopback IP for laptops roaming different networks
  s.gsub! /#\s*network\.host\: [^\n]+/, "network.host: 127.0.0.1"
end

我提交了 an issue on the Homebrew issue tracker .

关于macos - 将 ElasticSearch 集群变为绿色(OS X 上的集群设置),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11944915/

相关文章:

c++ - 为什么 Xcode 11 beta 不能使用 C++17 的 <filesystem> header ?

c# - C#ElasticSearch NEST,复合聚合脚本转换错误

database - 在哪里存储搜索索引的数据?

ios - block 内的静态变量

xcode - 我如何在 OS X 下覆盖 malloc()、calloc()、free() 等?

java - 在 mac os 中,使用 rxtx 时,加载 gnu.io.RXTXCommDriver 时抛出 java.lang.UnsatisfiedLinkError : no rxtxSerial in java. library.path 错误

database-design - ElasticSearch:对于相同的映射定义,具有不同索引的利弊

python - 限制CMRESHandler使用的字段

elasticsearch - Elasticsearch [5.4]通过句子中的单词位置评分

c++ - 在 OSX 10.11(CLion 1.1 中的 CMake 3.3)上使用 SDL2 和 SDL2_image