浏览器访问虚拟机中的ElasticSearch

浏览器访问虚拟机中的ElasticSearch

1、设置外网可访问

首先说明环境:

  1. Linux版本:centos7.5
  2. ElasticSearch版本:ElasticSearch 6.5.3(解压后为修改版本)

ElasticSearch修改只有一步即可解决:

  1. 修改ElasticSearch的配置文件(位置:解压目录下的config/elasticsearch.yml)

    [xii@localhost root]$ vi config/elasticsearch.yml
    

    (ElasticSearch设置.assets/image-20200114204447964.png)]

  2. 保存之后,启动 ElasticSearch ./bin/elasticsearch
    在这里插入图片描述
    注意:运行要求使用普通用户,如果是root用户则会报错

修改后,再次启动ES后,可能会出现下面的错误

[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max number of threads [1024] for user [es] is too low, increase to at least [4096]
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[4]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk

然后百度了一下,根据大佬们的博客进行了修改

2、修复上述问题

2.1、修复问题[1]、[2]

  1. 问题日志描述:

    [1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
    [2]: max number of threads [1024] for user [es] is too low, increase to at    least [4096]
    
    [1]:elasticsearch过程的最大文件描述符[4096]太低,至少增加到[65536]
    [2]:用户[es]的最大线程数[1024]太低,至少增加到[4096]
    
  2. 问题修复

    注意:请使用root权限修改如下文件,修改完成后,需要重启Linux

    [root@localhost elasticsearch]# vi /etc/security/limits.conf
    

    在文件中的最下方添加如下配置

    # 这里是根据大佬配置
    # *号代表是所有用户,你也可以给单独用户分配最大文件描述符和最大线程数
    * soft nofile 65536
    * hard nofile 131072
    * soft nproc 4096
    * hard nproc 4096
    

    如果保存并重启Linux之后,基本上是不会出现问题[1]、[2]了

    但是我在实际操作中,还是会出现 bootstrap checks failed [1]: max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]问题,我明明修改了limits.conf配置了,但是还是无效,我通过 ulimit -Huulimit -Su都是4096
    在这里插入图片描述

    所以我重新对limits.conf文件进行了修改,保存重启之后就没有了这个问题
    image-20200114210923055

2.2、修复问题[3]

  1. 问题日志描述

    [3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
    
    [3]:最大虚拟内存区域vm.max_map_count [65530]太低,至少增加到[262144]
    
  2. 问题修复

    注意:请使用root权限修改如下文件,修改完成后,需要重启Linux

    [root@localhost elasticsearch]# vi /etc/sysctl.conf
    

    在文件中的最下方添加如下配置

    vm.max_map_count=655360
    

    在这里插入图片描述

2.3、修复问题[4]

  1. 问题日志描述

    [4]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
    
    [4]:系统调用过滤器安装失败; 检查日志并修复您的配置或禁用系统调用筛选器,后果自负。
    
  2. 问题修复

    这个问题我没有遇到,但是我看的大佬的有这个问题,所以写在这,可能以后我会遇到

    Centos6不支持SecComp,而ES6默认bootstrap.system_call_filter为true

    [es@elk2 elasticsearch-6.2.2]$ vim config/elasticsearch.yml
    

    禁用:在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:
    取消bootstrap.memory_lock的注释,添加bootstrap.system_call_filter 配置

    1. bootstrap.memory_lock: false
    2. bootstrap.system_call_filter: false

    再次启动es,成功启动

3、修复上述问题后,但外网浏览器还是无法访问

我找了好多问题,最后发现是Linux的防火墙打开了,外网浏览器无法访问虚拟机中的ElasticSearch

# 查看防火墙状态
firewall-cmd --state

在这里插入图片描述
如果是开启的,则为绿色的running

我的系统版本是centos7.5,所以关闭防火墙为

# 关闭防火墙
systemctl stop firewalld.service

关闭后,在使用 firewall-cmd --state查看防火墙状态
在这里插入图片描述
最后我的就可以访问了,我的地址为http://192.168.254.66:9200/
在这里插入图片描述

  • 11
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值