ElasticSearch 詳細配置

1. 主要配置詳解 node

默認配置 linux

含義 bootstrap

cluster.name: elasticsearch 服務器

配置es的集羣名稱,默認是elasticsearches會自動發如今同一網段下的es,若是在同一網段下有多個集羣,就能夠用這個屬性來區分不一樣的集羣。 網絡

node.name: "Franz Kafka" 併發

節點名,默認隨機指定一個name列表中名字,該列表在esjar包中config文件夾裏name.txt文件中,其中有不少做者添加的有趣名字。 app

node.master: true 負載均衡

指定該節點是否有資格被選舉成爲master node,默認是truees默認集羣中的第一臺機器爲master,若是這臺機掛了就會從新選舉master jvm

node.data: true elasticsearch

指定該節點是否存儲索引數據,默認爲true

index.number_of_shards: 5

設置默認索引分片個數,默認爲5片。

index.number_of_replicas: 1

設置默認索引副本個數,默認爲1個副本。

path.conf: /path/to/conf

設置配置文件的存儲路徑,默認是es根目錄下的config文件夾。

path.data: /path/to/data

設置索引數據的存儲路徑,默認是es根目錄下的data文件夾,能夠設置多個存儲路徑,用逗號隔開,例:
path.data: /path/to/data1,/path/to/data2

path.work: /path/to/work

設置臨時文件的存儲路徑,默認是es根目錄下的work文件夾。

path.logs: /path/to/logs

設置日誌文件的存儲路徑,默認是es根目錄下的logs文件夾

path.plugins: /path/to/plugins

設置插件的存放路徑,默認是es根目錄下的plugins文件夾

bootstrap.mlockall: true

設置爲true來鎖住內存。由於當jvm開始swappinges的效率會下降,因此要保證它不swap,能夠把ES_MIN_MEMES_MAX_MEM兩個環境變量設置成同一個值,而且保證機器有足夠的內存分配給es。同時也要容許elasticsearch的進程能夠鎖住內存,linux下能夠經過`ulimit -l unlimited`命令。

network.bind_host: 192.168.0.1

設置綁定的ip地址,能夠是ipv4ipv6的,默認爲192.168.0.1

network.publish_host: 192.168.0.1

設置其它節點和該節點交互的ip地址,若是不設置它會自動判斷,值必須是個真實的ip地址。

network.host: 192.168.0.1

這個參數是用來同時設置bind_hostpublish_host上面兩個參數。

transport.tcp.port: 9300

設置節點間交互的tcp端口,默認是9300

transport.tcp.compress: true

設置是否壓縮tcp傳輸時的數據,默認爲true,壓縮。

http.port: 9200

設置對外服務的http端口,默認爲9200

http.max_content_length: 100mb

設置內容的最大容量,默認100mb

http.enabled: false

是否使用http協議對外提供服務,默認爲false,不開啓。

gateway.type: local

gateway的類型,默認爲local即爲本地文件系統,能夠設置爲本地文件系統,分佈式文件系統,hadoopHDFS,和amazons3服務器等。

gateway.recover_after_nodes: 1

設置集羣中N個節點啓動時進行數據恢復,默認爲1

gateway.recover_after_time: 5m

設置初始化數據恢復進程的超時時間,默認是5分鐘。

gateway.expected_nodes: 2

設置這個集羣中節點的數量,默認爲2,一旦這N個節點啓動,就會當即進行數據恢復。

cluster.routing.allocation.node_initial_primaries_recoveries: 4

初始化數據恢復時,併發恢復線程的個數,默認爲4

cluster.routing.allocation.node_concurrent_recoveries: 2

添加刪除節點或負載均衡時併發恢復線程的個數,默認爲2

indices.recovery.max_size_per_sec: 0

設置數據恢復時限制的帶寬,如入100mb,默認爲0,即無限制。

indices.recovery.concurrent_streams: 5

設置這個參數來限制從其它分片恢復數據時最大同時打開併發流的個數,默認爲5

discovery.zen.minimum_master_nodes: 1

設置這個參數來保證集羣中的節點能夠知道其它N個有master資格的節點。默認爲1,對於大的集羣來講,能夠設置大一點的值(2-4

discovery.zen.ping.timeout: 3s

設置集羣中自動發現其它節點時ping鏈接超時時間,默認爲3秒,對於比較差的網絡環境能夠高點的值來防止自動發現時出錯。

discovery.zen.ping.multicast.enabled: false

設置是否打開多播發現節點,默認是false

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

設置集羣中master節點的初始列表,能夠經過這些節點來自動發現新加入集羣的節點。

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

 

 

 

查詢時的慢日誌參數設

相關文章
相關標籤/搜索