es-配置詳解

(1)集群名稱,默認(rèn)為elasticsearch

cluster.name:elasticsearch

(2)節(jié)點(diǎn)名稱,es啟動(dòng)時(shí)會(huì)自動(dòng)創(chuàng)建節(jié)點(diǎn)名稱,但你也可進(jìn)行配置

node.name: "node1"

(3)是否作為主節(jié)點(diǎn),每個(gè)節(jié)點(diǎn)都可以被配置成為主節(jié)點(diǎn),默認(rèn)值為true

node.master: true

(4)是否存儲數(shù)據(jù),即存儲索引片段,默認(rèn)值為true

node.data: true
       {master和data同時(shí)配置會(huì)產(chǎn)生一些奇異的效果:
       1) 當(dāng)master為false,而data為true時(shí),會(huì)對該節(jié)點(diǎn)產(chǎn)生嚴(yán)重負(fù)荷;
       2) 當(dāng)master為true,而data為false時(shí),該節(jié)點(diǎn)作為一個(gè)協(xié)調(diào)者;
       3) 當(dāng)master為false,data也為false時(shí),該節(jié)點(diǎn)就變成了一個(gè)負(fù)載均衡器。}

(5)每個(gè)節(jié)點(diǎn)都可以定義一些與之關(guān)聯(lián)的通用屬性,用于后期集群進(jìn)行碎片分配時(shí)的過濾

node.rack: rack1

(6)默認(rèn)情況下,多個(gè)節(jié)點(diǎn)可以在同一個(gè)安裝路徑啟動(dòng),如果你想讓你的es只啟動(dòng)一個(gè)節(jié)點(diǎn),可以進(jìn)行如下設(shè)置

node.max_local_storage_nodes: 1

(7)設(shè)置一個(gè)索引的碎片數(shù)量,默認(rèn)值為5

index.number_of_shards: 5

(8)設(shè)置一個(gè)索引可被復(fù)制的數(shù)量,默認(rèn)值為1

index.number_of_replicas: 1

(9)配置文件所在的位置,即elasticsearch.yml和logging.yml所在的位置

path.conf: /path/to/conf

(10) 分配給當(dāng)前節(jié)點(diǎn)的索引數(shù)據(jù)所在的位置:

path.data: /path/to/data

(11) 臨時(shí)文件位置:

        path.work: /path/to/work

(12)日志文件所在位置:

        path.logs: /path/to/logs

(13) 插件安裝位置:

        path.plugins: /path/to/plugins

(14) 插件托管位置,若列表中的某一個(gè)插件未安裝,則節(jié)點(diǎn)無法啟動(dòng):

        plugin.mandatory: mapper-attachments,lang-groovy

(15) JVM開始交換時(shí),ElasticSearch表現(xiàn)并不好:你需要保障JVM不進(jìn)行交換,可以將bootstrap.mlockall設(shè)置為true禁止交換:

        bootstrap.mlockall: true

        請確保ES_MIN_MEM和ES_MAX_MEM的值是一樣的,并且能夠?yàn)镋lasticSearch分配足夠的內(nèi)在,并為系統(tǒng)操作保留足夠的內(nèi)存。

(16)默認(rèn)情況下,ElasticSearch使用0.0.0.0地址,并為http傳輸開啟9200-9300端口,為節(jié)點(diǎn)到節(jié)點(diǎn)的通信開啟9300-9400端口,也可以自行設(shè)置IP地址:

        network.bind_host: 192.168.0.1

(17)publish_host設(shè)置其他節(jié)點(diǎn)連接此節(jié)點(diǎn)的地址,如果不設(shè)置的話,則自動(dòng)獲取,publish_host的地址必須為真實(shí)地址:

        network.publish_host: 192.168.0.1

(18)bind_host和publish_host可以一起設(shè)置:

        network.host: 192.168.0.1

(19)可以定制該節(jié)點(diǎn)與其他節(jié)點(diǎn)交互的端口:

        transport.tcp.port: 9300

(20)節(jié)點(diǎn)間交互時(shí),可以設(shè)置是否壓縮,轉(zhuǎn)為為不壓縮:

        transport.tcp.compress: true

(21)可以為Http傳輸監(jiān)聽定制端口:

        http.port: 9200

(22)設(shè)置內(nèi)容的最大長度:

        http.max_content_length: 100mb

(23)禁止HTTP

        http.enabled: false

(24)網(wǎng)關(guān)允許在所有集群重啟后持有集群狀態(tài),集群狀態(tài)的變更都會(huì)被保存下來,當(dāng)?shù)谝淮螁⒂眉簳r(shí),可以從網(wǎng)關(guān)中讀取到狀態(tài),默認(rèn)網(wǎng)關(guān)類型(也是推薦的)是local:

        gateway.type: local

(25)允許在N個(gè)節(jié)點(diǎn)啟動(dòng)后恢復(fù)過程:

        gateway.recover_after_nodes: 1

(26)設(shè)置初始化恢復(fù)過程的超時(shí)時(shí)間:

        gateway.recover_after_time: 5m

(27)設(shè)置該集群中可存在的節(jié)點(diǎn)上限:

        gateway.expected_nodes: 2

(28)設(shè)置一個(gè)節(jié)點(diǎn)的并發(fā)數(shù)量,有兩種情況,一種是在初始復(fù)蘇過程中:

        cluster.routing.allocation.node_initial_primaries_recoveries: 4

        另一種是在添加、刪除節(jié)點(diǎn)及調(diào)整時(shí):

        cluster.routing.allocation.node_concurrent_recoveries: 2

(29)設(shè)置復(fù)蘇時(shí)的吞吐量,默認(rèn)情況下是無限的:

        indices.recovery.max_size_per_sec: 0

(30)設(shè)置從對等節(jié)點(diǎn)恢復(fù)片段時(shí)打開的流的數(shù)量上限:

        indices.recovery.concurrent_streams: 5

(31)設(shè)置一個(gè)集群中主節(jié)點(diǎn)的數(shù)量,當(dāng)多于三個(gè)節(jié)點(diǎn)時(shí),該值可在2-4之間:

        discovery.zen.minimum_master_nodes: 1

(32)設(shè)置ping其他節(jié)點(diǎn)時(shí)的超時(shí)時(shí)間,網(wǎng)絡(luò)比較慢時(shí)可將該值設(shè)大:

        discovery.zen.ping.timeout: 3s

        http://elasticsearch.org/guide/reference/modules/discovery/zen.html上有更多關(guān)于discovery的設(shè)置。

(33)禁止當(dāng)前節(jié)點(diǎn)發(fā)現(xiàn)多個(gè)集群節(jié)點(diǎn),默認(rèn)值為true:

        discovery.zen.ping.multicast.enabled: false

(34)設(shè)置新節(jié)點(diǎn)被啟動(dòng)時(shí)能夠發(fā)現(xiàn)的主節(jié)點(diǎn)列表:

        discovery.zen.ping.unicast.hosts: ["host1", "host2:port", "host3[portX-portY]"]

作者:CodeFarmerChen
鏈接:http://www.itdecent.cn/p/48a2023a6972

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容