ES 安装

一、单节点

1、下载、安装JDk

1、前置安装java8

jdk-8u112-linux-x64.rpm

下载地址:http://www.oracle.com/technetwork/java/javase/downloads/index.html

2、下载、安装、运行ES

2、下载

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.zip

3、解压

unzipelasticsearch-5.1.1.zip

4、运行

./bin/elasticsearch

./bin/elasticsearch -d          #后台运行

tail -flogs/elasticsearch.log          #查看日志

3、注意

注:ES有执行脚本的能力,因安全因素,不能在root用户下运行,强行运行会报如下错误:

org.elasticsearch.bootstrap.StartupException:java.lang.RuntimeException: can not run elasticsearch as root

解决方案:

groupadd es          #增加es组

useradd es -g es -p pwd          #增加es用户并附加到es组

chown -R es:es elasticsearch-5.1.1         #给目录权限

su es          #使用es用户

./bin/elasticsearch-d          #后台运行es

4、修改配置

外网访问

vim conf/elasticsearch.yml

修改network.host: 0.0.0.0

5、问题

(1)bootstrapchecks failed max filedescriptors [65535] for elasticsearch process is too low, increase to at least[65536]

启动linux可能出现如下类似错误 

bootstrapchecks failed max filedescriptors [65535] for elasticsearch process is too low, increase to at least[65536]

解决方案

1、vim /etc/sysctl.conf

设置fs.file-max=655350

保存之后sysctl -p使设置生效

2、vim /etc/security/limits.conf 新增

* soft nofile 655350

* hard nofile 655350

3、重新使用SSH登录,再次启动elasticsearch即可。

外网访问:serverip:9200/


8、为es设置跨域访问

vim config/elasticsearch.yml        #新增两行

http.cors.enabled: true

http.cors.allow-origin: "*"

(2)max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

 vim /etc/sysctl.conf文件最后添加一行

vm.max_map_count=262144
保存之后sysctl -p使设置生效

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值