##################### ElasticSearch 配置示例 ##################### # This file contains an overview of various configuration settings, # targeted at operations staff. Application developers should # consult the guide at <http:///guide>. # 這個(gè)文件包含了各種配置的概覽,旨在配置與運(yùn)行操作相關(guān)的東西。 # 應(yīng)用程序開(kāi)發(fā)人員應(yīng)該咨詢(xún)<http:///guide> # # The installation procedure is covered at # <http:///guide/reference/setup/installation.html>. # 安裝過(guò)程在這里有<http:///guide/reference/setup/installation.html>. # # # ElasticSearch comes with reasonable defaults for most settings, # so you can try it out without bothering with configuration. # ElasticSearch 已經(jīng)提供了大部分設(shè)置,都是合理的默認(rèn)配置。 # 所以你不必進(jìn)行煩人的配置就可以嘗試一下。 # # 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:///community]. # 大多數(shù)時(shí)候,這些默認(rèn)的配置就足以運(yùn)行一個(gè)生產(chǎn)集群了。 # 如果你想優(yōu)化你的集群,或者對(duì)一個(gè)特定的配置選項(xiàng)的作用好奇,你可以訪(fǎng)問(wèn)郵件列表 # 或者IRC頻道[http:///community]. # # Any element in the configuration can be replaced with environment variables # by placing them in ${...} notation. For example: # 配置中的任何一個(gè)元素都可以被環(huán)境變量取代,這些環(huán)境變量使用${...}符號(hào)占位 # 例如: # node.rack: ${RACK_ENV_VAR} # See <http:///guide/reference/setup/configuration.html> # for information on supported formats and syntax for the configuration file. # 查看<http:///guide/reference/setup/configuration.html>了解更多 # 的可支持的格式和配置文件的語(yǔ)法。 ################################### 集群 ################################### # Cluster name identifies your cluster for auto-discovery. If you're running # multiple clusters on the same network, make sure you're using unique names. # 集群名稱(chēng)標(biāo)識(shí)了你的集群,自動(dòng)探查會(huì)用到它。 # 如果你在同一個(gè)網(wǎng)絡(luò)中運(yùn)行多個(gè)集群,那就要確保你的集群名稱(chēng)是獨(dú)一無(wú)二的。 # # cluster.name: elasticsearch #################################### 節(jié)點(diǎn) ##################################### # Node names are generated dynamically on startup, so you're relieved # from configuring them manually. You can tie this node to a specific name: # 節(jié)點(diǎn)名稱(chēng)會(huì)在啟動(dòng)的時(shí)候自動(dòng)生成,所以你可以不用手動(dòng)配置。你也可以給節(jié)點(diǎn)指定一個(gè) # 特定的名稱(chēng) # # node.name: "Franz Kafka" # Every node can be configured to allow or deny being eligible as the master, # and to allow or deny to store the data. # 每一個(gè)節(jié)點(diǎn)是否允許被選舉成為主節(jié)點(diǎn),是否允許存儲(chǔ)數(shù)據(jù),都是可以配置的 # # # Allow this node to be eligible as a master node (enabled by default): # 允許這個(gè)節(jié)點(diǎn)被選舉為一個(gè)主節(jié)點(diǎn)(默認(rèn)為允許) # # # node.master: true # # Allow this node to store data (enabled by default): # 允許這個(gè)節(jié)點(diǎn)存儲(chǔ)數(shù)據(jù)(默認(rèn)為允許) # # node.data: true # You can exploit these settings to design advanced cluster topologies. # 你可以利用這些設(shè)置設(shè)計(jì)高級(jí)的集群拓?fù)?br> # # 1. You want this node to never become a master node, only to hold data. # This will be the "workhorse" of your cluster. # 1. 你不想讓這個(gè)節(jié)點(diǎn)成為一個(gè)主節(jié)點(diǎn),只想用來(lái)存儲(chǔ)數(shù)據(jù)。 # 這個(gè)節(jié)點(diǎn)會(huì)成為你的集群的“負(fù)載器” # # 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. 你想讓這個(gè)節(jié)點(diǎn)成為一個(gè)主節(jié)點(diǎn),并且不用來(lái)存儲(chǔ)任何數(shù)據(jù),并且擁有空閑資源。 # 這個(gè)節(jié)點(diǎn)會(huì)成為你集群中的“協(xié)調(diào)器” # # 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. 你既不想讓這個(gè)節(jié)點(diǎn)變成主節(jié)點(diǎn)也不想讓其變成數(shù)據(jù)節(jié)點(diǎn),只想讓其成為一個(gè)“搜索負(fù)載均衡器” # (從節(jié)點(diǎn)中獲取數(shù)據(jù),聚合結(jié)果,等等) # # 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] , # 節(jié)點(diǎn)信息API[http://localhost:9200/_cluster/nodes] 或者GUI工具例如: # <http://github.com/lukas-vlcek/bigdesk>和<http://mobz.github.com/elasticsearch-head> # 可以查看集群狀態(tài) # # A node can have generic attributes associated with it, which can later be used # for customized shard allocation filtering, or allocation awareness. An attribute # is a simple key value pair, similar to node.key: value, here is an example: # 一個(gè)節(jié)點(diǎn)可以附帶一些普通的屬性,這些屬性可以在后面的自定義分片分配過(guò)濾或者allocation awareness中使用。 # 一個(gè)屬性就是一個(gè)簡(jiǎn)單的鍵值對(duì),類(lèi)似于node.key: value, 這里有一個(gè)例子: # # node.rack: rack314 # By default, multiple nodes are allowed to start from the same installation location # to disable it, set the following: # 默認(rèn)的,多個(gè)節(jié)點(diǎn)允許從同一個(gè)安裝位置啟動(dòng)。若想禁止這個(gè)特性,按照下面所示配置: # node.max_local_storage_nodes: 1 # #################################### 索引 #################################### # You can set a number of options (such as shard/replica options, mapping # or analyzer definitions, translog settings, ...) for indices globally, # in this file. # 你可以在這個(gè)文件中為所有的索引設(shè)置一系列的全局操作(例如 分片/副本 操作,mapping(映射) # 或者分詞器定義,translog配置,...) # # # 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. # 提示,針對(duì)一個(gè)特定的索引進(jìn)行配置更合理,不論是在創(chuàng)建索引還是使用索引模板API的時(shí)候。 # # # See <http:///guide/reference/index-modules/> and # <http:///guide/reference/api/admin-indices-create-index.html> # for more information. # 詳情見(jiàn)<http:///guide/reference/index-modules/>和 # <http:///guide/reference/api/admin-indices-create-index.html> # Set the number of shards (splits) of an index (5 by default): # 設(shè)置一個(gè)索引的分片數(shù)量(默認(rèn)為5) # # index.number_of_shards: 5 # Set the number of replicas (additional copies) of an index (1 by default): # 設(shè)置一個(gè)索引的副本數(shù)量(默認(rèn)為1) # # index.number_of_replicas: 1 # Note, that for development on a local machine, with small indices, it usually # makes sense to "disable" the distributed features: # 注意,為了使用小的索引在本地機(jī)器上開(kāi)發(fā),禁用分布式特性是合理的做法。 # # # index.number_of_shards: 1 # index.number_of_replicas: 0 # These settings directly affect the performance of index and search operations # in your cluster. Assuming you have enough machines to hold shards and # replicas, the rule of thumb is: # 這些設(shè)置會(huì)直接影響索引和查詢(xún)操作的在集群中的性能。假如你有足夠的機(jī)器來(lái)放分片和副本, # 最佳實(shí)踐是: # # 1. Having more *shards* enhances the _indexing_ performance and allows to # _distribute_ a big index across machines. # 1. 索引分片分的多一些,可以提高索引的性能,并且把一個(gè)大的索引分布到機(jī)器中去。 # 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"對(duì)一個(gè)索引來(lái)說(shuō)只能配置一次 # # The "number_of_replicas" can be increased or decreased anytime, # by using the Index Update Settings API. # "number_of_replicas"在任何時(shí)候都可以增加或減少,通過(guò)Index Update Settings(索引更新配置)API可以做到這一點(diǎn)。 # # # ElasticSearch takes care about load balancing, relocating, gathering the # results from nodes, etc. Experiment with different settings to fine-tune # your setup. # ElasticSearch 會(huì)維護(hù)load balancin(負(fù)載均衡),relocating(重定位),合并來(lái)自各個(gè)節(jié)點(diǎn)的結(jié)果等等。 # 你可以實(shí)驗(yàn)不同的配置來(lái)進(jìn)行優(yōu)化。 # # Use the Index Status API (<http://localhost:9200/A/_status>) to inspect # the index status. # 使用Index Status(索引狀態(tài))API (<http://localhost:9200/A/_status>)查看索引狀態(tài) #################################### Paths(路徑) #################################### # Path to directory containing configuration (this file and logging.yml): # 包含配置(這個(gè)文件和logging.yml)的目錄的路徑 # # path.conf: /path/to/conf # Path to directory where to store index data allocated for this node. # 存儲(chǔ)這個(gè)節(jié)點(diǎn)的索引數(shù)據(jù)的目錄的路徑 # # 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: # 可以隨意的包含不止一個(gè)位置,這樣數(shù)據(jù)會(huì)在文件層跨越多個(gè)位置(a la RAID 0),創(chuàng)建時(shí)會(huì) # 優(yōu)先選擇大的剩余空間的位置 # # path.data: /path/to/data1,/path/to/data2 # Path to temporary files: # 臨時(shí)文件的路徑 # # path.work: /path/to/work # Path to log files: # 日志文件的路徑 # # path.logs: /path/to/logs # Path to where plugins are installed: # 插件安裝路徑 # # path.plugins: /path/to/plugins #################################### 插件 ################################### # If a plugin listed here is not installed for current node, the node will not start. # 如果當(dāng)前結(jié)點(diǎn)沒(méi)有安裝下面列出的插件,結(jié)點(diǎn)不會(huì)啟動(dòng) # # plugin.mandatory: mapper-attachments,lang-groovy ################################### 內(nèi)存 #################################### # ElasticSearch performs poorly when JVM starts swapping: you should ensure that # it _never_ swaps. # 當(dāng)JVM開(kāi)始swapping(換頁(yè))時(shí)ElasticSearch性能會(huì)低下,你應(yīng)該保證它不會(huì)換頁(yè) # # # Set this property to true to lock the memory: # 設(shè)置這個(gè)屬性為true來(lái)鎖定內(nèi)存 # # bootstrap.mlockall: true # Make sure that the ES_MIN_MEM and ES_MAX_MEM environment variables are set # to the same value, and that the machine has enough memory to allocate # for ElasticSearch, leaving enough memory for the operating system itself. # 確保ES_MIN_MEM和ES_MAX_MEM環(huán)境變量設(shè)置成了同一個(gè)值,確保機(jī)器有足夠的內(nèi)存來(lái)分配 # 給ElasticSearch,并且保留足夠的內(nèi)存給操作系統(tǒng) # # # You should also make sure that the ElasticSearch process is allowed to lock # the memory, eg. by using `ulimit -l unlimited`. # 你應(yīng)該確保ElasticSearch的進(jìn)程可以鎖定內(nèi)存,例如:使用`ulimit -l unlimited` # ############################## Network(網(wǎng)絡(luò)) 和 HTTP ############################### # ElasticSearch, by default, binds itself to the 0.0.0.0 address, and listens # on port [9200-9300] for HTTP traffic and on port [9300-9400] for node-to-node # communication. (the range means that if the port is busy, it will automatically # try the next port). # 默認(rèn)的ElasticSearch把自己和0.0.0.0地址綁定,HTTP傳輸?shù)谋O(jiān)聽(tīng)端口在[9200-9300],節(jié)點(diǎn)之間 # 通信的端口在[9300-9400]。(范圍的意思是說(shuō)如果一個(gè)端口已經(jīng)被占用,它將會(huì)自動(dòng)嘗試下一個(gè)端口) # # # Set the bind address specifically (IPv4 or IPv6): # 設(shè)置一個(gè)特定的綁定地址(IPv4 or IPv6): # # network.bind_host: 192.168.0.1 # Set the address other nodes will use to communicate with this node. If not # set, it is automatically derived. It must point to an actual IP address. # 設(shè)置其他節(jié)點(diǎn)用來(lái)與這個(gè)節(jié)點(diǎn)通信的地址。如果沒(méi)有設(shè)定,會(huì)自動(dòng)獲取。 # 必須是一個(gè)真實(shí)的IP地址。 # # network.publish_host: 192.168.0.1 # Set both 'bind_host' and 'publish_host': # 'bind_host'和'publish_host'都設(shè)置 # # network.host: 192.168.0.1 # Set a custom port for the node to node communication (9300 by default): # 為節(jié)點(diǎn)之間的通信設(shè)置一個(gè)自定義端口(默認(rèn)為9300) # # transport.tcp.port: 9300 # Enable compression for all communication between nodes (disabled by default): # 為所有的節(jié)點(diǎn)間的通信啟用壓縮(默認(rèn)為禁用) # # transport.tcp.compress: true # Set a custom port to listen for HTTP traffic: # 設(shè)置一個(gè)監(jiān)聽(tīng)HTTP傳輸?shù)淖远x端口 # # http.port: 9200 # Set a custom allowed content length: # 設(shè)置一個(gè)自定義的允許的內(nèi)容長(zhǎng)度 # # http.max_content_length: 100mb # Disable HTTP completely: # 完全禁用HTTP # # http.enabled: false ################################### Gateway ################################### # The gateway allows for persisting the cluster state between full cluster # restarts. Every change to the state (such as adding an index) will be stored # in the gateway, and when the cluster starts up for the first time, # it will read its state from the gateway. # Gateway支持持久化集群狀態(tài)。狀態(tài)的每一個(gè)改變(例如添加一個(gè)索引)將會(huì)被存儲(chǔ)在gateway, # 當(dāng)集群第一次啟動(dòng)時(shí),它會(huì)從gateway中讀取它的狀態(tài)。 # # There are several types of gateway implementations. For more information, # see <http:///guide/reference/modules/gateway>. # 還有多種類(lèi)型的gateway實(shí)現(xiàn)。詳情見(jiàn)<http:///guide/reference/modules/gateway> # The default gateway type is the "local" gateway (recommended): # 默認(rèn)的gateway類(lèi)型是 "local" gateway(推薦) # # gateway.type: local # Settings below control how and when to start the initial recovery process on # a full cluster restart (to reuse as much local data as possible when using shared # gateway). # 下面的配置控制怎樣以及何時(shí)啟動(dòng)一整個(gè)集群重啟的初始化恢復(fù)過(guò)程 # (當(dāng)使用shard gateway時(shí),是為了盡可能的重用local data(本地?cái)?shù)據(jù))) # # Allow recovery process after N nodes in a cluster are up: # 一個(gè)集群中的N個(gè)節(jié)點(diǎn)啟動(dòng)后,才允許進(jìn)行恢復(fù)處理 # # gateway.recover_after_nodes: 1 # Set the timeout to initiate the recovery process, once the N nodes # from previous setting are up (accepts time value): # 設(shè)置初始化恢復(fù)過(guò)程的超時(shí)時(shí)間,超時(shí)時(shí)間從上一個(gè)配置中配置的N個(gè)節(jié)點(diǎn)啟動(dòng)后算起 # # gateway.recover_after_time: 5m # Set how many nodes are expected in this cluster. Once these N nodes # are up (and recover_after_nodes is met), begin recovery process immediately # (without waiting for recover_after_time to expire): # 設(shè)置這個(gè)集群中期望有多少個(gè)節(jié)點(diǎn)。一旦這N個(gè)節(jié)點(diǎn)啟動(dòng)(并且recover_after_nodes也符合), # 立即開(kāi)始恢復(fù)過(guò)程(不等待recover_after_time超時(shí)) # # gateway.expected_nodes: 2 ############################# Recovery Throttling (節(jié)點(diǎn)恢復(fù)限流閥) ############################# # These settings allow to control the process of shards allocation between # nodes during initial recovery, replica allocation, rebalancing, # or when adding and removing nodes. # 這些配置允許在初始化恢復(fù),副本分配,再平衡,或者添加和刪除節(jié)點(diǎn)時(shí)控制節(jié)點(diǎn)間的分片分配 # # Set the number of concurrent recoveries happening on a node: # 設(shè)置一個(gè)節(jié)點(diǎn)的并行恢復(fù)數(shù) # # 1. During the initial recovery # 1. 初始化恢復(fù)期間 # # cluster.routing.allocation.node_initial_primaries_recoveries: 4 # # 2. During adding/removing nodes, rebalancing, etc # 2. 添加/刪除節(jié)點(diǎn),再平衡等期間 # # cluster.routing.allocation.node_concurrent_recoveries: 2 # Set to throttle throughput when recovering (eg. 100mb, by default unlimited): # 設(shè)置恢復(fù)時(shí)的吞吐量(例如,100mb,默認(rèn)沒(méi)有上限) # # indices.recovery.max_size_per_sec: 0 # Set to limit the number of open concurrent streams when # recovering a shard from a peer: # 設(shè)置當(dāng)一個(gè)分片從對(duì)等點(diǎn)恢復(fù)時(shí)能夠打開(kāi)的并發(fā)流的上限 # # indices.recovery.concurrent_streams: 5 ################################## Discovery(探查) ################################## # Discovery infrastructure ensures nodes can be found within a cluster # and master node is elected. Multicast discovery is the default. # 探查機(jī)制能夠保障一個(gè)集群中的節(jié)點(diǎn)能被找到,并且主節(jié)點(diǎn)能夠被選舉出來(lái)。 # 默認(rèn)的方式為多播。 # Set to ensure a node sees N other master eligible nodes to be considered # operational within the cluster. Set this option to a higher value (2-4) # for large clusters (>3 nodes): # 這個(gè)選項(xiàng)用來(lái)設(shè)置一個(gè)節(jié)點(diǎn)可以看到其他N個(gè)在集群中具有可操性的并且具有當(dāng)選主節(jié)點(diǎn)資格的節(jié)點(diǎn) # 對(duì)于大的集群(大于3個(gè)節(jié)點(diǎn)),這個(gè)選項(xiàng)應(yīng)該設(shè)置成一個(gè)高一點(diǎn)的值(2-4) # # discovery.zen.minimum_master_nodes: 1 # Set the time to wait for ping responses from other nodes when discovering. # Set this option to a higher value on a slow or congested network # to minimize discovery failures: # 設(shè)置在探查過(guò)程中從其他節(jié)點(diǎn)返回ping的回應(yīng)的等待時(shí)間 # 在一個(gè)低速或者擁堵的網(wǎng)絡(luò)環(huán)境中這個(gè)選項(xiàng)應(yīng)該設(shè)置的大一些,這樣可以降低探查失敗的可能性。 # # discovery.zen.ping.timeout: 3s # See <http:///guide/reference/modules/discovery/zen.html> # for more information. # 詳情見(jiàn)<http:///guide/reference/modules/discovery/zen.html> # Unicast discovery allows to explicitly control which nodes will be used # to discover the cluster. It can be used when multicast is not present, # or to restrict the cluster communication-wise. # 利用單播探查,我們可以顯示的指定哪些節(jié)點(diǎn)在探查集群過(guò)程中會(huì)被用到。 # 當(dāng)多播不可用,或者需要約束集群的通信時(shí)可以使用單播探查。 # # 1. Disable multicast discovery (enabled by default): # 1. 禁用多播探查(默認(rèn)可用) # # 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. 這是一個(gè)集群中的主節(jié)點(diǎn)的初始列表,當(dāng)節(jié)點(diǎn)(主節(jié)點(diǎn)或者數(shù)據(jù)節(jié)點(diǎn))啟動(dòng)時(shí)使用這個(gè)列表進(jìn)行探查 # # # discovery.zen.ping.unicast.hosts: ["host1", "host2:port", "host3[portX-portY]"] # EC2 discovery allows to use AWS EC2 API in order to perform discovery. # 為了執(zhí)行探查EC2探查允許使用AWS EC2 API # # You have to install the cloud-aws plugin for enabling the EC2 discovery. # 想要啟用EC2探查功能,你必須安裝cloud-aws插件 # # See <http:///guide/reference/modules/discovery/ec2.html> # for more information. # 詳情見(jiàn)<http:///guide/reference/modules/discovery/ec2.html> # # # See <http:///tutorials/2011/08/22/elasticsearch-on-ec2.html> # for a step-by-step tutorial. # 詳情見(jiàn)<http:///tutorials/2011/08/22/elasticsearch-on-ec2.html> ################################## Slow Log(慢日志) ################################## # Shard level query and fetch threshold logging. # #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 |
|
來(lái)自: 風(fēng)_宇星 > 《ElasticSearch》