配置文件位于%ES_HOME%/config/elasticsearch.yml文件中,用Editplus打开它,你便可以进行配置。

    所有的配置都可以使用环境变量,例如:node.rack: ${RACK_ENV_VAR}  表示环境变量中有一个RACK_ENV_VAR变量。

下面列举一下elasticsearch的可配置项:

1. 集群名称,默认为elasticsearch:cluster.name: elasticsearch

2. 节点名称,es启动时会自动创建节点名称,但你也可进行配置:node.name: "Franz Kafka"

3. 是否作为主节点,每个节点都可以被配置成为主节点,默认值为true:node.master: true

4. 是否存储数据,即存储索引片段,默认值为true:node.data: true

master和data同时配置会产生一些奇异的效果:

1) 当master为false,而data为true时,会对该节点产生严重负荷;

2) 当master为true,而data为false时,该节点作为一个协调者;

3) 当master为false,data也为false时,该节点就变成了一个负载均衡器。

你可以通过连接http://localhost:9200/_cluster/health或者http://localhost:9200/_cluster/nodes

或者使用插件http://github.com/lukas-vlcek/bigdesk或http://mobz.github.com/elasticsearch-head来查看集群状态。

5. 每个节点都可以定义一些与之关联的通用属性,用于后期集群进行碎片分配时的过滤:node.rack: rack314

6. 默认情况下,多个节点可以在同一个安装路径启动,如果你想让你的es只启动一个节点,可以进行如下设置:node.max_local_storage_nodes: 1

7. 设置一个索引的碎片数量,默认值为5:index.number_of_shards: 5

8. 设置一个索引可被复制的数量,默认值为1:index.number_of_replicas: 1

当你想要禁用公布式时,你可以进行如下设置:

index.number_of_shards: 1

index.number_of_replicas: 0

这两个属性的设置直接影响集群中索引和搜索操作的执行。假设你有足够的机器来持有碎片和复制品,那么可以按如下规则设置这两个值:

1) 拥有更多的碎片可以提升索引执行能力,并允许通过机器分发一个大型的索引;

2) 拥有更多的复制器能够提升搜索执行能力以及集群能力。

对于一个索引来说,number_of_shards只能设置一次,而number_of_replicas可以使用索引更新设置API在任何时候被增加或者减少。

ElasticSearch关注加载均衡、迁移、从节点聚集结果等等。可以尝试多种设计来完成这些功能。

可以连接http://localhost:9200/A/_status来检测索引的状态。

9. 配置文件所在的位置,即elasticsearch.yml和logging.yml所在的位置:path.conf: /path/to/conf

10. 分配给当前节点的索引数据所在的位置:path.data: /path/to/data

可以可选择的包含一个以上的位置,使得数据在文件级别跨越位置,这样在创建时就有更多的自由路径,如:path.data: /path/to/data1,/path/to/data2

11. 临时文件位置:path.work: /path/to/work

12. 日志文件所在位置:path.logs: /path/to/logs

13. 插件安装位置:path.plugins: /path/to/plugins

14. 插件托管位置,若列表中的某一个插件未安装,则节点无法启动:plugin.mandatory: mapper-attachments,lang-groovy

15. JVM开始交换时,ElasticSearch表现并不好:你需要保障JVM不进行交换,可以将bootstrap.mlockall设置为true禁止交换:bootstrap.mlockall: true

请确保ES_MIN_MEM和ES_MAX_MEM的值是一样的,并且能够为ElasticSearch分配足够的内在,并为系统操作保留足够的内存。

16. 默认情况下,ElasticSearch使用0.0.0.0地址,并为http传输开启9200-9300端口,为节点到节点的通信开启9300-9400端口,也可以自行设置IP地址:network.bind_host: 192.168.0.1

17. publish_host设置其他节点连接此节点的地址,如果不设置的话,则自动获取,publish_host的地址必须为真实地址:network.publish_host: 192.168.0.1

18. bind_host和publish_host可以一起设置:network.host: 192.168.0.1

19. 可以定制该节点与其他节点交互的端口:transport.tcp.port: 9300

20. 节点间交互时,可以设置是否压缩,转为为不压缩:transport.tcp.compress: true

21. 可以为Http传输监听定制端口:http.port: 9200

22. 设置内容的最大长度:http.max_content_length: 100mb

23. 禁止HTTP:http.enabled: false

24. 网关允许在所有集群重启后持有集群状态,集群状态的变更都会被保存下来,当第一次启用集群时,可以从网关中读取到状态,默认网关类型(也是推荐的)是local:gateway.type: local

25. 允许在N个节点启动后恢复过程:gateway.recover_after_nodes: 1

26. 设置初始化恢复过程的超时时间:gateway.recover_after_time: 5m

27. 设置该集群中可存在的节点上限:gateway.expected_nodes: 2

28. 设置一个节点的并发数量,有两种情况,一种是在初始复苏过程中:cluster.routing.allocation.node_initial_primaries_recoveries: 4

另一种是在添加、删除节点及调整时:cluster.routing.allocation.node_concurrent_recoveries: 2

29. 设置复苏时的吞吐量,默认情况下是无限的:indices.recovery.max_size_per_sec: 0

30. 设置从对等节点恢复片段时打开的流的数量上限:indices.recovery.concurrent_streams: 5

31. 设置一个集群中主节点的数量,当多于三个节点时,该值可在2-4之间:discovery.zen.minimum_master_nodes: 1

32. 设置ping其他节点时的超时时间,网络比较慢时可将该值设大:discovery.zen.ping.timeout: 3s

http://elasticsearch.org/guide/reference/modules/discovery/zen.html上有更多关于discovery的设置。

33. 禁止当前节点发现多个集群节点,默认值为true:discovery.zen.ping.multicast.enabled: false

34. 设置新节点被启动时能够发现的主节点列表:discovery.zen.ping.unicast.hosts: ["host1", "host2:port", "host3[portX-portY]"]

转载:http://www.cnblogs.com/hunttown/p/5450602.html

# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please see the documentation for further information on configuration options:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/setup-configuration.html>
#
# ---------------------------------- Cluster 集群名字  -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: MyElasticearch
#
# ------------------------------------ Node 节点信息------------------------------------
#
# Use a descriptive name for the node:
#节点名字
node.name: node-1

#设置为主节点
node.master: true

#是否存储数据
node.data: true

#多个节点可以在同一个安装路径启动,如果你想让你的es只启动一个节点
#node.max_local_storage_nodes: 1

#设置一个索引的碎片数量,默认值为5
#index.number_of_shards: 5

#设置一个索引可被复制的数量,默认值为1:
#index.number_of_replicas: 1

#
# Add custom attributes to the node:
#
# node.rack: r1
#
# ----------------------------------- Paths ------------------------------------

# 配置文件所在的位置,即elasticsearch.yml和logging.yml所在的位置:path.conf: /path/to/conf
#
# Path to directory where to store the data (separate multiple locations by comma):
#
# path.data: /path/to/data
#
# Path to log files:
#
# path.logs: /path/to/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
# bootstrap.mlockall: true
#
# Make sure that the `ES_HEAP_SIZE` environment variable is set to about half the memory
# available on the system and that the owner of the process is allowed to use this limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 192.168.1.102
#
# Set a custom port for HTTP:

#Http传输监听定制端口
http.port: 9200
#

#定制该节点与其他节点交互的端口:
transport.tcp.port: 9300

#节点间交互时,可以设置是否压缩,转为为不压缩:
#transport.tcp.compress: true

#设置内容的最大长度:
#http.max_content_length: 100mb

#禁止HTTP:
#http.enabled: false

#网关允许在所有集群重启后持有集群状态,集群状态的变更都会被保存下来,当第一次启用集群时,可以从网关中读取到状态,默认网关类型(也是推荐的)是local:
#gateway.type: local

# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html>
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#

#设置新节点被启动时能够发现的主节点列表:discovery.zen.ping.unicast.hosts: ["192.168.1.102", "192.168.1.103:9200"]
# discovery.zen.ping.unicast.hosts: ["host1", "host2"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1):

#禁止当前节点发现多个集群节点,默认值为true:discovery.zen.ping.multicast.enabled: false

#设置一个集群中主节点的数量,当多于三个节点时,该值可在2-4之间:
# discovery.zen.minimum_master_nodes: 1
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery.html>
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#

#允许在N个节点启动后恢复过程:gateway.recover_after_nodes: 3

#设置初始化恢复过程的超时时间:gateway.recover_after_time: 5m

#设置该集群中可存在的节点上限:gateway.expected_nodes: 2

设置ping其他节点时的超时时间,网络比较慢时可将该值设大 discovery.zen.ping.timeout: 3s
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-gateway.html>
#
# ---------------------------------- Various -----------------------------------
#
# Disable starting multiple nodes on a single system:
#
# node.max_local_storage_nodes: 1
#
# Require explicit names when deleting indices:
#
# action.destructive_requires_name: true

Elasticsearch分布式搜索集群配置的更多相关文章

  1. Elasticsearch 安装与集群配置

    一.软件版本 操作系统:CentOS-6.5-x86_64 ES版本:5.0 主机:192.168.63.246 主机: 192.168.63.242 二.部署环境规划:   1. 需求:jdk版本: ...

  2. elasticsearch集群配置 (Tobe Continue)

    elasticsearch集群配置 (Tobe Continue)   准备 首先需要在每个节点有可以正常启动的单节点elasticsearch   elasticsearch集群配置仅需要在elas ...

  3. ES2:ElasticSearch 集群配置

    ElasticSearch共有两个配置文件,都位于config目录下,分别是elasticsearch.yml和logging.yml,其中,elasticsearch.yml 用来配置Elastic ...

  4. ElasticSearch入门 第二篇:集群配置

    这是ElasticSearch 2.4 版本系列的第二篇: ElasticSearch入门 第一篇:Windows下安装ElasticSearch ElasticSearch入门 第二篇:集群配置 E ...

  5. Elasticsearch 第九篇:集群配置与搭建

    h2.post_title { background-color: rgba(43, 102, 149, 1); color: rgba(255, 255, 255, 1); font-size: 1 ...

  6. Ubuntu 14.04中Elasticsearch集群配置

    Ubuntu 14.04中Elasticsearch集群配置 前言:本文可用于elasticsearch集群搭建参考.细分为elasticsearch.yml配置和系统配置 达到的目的:各台机器配置成 ...

  7. Linux下Apache与Tomcat的完全分布式集群配置(负载均衡)

    最近公司要给客户提供一套集群方案,项目组采用了Apache和Tomcat的集群配置,用于实现负载均衡的实现. 由于以前没有接触过Apache,因此有些手生,另外在网上搜寻了很多有关这方面的集群文章,但 ...

  8. hbase单机环境的搭建和完全分布式Hbase集群安装配置

    HBase 是一个开源的非关系(NoSQL)的可伸缩性分布式数据库.它是面向列的,并适合于存储超大型松散数据.HBase适合于实时,随机对Big数据进行读写操作的业务环境. @hbase单机环境的搭建 ...

  9. EHCache分布式缓存集群环境配置

    EHCache分布式缓存集群环境配置 ehcache提供三种网络连接策略来实现集群,rmi,jgroup还有jms.同时ehcache可以可以实现多播的方式实现集群,也可以手动指定集群主机序列实现集群 ...

随机推荐

  1. 转-利用Oracle审计功能来监测试环境的变化

    http://blog.csdn.net/luowangjun/article/details/5627102利用Oracle审计功能来监测试环境的变化 做过测试的人都应该会碰到这样的情况:测试发现的 ...

  2. How to Failover the ‘Cluster Group’

    If you have more than two nodes in the cluster, you can specify the destination node with the follow ...

  3. mysql:字符串转换为日期类型

    函数:DATE_FORMAT http://www.w3school.com.cn/sql/func_date_format.asp

  4. 关于@Html.Action()的异常“控制器或该控制器未实现 IController。”

    解决之前: @Html.Action("BottomHelp", "Articles", new { num = 5}) 解决之后: @Html.Action( ...

  5. Python中super函数的用法

    之前看python文档的时候发现许多单继承类也用了super()来申明父类,那么这样做有何意义? 从python官网文档对于super的介绍来看,其作用为返回一个代理对象作为代表调用父类或亲类方法.( ...

  6. linux iostat 性能指标说明

    Linux系统中的 iostat是I/O statistics(输入/输出统计)的缩写,iostat工具将对系统的磁盘操作活动进行监视. 它的特点是汇报磁盘活动统计情况,同时也会汇报出CPU使用情况. ...

  7. CentOS6.4 安装 erlang

    wget http://www.erlang.org/download/otp_src_17.0.tar.gz -P /usr/local/src/ wget http://www.erlang.or ...

  8. AS3下如何来判断XML属性的是否存在

    在as3中判断xml节点是否存在可用XMLList中的方法:hasOwnProperty(p:String):Boolean. 但是判断xml节点是否存在某一属性,对象中好像没有该方法,只能用unde ...

  9. linux——ssh服务

    SSH服务(TCP端口号22):安全的命令解释器 为客户机提供安全的Shell 环境,用于远程管理 SSH基于公钥加密(非对称加密)技术: 数据加密传输: 客户端和服务器的身份验证: 公钥 和 私钥 ...

  10. scp远程复制

    scp 源 目标 -r 复制目录 scp -r  root@ip:/XXX/path  /XXX 注意:复制目录,包括该目录本身,目的地址无需再加该目录