您的位置:首页 > 运维架构 > Linux

Linux ES集群服务配置说明

2017-08-30 11:58 232 查看
说明:
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:
内网ip:172.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:
 内网ip:172.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版本一致。
分别将插件文件夹拷贝到ES的plugins路径,路径地址如下:
/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/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: