码迷,mamicode.com
首页 > 其他好文 > 详细

Centos7安装ElasticSearch6.5.4

时间:2019-05-27 15:01:10      阅读:115      评论:0      收藏:0      [点我收藏+]

标签:map   limit   cse   oca   Lucene   rman   远程   stop   mem   

因为ElasticSearch是基于Lucene的分布式搜索引擎,Elasticsearch是用Java开发的,并作为Apache许可条款下的开放源码发布,所以需要先在你的环境中安装jre环境。具体可以参考这篇文章Centos7 安装和配置jre1.8。

第一步,下载ElasticSearch

https://www.elastic.co/downloads/elasticsearch

 

第二步,上传到/home/data目录下

cd /home
mkdir data
cd data
rz
第三步,解压文件并移动到elasticsearch目录下

tar -zxvf elasticsearch-6.5.4.tar.gz
cd ..
mkdir elasticsearch
mv /home/data/elasticsearch-6.5.4/ /home/elasticsearch/
第四步,启动elasticsearch

cd /home/elasticsearch/elasticsearch-6.5.4/bin
./elasticsearch
发现报错

 

表示不能使用root用户启动elasticsearch。我们需要创建一个用户来启动elasticsearch

groupadd esgroup
useradd esuser -g esgroup-p esuser
给elasticsearch目录授予esuser权限

chown esuser:esgroup -R /home/elasticsearch/
现在切换esuser用户再次启动

su esuser
./elasticsearch
如果出现如下标志表示启动成功了

 

测试一下,9200是elasticsearch的默认端口

curl http://localhost:9200


现在配置远程访问

修改elasticsearch配置文件

/home/elasticsearch/elasticsearch-6.5.4/config/elasticsearch.yml
network.host就是你的服务器的ip地址

 

在末尾添加

http.cors.enabled: true
http.cors.allow-origin: "*"


防火墙开放9200端口

firewall-cmd --zone=public --add-port=9200/tcp --permanent
firewall-cmd --reload
或者关闭防火墙

systemctl stop firewalld.service

systemctl disable firewalld.service 禁止防火墙开机启动
再次重启elasticsearch。

在Windows电脑的浏览器访问http://192.168.0.117:9200/

 

这就已经配置好了。

可能遇见的问题

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

解决办法:

vi /etc/security/limits.conf
在末尾添加,* 表示全部用户

* soft nofile 65536

* hard nofile 131072

* soft nproc 2048

* hard nproc 4096
max number of threads [2048] for user [lishang] likely too low, increase to at least [4096]

解决办法:

vi /etc/security/limits.d/20-nproc.conf
将如下内容

* soft nproc 2048
修改为

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

解决办法:

vi /etc/sysctl.conf
文件末尾添加

vm.max_map_count=655360
执行命令

sysctl -p
重启服务器

再次启动elasticsearch,发现可以正常启动了。

Centos7安装ElasticSearch6.5.4

标签:map   limit   cse   oca   Lucene   rman   远程   stop   mem   

原文地址:https://www.cnblogs.com/zuikeol/p/10930685.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!