elasticsearch 集羣配置

記得打開9300端口
es1配置:

http.port: 9200
network.host: 0.0.0.0
#memory
bootstrap.memory_lock: true
http.cors.enabled: true
http.cors.allow-origin: "*"
cluster.name: xiaofeng
node.name: xiaofeng_1
node.master: true
node.data: true
indices.fielddata.cache.size: 50mb
discovery.zen.minimum_master_nodes: 1
discovery.zen.ping.unicast.hosts: ["ip1:9300","ip2:9300"]
path.data: /www/server/es/elasticsearch-6.5.4/data
path.logs: /www/server/es/elasticsearch-6.5.4/logs
http.cors.allow-headers: "X-Requested-With,Content-Type, Content-Length, Authorization"

es2配置:

http.port: 9200
network.host: 0.0.0.0
#memory
bootstrap.memory_lock: true
http.cors.enabled: true
http.cors.allow-origin: "*"
cluster.name: xiaofeng
node.name: xiaofeng_2
node.master: false
node.data: true
indices.fielddata.cache.size: 50mb
discovery.zen.minimum_master_nodes: 1
discovery.zen.ping.unicast.hosts: ["ip1:9300","ip2:9300"]
path.data: /www/server/es/elasticsearch-6.5.4/data
path.logs: /www/server/es/elasticsearch-6.5.4/logs
http.cors.allow-headers: "X-Requested-With,Content-Type, Content-Length, Authorization"

 

參考https://www.cnblogs.com/bixiaoyu/p/9460554.html

cluster.name: es_data #配置集羣名稱
node.name: es_node1 #節點名稱
node.master: true #指定了該節點是否有資格選舉master,默認爲true
node.data: true #指定該節點是否存儲索引數據,默認爲true,表示爲數據存儲
path.data: /usr/local/elasticsearch/data #設置索引數據存儲的位置
path.logs: /usr/local/elasticsearch/logs #設置日誌文件存儲的位置
bootstrap.memory_lock: true #設置true用來鎖住物理內存
indices.fielddata.cache.size: 50mb #索引字段緩存大小
network.host: 0.0.0.0 #監聽地址
http.port: 9200 #Elasticsearch對外提供的http端口
discovery.zen.ping.unicast.hosts: ["192.168.37.134:9300","192.168.37.135:9300","192.168.37.136:9300"] #設置集羣中master節點初始列表,可通過這些
節點自動發現新加入集羣的節點,這裏的9330端口,即爲集羣交互通信端口
discovery.zen.minimum_master_nodes: 1 #配置當前集羣最少的master節點數,默認爲1,也就是說,elasticsearch集羣中master節點數不能低於次值>,
http.cors.enabled: true #表示開啓跨域訪問支持,默認爲false
http.cors.allow-origin: "*" #表示跨域訪問允許的域名地址,,可支持正則表達式,這裏“*”表示允許所有域名訪問
http.cors.allow-headers: "X-Requested-With,Content-Type, Content-Length, Authorization" #允許跨域訪問頭部信息

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章