ElasticSearch安装

本章要点:elasticsearch的安装等

  1. centos下安装

    • 官网:https://www.elastic.co/cn/,目前最高版本是7.1.1,更新于2019/5/29

    • 安装java环境(一般java8)

    • 下载es的tar包,解压

    • 创建新的用户和用户组,专属于es用的(为了安全考虑,并且es默认是不给root用户权限启动的)

      sudo groupadd es

      sudo useradd es -g es -p 123456

      sudo chown -R es:es es所在目录

      ./es目录/bin/elasticsearch (启动)

    • 测试:curl 127.0.0.1:9200

    • 实现远程访问:

      • 修改配置:config/elasticsearch.yml 中的:network.host: 192.168.33.12(本地ip)和端口 :http.port: 9200

      • 再次启动会报如下错误:

        ERROR: [3] bootstrap checks failed [1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535] [2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] [3]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured

        解决方法:

        • 处理第一、二个错误:

          vim /etc/security/limits.conf (文件末行加入以下参数)

          es(刚所建的linux用户) soft nofile 65536
          es hard nofile 65536
          es soft nproc 4096
          es hard nproc 4096

          vi /etc/security/limits.d/20-nproc.conf ,追加配置:es soft nproc 4096

          sudo vi /etc/sysctl.conf 追加配置vm.max_map_count=655360,sudo sysctl -p 使其生效

        • 处理第三个错误:打开config/elasticsearch.yml 中的配置:cluster.initial_master_nodes: [“node-1”, “node-2”]

        • 关闭防火墙:sudo systemctl stop firewalld.service

        • 重启服务器,然后再重启es,启动成功

打赏
  • 版权声明: 本博客所有文章除特别声明外,均采用 Apache License 2.0 许可协议。转载请注明出处!
  • © 2015-2020 谭家俊
  • Powered by Hexo Theme Ayer
  • PV: UV:

请我喝杯咖啡吧~

微信