elasticsearch搜索引擎搭建出现的一些问题

下载好需要的版本之后解压只相应的文件夹
需要jdk环境
elasticsearch启动 ./elasticsearch -d
kibana 启动 nohup ./bin/kibana > nohub.out &
都是后台启动

Caused by: java.lang.RuntimeException: can not run elasticsearch as root
    at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:100) ~[elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:176) ~[elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:306) ~[elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:121) ~[elasticsearch-5.1.1.jar:5.1.1]
    ... 6 more

因安全因素 需要在非root环境下运行
新建用户 如:

groupadd els
useradd -g els els

创建过后执行

chown els:els elasticsearch

文件夹授权给els用户,然后切换至els用户 执行./elasticsearch 可以查看错误日志

ERROR: bootstrap checks failed
max file descriptors [65535] for elasticsearch process is too low,increase to at least [65536]
max virtual memory areas vm.max_map_count[65530] is too low, increase to at least [262144]

出现此错误是因为系统参数没有修改,需要修改如下

vim /etc/security/limits.conf  增加
els soft nofile 65536
els hard nofile 65536

修改过后需重新登录用户 使用ulimit -Hn 查看
然后打开sysctl.conf 修改

vim /etc/sysctl.conf  添加
vm.max_map_count=262144

执行sysctl -p使之生效

开启外网访问并且验证

~ vim config/elasticsearch.yml 修改
  network.host: 0.0.0.0
  http.cors.enabled: true
  http.cors.allow-origin: "*"
  http.cors.allow-methods: OPTIONS,HEAD,GET,POST,PUT,DELETE
  http.cors.allow-headers: "X-Requested-With,Content-Type,Content-Length, X-User"

修改之后重启即可

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

怪兽在此

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值