Centos7 部署 Elasticsearch 7.1.1

  1. 下载
    wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.1.1-linux-x86_64.tar.gz

  2. 解压(解压到当前目录:/home/work/)
    tar -zxvf elasticsearch-7.1.1-linux-x86_64.tar.gz

  3. 配置

     3.1 添加 work 用户
             groupadd work
     		useradd work -g work -p Root@1234 (-g:指定用户组;-p:指定密码)
     		chown -R work:work /home/work/elasticsearch-7.1.1/ (修改目录所属用户)
     3.2 配置 host & port
            vim ./config/elasticsearch.yml
            修改如下配置:
            network.host: 192.168.1.1 (云服务器的内网 IP)
            http.port: 9920
    
    3.3 work 用户启动(ES 不推荐 root 用户启动,默认不支持,会出现各种问题)
           su work;(切换用户)
          ./elasticsearch -d(-d:后台启动)
    
    3.4 访问 ES
             浏览器:http://xxx.xxx.xxx.xxx:9920/
             本地:curl 192.168.1.1:9920
    
  4. Elasticsearch 部署常见问题

     4.1 elasticsearch 版本问题:7.2.0 依赖 jdk 11,7.1.1 依赖 jdk 8
     
     4.2 org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
     不能用root身份登录
     解决办法>>
     添加用户组 work:groupadd work
     添加用户 work:    useradd work -g work -p Root@1234
     修改目录权限:      chown -R work:work elasticsearch-7.1.1
     切换到 work 用户启动:su work; ./elasticsearch
    
     4.3 max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
      最大虚拟内存区域 不足:max_map_count[65530]太低,至少增加到[262144]
      解决方法>>
     vim /etc/sysctl.conf
     添加如下配置:
     vm.max_map_count=655360
     重新加载配置:
     sysctl -p
    
     4.4 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 ./config/elasticsearch.yml
     将 #cluster.initial_master_nodes: ["node-1", "node-2"]  修改为 cluster.initial_master_nodes: ["node-1"]
    

参考文档:
https://www.jianshu.com/p/d728f82abc02
https://blog.csdn.net/zhang89xiao/article/details/68925294
https://blog.csdn.net/jiankunking/article/details/65448030
https://www.cnblogs.com/mm163/p/10720759.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值