elasticsearch.yml配置文件解讀(ES配置詳解)
elasticsearch的config文件夾里面有一個主配置文件:elasticsearch.yml是es的基本配置文件。下面主要講解下elasticsearch.yml這個文件中可配置的東西。
源文件
# ======================== 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 consult the documentation for further information on configuration options: # https://www.elastic.co/guide/en/elasticsearch/reference/index.html # # ---------------------------------- Cluster ----------------------------------- # # Use a descriptive name for your cluster: # #cluster.name: my-application # # ------------------------------------ Node ------------------------------------ # # Use a descriptive name for the node: # #node.name: node-1 # # Add custom attributes to the node: # #node.attr.rack: r1 # # ----------------------------------- Paths ------------------------------------ # # Path to directory where to store the data (separate multiple locations by comma): # path.data: /home/es/elasticsearch-6.0.0/data # # Path to log files: # path.logs: /home/es/elasticsearch-6.0.0/logs # # ----------------------------------- Memory ----------------------------------- # # Lock the memory on startup: # bootstrap.memory_lock: true # # Make sure that the heap size 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.0.1 # # Set a custom port for HTTP: # #http.port: 9200 # # For more information, consult the network module documentation. # # --------------------------------- 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: ["host1", "host2"] # # Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1): # #discovery.zen.minimum_master_nodes: 3 # # For more information, consult the zen discovery module documentation. # # ---------------------------------- Gateway ----------------------------------- # # Block initial recovery after a full cluster restart until N nodes are started: # #gateway.recover_after_nodes: 3 # # For more information, consult the gateway module documentation. # # ---------------------------------- Various ----------------------------------- # # Require explicit names when deleting indices: # #action.destructive_requires_name: true
詳細(xì)解釋
cluster.name: elasticsearch
配置es的集群名稱,默認(rèn)是elasticsearch,es會自動發(fā)現(xiàn)在同一網(wǎng)段下的es,如果在同一網(wǎng)段下有多個集群,就可以用這個屬性來區(qū)分不同的集群。
node.name: "Franz Kafka"
節(jié)點名,默認(rèn)隨機(jī)指定一個name列表中名字,該列表在es的jar包中config文件夾里name.txt文件中,其中有很多作者添加的有趣名字。
node.master: true
指定該節(jié)點是否有資格被選舉成為node,默認(rèn)是true,es是默認(rèn)集群中的第一臺機(jī)器為master,如果這臺機(jī)掛了就會重新選舉master。
node.data: true
指定該節(jié)點是否存儲索引數(shù)據(jù),默認(rèn)為true。
index.number_of_shards: 5
設(shè)置默認(rèn)索引分片個數(shù),默認(rèn)為5片。
index.number_of_replicas: 1
設(shè)置默認(rèn)索引副本個數(shù),默認(rèn)為1個副本。
path.conf: /path/to/conf
設(shè)置配置文件的存儲路徑,默認(rèn)是es根目錄下的config文件夾。
path.data: /path/to/data
設(shè)置索引數(shù)據(jù)的存儲路徑,默認(rèn)是es根目錄下的data文件夾,可以設(shè)置多個存儲路徑,用逗號隔開,例:
path.data: /path/to/data1,/path/to/data2
path.work: /path/to/work
設(shè)置臨時文件的存儲路徑,默認(rèn)是es根目錄下的work文件夾。
path.logs: /path/to/logs
設(shè)置日志文件的存儲路徑,默認(rèn)是es根目錄下的logs文件夾
path.plugins: /path/to/plugins
設(shè)置插件的存放路徑,默認(rèn)是es根目錄下的plugins文件夾
bootstrap.mlockall: true
設(shè)置為true來鎖住內(nèi)存。因為當(dāng)jvm開始swapping時es的效率會降低,所以要保證它不swap,可以把ES_MIN_MEM和ES_MAX_MEM兩個環(huán)境變量設(shè)置成同一個值,并且保證機(jī)器有足夠的內(nèi)存分配給es。同時也要允許elasticsearch的進(jìn)程可以鎖住內(nèi)存,Linux下可以通過ulimit -l unlimited
命令。
network.bind_host: 192.168.0.1
設(shè)置綁定的ip地址,可以是ipv4或ipv6的,默認(rèn)為0.0.0.0。
network.publish_host: 192.168.0.1
設(shè)置其它節(jié)點和該節(jié)點交互的ip地址,如果不設(shè)置它會自動判斷,值必須是個真實的ip地址。
network.host: 192.168.0.1
這個參數(shù)是用來同時設(shè)置bind_host和publish_host上面兩個參數(shù)。
transport.tcp.port: 9300
設(shè)置節(jié)點間交互的tcp端口,默認(rèn)是9300。
transport.tcp.compress: true
設(shè)置是否壓縮tcp傳輸時的數(shù)據(jù),默認(rèn)為false,不壓縮。
http.port: 9200
設(shè)置對外服務(wù)的http端口,默認(rèn)為9200。
http.max_content_length: 100mb
設(shè)置內(nèi)容的最大容量,默認(rèn)100mb
http.enabled: false
是否使用http協(xié)議對外提供服務(wù),默認(rèn)為true,開啟。
gateway.type: local
gateway的類型,默認(rèn)為local即為本地文件系統(tǒng),可以設(shè)置為本地文件系統(tǒng),分布式文件系統(tǒng),Hadoop的HDFS,和amazon的s3服務(wù)器,其它文件系統(tǒng)的設(shè)置方法下次再詳細(xì)說。
gateway.recover_after_nodes: 1
設(shè)置集群中N個節(jié)點啟動時進(jìn)行數(shù)據(jù)恢復(fù),默認(rèn)為1。
gateway.recover_after_time: 5m
設(shè)置初始化數(shù)據(jù)恢復(fù)進(jìn)程的超時時間,默認(rèn)是5分鐘。
gateway.expected_nodes: 2
設(shè)置這個集群中節(jié)點的數(shù)量,默認(rèn)為2,一旦這N個節(jié)點啟動,就會立即進(jìn)行數(shù)據(jù)恢復(fù)。
cluster.routing.allocation.node_initial_primaries_recoveries: 4
初始化數(shù)據(jù)恢復(fù)時,并發(fā)恢復(fù)線程的個數(shù),默認(rèn)為4。
cluster.routing.allocation.node_concurrent_recoveries: 2
添加刪除節(jié)點或負(fù)載均衡時并發(fā)恢復(fù)線程的個數(shù),默認(rèn)為4。
indices.recovery.max_size_per_sec: 0
設(shè)置數(shù)據(jù)恢復(fù)時限制的帶寬,如入100mb,默認(rèn)為0,即無限制。
indices.recovery.concurrent_streams: 5
設(shè)置這個參數(shù)來限制從其它分片恢復(fù)數(shù)據(jù)時最大同時打開并發(fā)流的個數(shù),默認(rèn)為5。
discovery.zen.minimum_master_nodes: 1
設(shè)置這個參數(shù)來保證集群中的節(jié)點可以知道其它N個有master資格的節(jié)點。默認(rèn)為1,對于大的集群來說,可以設(shè)置大一點的值(2-4)
discovery.zen.ping.timeout: 3s
設(shè)置集群中自動發(fā)現(xiàn)其它節(jié)點時ping連接超時時間,默認(rèn)為3秒,對于比較差的網(wǎng)絡(luò)環(huán)境可以高點的值來防止自動發(fā)現(xiàn)時出錯。
discovery.zen.ping.multicast.enabled: false
設(shè)置是否打開多播發(fā)現(xiàn)節(jié)點,默認(rèn)是true。
discovery.zen.ping.unicast.hosts: ["host1", "host2:port", "host3[portX-portY]"]
設(shè)置集群中master節(jié)點的初始列表,可以通過這些節(jié)點來自動發(fā)現(xiàn)新加入集群的節(jié)點。
下面是一些查詢時的慢日志參數(shù)設(shè)置
index.search.slowlog.level: TRACE 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
到此這篇關(guān)于elasticsearch.yml配置文件解讀,ES配置詳解的文章就介紹到這了,更多相關(guān)elasticsearch.yml配置文件內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
基于Laravel + Vue + Element 實現(xiàn) 人力資源系統(tǒng)(考勤應(yīng)用 )
Bee 是人力資源系統(tǒng)中的考勤應(yīng)用,主要功能用于員工申請假單。接下來通過本文給大家介紹基于Laravel + Vue + Element 考勤應(yīng)用 之 人力資源系統(tǒng),需要的朋友可以參考下2019-10-10ffmpeg安裝及音頻轉(zhuǎn)換指令應(yīng)用
ffmpeg是一套可以用來記錄、轉(zhuǎn)換數(shù)字音頻、視頻,本文主要介紹了ffmpeg安裝及音頻轉(zhuǎn)換指令應(yīng)用,具有一定的參考價值,感興趣的可以了解一下2024-02-02