ElasticSearch安装与配置一

    ElasticSearch是一个基于Lucene的搜索服务器。它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口。Elasticsearch是用Java开发的,并作为Apache许可条款下的开放源码发布,是当前流行的企业级搜索引擎。设计用于云计算中,能够达到实时搜索,稳定,可靠,快速,安装使用方便。
   下面我们来看样它的安装步骤:
    第一、从官网下载linux版本的elasticsearch安装程序,https://www.elastic.co/cn/downloads/elasticsearch (最好直接通过迅雷工具下载,普通下载太慢了)目前的版本是7.x的:elasticsearch-7.0.1-linux-x86_64.tar.gz
    第二、centos服务器安装ftp软件(winSCP等),通过ftp软件把elasticsearch-7.0.1-linux-x86_64.tar.gz上传到服务器的opt/mysoft目录下。
    第三、提供tar -zxvf elasticsearch-7.0.1-linux-x86_64.tar.gz 解压到当前目录下,通过命令:mv elasticsearch-7.0.1/ elasticsearch 重命名为elasticsearch
    第四、通过命令:sh /opt/mysoft/elasticsearch/bin/elasticsearch 启动ElasticSearch。启动后会抛出异常:
     
   解决方法:
        1.添加用户:useradd elastic
        2.给用户授权:chown -R elastic:elastic /opt/mysoft/elasticserch/
        3.切换用户:su elastic
        4.通过命令重写启动服务:sh /opt/mysoft/elasticsearch/bin/elasticsearch -d
        5.输入:curl http://localhost:9200 测试能够正常访问
            

   
   第五、修改配置文件:vi /opt/mysoft/elasticserch/config/elasticsearch.yml
   修改network配置本机的ip地址和端口号:
        network.host: 192.168.248.100
        http.port: 9200
   修改之后可能会出现问题:
        1.警告提示 WARN [o.e.b.JNANatives ] unable to install syscall filter
             使用新的linux版本就没问题了
        2.ERROR: bootstrap checks failed
           max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
           max number of threads [1024] for user [lishang] likely too low, increase to at least [2048]
             解决:切换到root用户,编辑limits.conf 添加类似如下内容
             vi /etc/security/limits.conf 
             添加如下内容:
             * soft nofile 65536
             * hard nofile 131072
             * soft nproc 2048
             * hard nproc 4096
        3.max number of threads [1024] for user [lish] likely too low, increase to at least [2048]
            解决:切换到root用户,进入limits.d目录下修改配置文件。
            vi /etc/security/limits.d/90-nproc.conf 
            修改如下内容:
            * soft nproc 1024
            #修改为
            * soft nproc 2048
        4.max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
            解决:切换到root用户修改配置sysctl.conf
            vi /etc/sysctl.conf 
            添加下面配置:
            vm.max_map_count=655360
            并执行命令:
            sysctl -p
        5.max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
           解决:修改切换到root用户修改配置limits.conf 添加下面两行
           命令:vi /etc/security/limits.conf
           *        hard    nofile           65536
           *        soft    nofile           65536
        6.启动Elasticsearch时使用新建的elk用户,启动时报错:max number of threads [3895] for user [elk] is too low, increase to at least [4096]
           解决方法:root用户修改:vi /etc/security/limits.d/90-nproc.conf
           *          soft    nproc     2048
           修改为:
           *          soft    nproc     4096
        7.ERROR: [1] bootstrap checks failed
           system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk。
           解决:Centos6不支持SecComp,而ES5.2.0默认bootstrap.system_call_filter为true
           禁用:在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面添加: 
           bootstrap.memory_lock: false 
           bootstrap.system_call_filter: false
        
    再次启动ElasticSearch就能够正常启动了。

    注意:在外部访问ElasticSearch服务的时候,要停掉CentOS的防火墙,不然仍旧无法访问。
               防火墙查看命令:service iptables status
               防火墙停止命令:service iptables stop

    ElasticSeach后台启动命令:sh /opt/mysoft/elasticsearch/bin/elasticsearch -d
 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

ansap

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

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

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

打赏作者

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

抵扣说明:

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

余额充值