-
Notifications
You must be signed in to change notification settings - Fork 19
elasticsearch.yml
# ElasticSearch 配置示例 #
consult the guide at http://elasticsearch.org/guide.
应用程序开发人员应该咨询http://elasticsearch.org/guide
# # The installation procedure is covered at # http://elasticsearch.org/guide/reference/setup/installation.html. # 安装过程在这里有http://elasticsearch.org/guide/reference/setup/installation.html. # # # ElasticSearch comes with reasonable defaults for most settings, # so you can try it out without bothering with configuration. # ElasticSearch 已经提供了大部分设置,都是合理的默认配置。 # 所以你不必进行烦人的配置就可以尝试一下。 # # Most of the time, these defaults are just fine for running a production # cluster. If you’re fine-tuning your cluster, or wondering about the # effect of certain configuration option, please do ask on the # mailing list or IRC channel [http://elasticsearch.org/community]. # 大多数时候,这些默认的配置就足以运行一个生产集群了。 # 如果你想优化你的集群,或者对一个特定的配置选项的作用好奇,你可以访问邮件列表 # 或者IRC频道[http://elasticsearch.org/community]. #
集群
# # cluster.name: elasticsearch
节点 #
# # node.name: "Franz Kafka"
# # # Allow this node to be eligible as a master node (enabled by default): # 允许这个节点被选举为一个主节点(默认为允许) # # # node.master: true # # Allow this node to store data (enabled by default): # 允许这个节点存储数据(默认为允许) # # node.data: true
# # 1. You want this node to never become a master node, only to hold data. # This will be the "workhorse" of your cluster. # 1. 你不想让这个节点成为一个主节点,只想用来存储数据。 # 这个节点会成为你的集群的“负载器” # # node.master: false # node.data: true # # 2. You want this node to only serve as a master: to not store any data and # to have free resources. This will be the "coordinator" of your cluster. # 2. 你想让这个节点成为一个主节点,并且不用来存储任何数据,并且拥有空闲资源。 # 这个节点会成为你集群中的“协调器” # # node.master: true # node.data: false # # 3. You want this node to be neither master nor data node, but # to act as a "search load balancer" (fetching data from nodes, # aggregating results, etc.) # 4. 你既不想让这个节点变成主节点也不想让其变成数据节点,只想让其成为一个“搜索负载均衡器” # (从节点中获取数据,聚合结果,等等) # # node.master: false # node.data: false
Use the Cluster Health API [http://localhost:9200/_cluster/health], the
Node Info API [http://localhost:9200/_cluster/nodes] or GUI tools
such as http://github.com/lukas-vlcek/bigdesk and
http://mobz.github.com/elasticsearch-head to inspect the cluster state.
使用集群体检API[http://localhost:9200/_cluster/health] ,
节点信息API[http://localhost:9200/_cluster/nodes] 或者GUI工具例如:
#
# # node.rack: rack314
#
索引
# # # Note, that it makes more sense to configure index settings specifically for # a certain index, either when creating it or by using the index templates API. # 提示,针对一个特定的索引进行配置更合理,不论是在创建索引还是使用索引模板API的时候。 # # # See http://elasticsearch.org/guide/reference/index-modules/ and # http://elasticsearch.org/guide/reference/api/admin-indices-create-index.html # for more information. # 详情见http://elasticsearch.org/guide/reference/index-modules/和 # http://elasticsearch.org/guide/reference/api/admin-indices-create-index.html
# # index.number_of_shards: 5
# # index.number_of_replicas: 1
# # # index.number_of_shards: 1 # index.number_of_replicas: 0
# # 1. Having more shards enhances the indexing performance and allows to # distribute a big index across machines. # 1. 索引分片分的多一些,可以提高索引的性能,并且把一个大的索引分布到机器中去。 # 2. Having more replicas enhances the search performance and improves the # cluster availability. # 2. 副本分片分的多一些,可以提高搜索的性能,并且提高集群的可用性。 # # The "number_of_shards" is a one-time setting for an index. # "number_of_shards"对一个索引来说只能配置一次 # # The "number_of_replicas" can be increased or decreased anytime, # by using the Index Update Settings API. # "number_of_replicas"在任何时候都可以增加或减少,通过Index Update Settings(索引更新配置)API可以做到这一点。 # # # ElasticSearch takes care about load balancing, relocating, gathering the # results from nodes, etc. Experiment with different settings to fine-tune # your setup. # ElasticSearch 会维护load balancin(负载均衡),relocating(重定位),合并来自各个节点的结果等等。 # 你可以实验不同的配置来进行优化。 #
Use the Index Status API (http://localhost:9200/A/_status) to inspect
使用Index Status(索引状态)API (http://localhost:9200/A/_status)查看索引状态
Paths(路径)
# # path.conf: /path/to/conf
# # path.data: /path/to/data # # Can optionally include more than one location, causing data to be striped across # the locations (a la RAID 0) on a file level, favouring locations with most free # space on creation. For example: # 可以随意的包含不止一个位置,这样数据会在文件层跨越多个位置(a la RAID 0),创建时会 # 优先选择大的剩余空间的位置 # # path.data: /path/to/data1,/path/to/data2
# # path.work: /path/to/work
# # path.logs: /path/to/logs
# # path.plugins: /path/to/plugins
插件 #
# # plugin.mandatory: mapper-attachments,lang-groovy
内存 #
# # # Set this property to true to lock the memory: # 设置这个属性为true来锁定内存 # # bootstrap.mlockall: true
#
#
# You should also make sure that the ElasticSearch process is allowed to lock
# the memory, eg. by using ulimit -l unlimited
.
# 你应该确保ElasticSearch的进程可以锁定内存,例如:使用`ulimit -l unlimited`
#
Network(网络) 和 HTTP #
# #
# # network.bind_host: 192.168.0.1
# # network.publish_host: 192.168.0.1
# # network.host: 192.168.0.1
# # transport.tcp.port: 9300
# # transport.tcp.compress: true
# # http.port: 9200
# # http.max_content_length: 100mb
# # http.enabled: false
Gateway
#
还有多种类型的gateway实现。详情见http://elasticsearch.org/guide/reference/modules/gateway
# # gateway.type: local
#
# # gateway.recover_after_nodes: 1
# # gateway.recover_after_time: 5m
# # gateway.expected_nodes: 2
# Recovery Throttling (节点恢复限流阀) #
#
# # 1. During the initial recovery # 1. 初始化恢复期间 # # cluster.routing.allocation.node_initial_primaries_recoveries: 4 # # 2. During adding/removing nodes, rebalancing, etc # 2. 添加/删除节点,再平衡等期间 # # cluster.routing.allocation.node_concurrent_recoveries: 2
# # indices.recovery.max_size_per_sec: 0
#
# Discovery(探查) #
# # discovery.zen.minimum_master_nodes: 1
# # discovery.zen.ping.timeout: 3s
# # 1. Disable multicast discovery (enabled by default): # 1. 禁用多播探查(默认可用) # # discovery.zen.ping.multicast.enabled: false # # 2. Configure an initial list of master nodes in the cluster # to perform discovery when new nodes (master or data) are started: # 2. 这是一个集群中的主节点的初始列表,当节点(主节点或者数据节点)启动时使用这个列表进行探查 # # # discovery.zen.ping.unicast.hosts: ["host1", "host2:port", "host3[portX-portY]"]
# # You have to install the cloud-aws plugin for enabling the EC2 discovery. # 想要启用EC2探查功能,你必须安装cloud-aws插件 # # See http://elasticsearch.org/guide/reference/modules/discovery/ec2.html # for more information. # 详情见http://elasticsearch.org/guide/reference/modules/discovery/ec2.html # # # See http://elasticsearch.org/tutorials/2011/08/22/elasticsearch-on-ec2.html # for a step-by-step tutorial. # 详情见http://elasticsearch.org/tutorials/2011/08/22/elasticsearch-on-ec2.html
# Slow Log(慢日志) #
#
#index.search.slowlog.threshold.query.warn: 10s #index.search.slowlog.threshold.query.info: 5s #index.search.slowlog.threshold.query.debug: 2s #index.search.slowlog.threshold.query.trace: 500ms
#index.search.slowlog.threshold.fetch.warn: 1s #index.search.slowlog.threshold.fetch.info: 800ms #index.search.slowlog.threshold.fetch.debug: 500ms #index.search.slowlog.threshold.fetch.trace: 200ms
#index.indexing.slowlog.threshold.index.warn: 10s #index.indexing.slowlog.threshold.index.info: 5s #index.indexing.slowlog.threshold.index.debug: 2s #index.indexing.slowlog.threshold.index.trace: 500ms
# GC Logging #
#monitor.jvm.gc.ParNew.warn: 1000ms #monitor.jvm.gc.ParNew.info: 700ms #monitor.jvm.gc.ParNew.debug: 400ms
#monitor.jvm.gc.ConcurrentMarkSweep.warn: 10s #monitor.jvm.gc.ConcurrentMarkSweep.info: 5s #monitor.jvm.gc.ConcurrentMarkSweep.debug: 2s