Linux ES集群服務配置說明


說明:

ES官網不建議在root用戶使用Elastic Server,因此ES集群配置均使用普通賬戶操作,新建賬戶 elastic。

Linux版本為CentOS 7.3,ES版本為5.5.0.

 

一、下載並安裝ES程序

下載路徑:/home/elastic

下載指令:

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.0.tar.gz

安裝指令:tar -zxvf elasticsearch-5.5.0.tar.gz

 

二、系統參數設置

為了讓ES服務正常啟動,需要設置如下參數(root用戶權限):

1、修改max file descriptors參數

vim /etc/security/limits.conf打開limits文件

添加或修改如下兩行參數:

*        hard    nofile           65536

*        soft     nofile           65536

查看設置參數是否生效指令:

ulimit -Hn

注:賬戶需要注銷后重新登錄方可查看設置值。

 

此設置參數對應ES啟動錯誤如下:

max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]

 

2、修改vm.max_map_count參數

1)臨時修改方法:

sysctl -w vm.max_map_count=262144

sysctl -p

查看參數指令:

sysctl -a | grep "vm.max_map_count"

注:主機重啟后,參數會還原。

2)永久修改方法:

vim /etc/sysctl.conf添加vm.max_map_count=262144,保存后執行sysctl -p即可。

 

此設置參數對應ES啟動錯誤如下:

max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]

三、ES集群配置

客戶端節點Clinet

內網ip172.26.178.100

elasticsearch.yml參數配置:路徑/home/elastic/elasticsearch-5.5.0/config

修改文件參數如下:

cluster.name: tuyou-application

node.name: node-195

#client節點設置

node.master: false

node.data: false

network.host: 172.26.178.100

http.port: 9200

#查詢master節點地址列表

discovery.zen.ping.unicast.hosts: ["172.26.178.99", "172.26.178.98"]

#配合head插件管理ES集群

http.cors.enabled: true

http.cors.allow-origin: "*"

 

混合節點Master/Data:

 內網ip:172.26.178.99

elasticsearch.yml參數配置:

修改文件參數如下:

cluster.name: tuyou-application

node.name: node-255

network.host: 172.26.178.99

http.port: 9200

discovery.zen.ping.unicast.hosts: ["172.26.178.98", "172.26.178.99"]

discovery.zen.minimum_master_nodes: 2

 

混合節點Master/Data:

 內網ip172.26.178.98

elasticsearch.yml參數配置:

修改文件參數如下:

cluster.name: tuyou-application

node.name: node-150

network.host: 172.26.178.98

http.port: 9200

discovery.zen.ping.unicast.hosts: ["172.26.178.99", "172.26.178.98"]

discovery.zen.minimum_master_nodes: 2

 

四、安裝分詞插件

注:Client節點無需安裝

插件包括:ik中文分詞插件,pinyin拼音分詞插件,注意插件版本應和ES版本一致。

分別將插件文件夾拷貝到ESplugins路徑,路徑地址如下:

/home/elastic/elasticsearch-5.5.0/plugins

Ik插件配置說明:

路徑:/home/elastic/elasticsearch-5.5.0/plugins/ik/config下的IKAnalyzer.cfg.xml文件。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
	<comment>IK Analyzer 擴展配置</comment>
	<!--用戶可以在這里配置自己的擴展字典 -->
	<entry key="ext_dict">custom/mydict.dic;custom/single_word_low_freq.dic;custom/sougou.dic</entry>
	 <!--用戶可以在這里配置自己的擴展停止詞字典-->
	<entry key="ext_stopwords">custom/ext_stopword.dic</entry>
	<!--用戶可以在這里配置遠程擴展字典 -->
	<!-- <entry key="remote_ext_dict">http://192.168.1.152:8080/tour/interface/getCustomDict.htm</entry> -->
	<!--用戶可以在這里配置遠程擴展停止詞字典-->
	<!-- <entry key="remote_ext_stopwords">words_location</entry> -->
</properties>
 

注:外部詞典暫時關閉。

 

五、啟動服務

三台服務均切換到elastic用戶,所處路徑為:

/home/elastic

執行如下指令,后台啟動ES服務:

./elasticsearch-5.5.0/bin/elasticsearch -d

查看ES服務進程指令:

ps -ef | grep elasticsearch

 

啟動后,可通過如下命令查看服務是否正常運行:

curl http://內網ip:9200/


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2026 CODEPRJ.COM