AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 737196
Accepted
giomanda
giomanda
Asked: 2015-11-19 01:28:44 +0800 CST2015-11-19 01:28:44 +0800 CST 2015-11-19 01:28:44 +0800 CST

elasticsearch不创建副本分片

  • 772

在过去的两天里,我一直在努力解决这个问题。我已经设置了两个节点的弹性搜索集群。每个节点的配置非常简单:

node.name: "server1"
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: 192.168.1.212,192.168.1.213
index.store.compress.stored: True
index.store.compress.tv: True
index.number_of_shards: 5
compress.default.type: lzf
cluster.name: mycluster
discovery.zen.minimum_master_nodes: 1
discovery.zen.ping.timeout: 60
index.number_of_replicas: 1

集群节点“看到”彼此并生成预期的分片,但不会生成副本。当我使用“head”插件(用于弹性搜索的 Web UI)时,我只能看到主分片而不是副本。这也从elasticsearch的状态中得到证实:

 curl -XGET 'http://localhost:9200/_cluster/health?pretty=true'
 {
  "cluster_name" : "server1",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 2,
  "number_of_data_nodes" : 2,
  "active_primary_shards" : 10,
  "active_shards" : 10,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0
}

另外,我在 elasticsearch 的运行设置中注意到的另一件事是副本设置为 0:

curl -XGET 'http://localhost:9200/_settings?pretty=true'
{
  "date" : {
    "settings" : {
      "index" : {
        "refresh_interval" : "1s",
        "number_of_shards" : "5",
        "creation_date" : "1447756143035",
        "store" : {
          "type" : "fs"
        },
        "uuid" : "mpVS_BB9R0WvoF0h8pFVfQ",
        "version" : {
          "created" : "1040299"
        },
        "number_of_replicas" : "0"
      }
    }
  },
  "scores" : {
    "settings" : {
      "index" : {
        "refresh_interval" : "1s",
        "number_of_shards" : "5",
        "creation_date" : "1447756144186",
        "store" : {
          "type" : "fs"
        },
        "uuid" : "KUlfG4UhQfmMP1L3xQiJOQ",
        "version" : {
          "created" : "1040299"
        },
        "number_of_replicas" : "0"
      }
    }
  }
}

任何想法为什么不创建副本?

replication
  • 1 1 个回答
  • 3621 Views

1 个回答

  • Voted
  1. Best Answer
    GregL
    2015-11-19T04:54:30+08:002015-11-19T04:54:30+08:00

    根据最后一个命令的输出,您的两个索引没有副本,因为您没有告诉它们。

    您需要更新索引设置,将其更改为"number_of_replicas"您想要的任何数量的副本。

    ES 文档的更新索引设置页面有一个例子。

    这会将所有索引更改为 1 个副本:

    curl -XPUT 'localhost:9200/_settings' -d '
    {
      "index" : {
        "number_of_replicas" : 1
      }
    }'
    

    这只会将scores索引更改为 4 个副本:

    curl -XPUT 'localhost:9200/scores/_settings' -d '
    {
      "index" : {
        "number_of_replicas" : 4
      }
    }'
    
    • 1

相关问题

  • 为什么--skip-slave-start 推荐与 MySQL `START SLAVE UNTIL` 一起使用?

  • SQL Server 合并复制合并代理不见了

  • 加快 MSSQL 快照复制到 SQLExpress 副本的速度

  • 安全地授予对 SQL 2005 复制监视器的访问权限以创建快照

  • 如何最好地编写 SQL Server 2008 上选定的表和数据的脚本?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve