说明:

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文件。

 

注:外部词典暂时关闭。

 

五、启动服务

三台服务均切换到elastic用户,所处路径为:

/home/elastic

执行如下指令,后台启动ES服务:

./elasticsearch-5.5.0/bin/elasticsearch -d

查看ES服务进程指令:

ps -ef | grep elasticsearch

 

启动后,可通过如下命令查看服务是否正常运行:

curl http://内网ip:9200/

相关文章:

  • 2021-11-23
  • 2021-11-20
  • 2022-12-23
  • 2022-12-23
  • 2021-07-03
  • 2022-01-15
  • 2022-12-23
  • 2021-05-12
猜你喜欢
  • 2022-03-03
  • 2021-10-14
  • 2022-12-23
  • 2021-06-28
  • 2022-12-23
  • 2022-12-23
  • 2022-01-07
相关资源
相似解决方案