zoukankan      html  css  js  c++  java
  • Elasticsearch搭建问题汇总

    1. can not run elasticsearch as root

    因为安全问题elasticsearch 不让用root用户直接运行,所以要创建新用户

    1. 新建用户
    [root@localhost bin]# adduser test
    
    1. 为新用户设置密码
    [root@localhost bin]# passwd test
    更改用户 test 的密码 。
    新的 密码:
    无效的密码: 密码少于 8 个字符
    重新输入新的 密码:
    passwd:所有的身份验证令牌已经成功更新。
    

    密码少于8个字符会有提示但依然可以使用

    1. 给新用户赋权elasticsearch安装目录
    [root@localhost software]# chown -R test elasticsearch-7.6.2
    
    1. 切换至新用户启动
    [root@localhost bin]# su test
    [test@localhost bin]$ ./elasticsearch
    
    1. 启动后测试
      输入curl ip:9200,如果返回一个json数据说明启动成功

    2. ES启动后使用IP端口无法访问

    问题:es成功启动后输入curl localhost:9200可以正常返回json,使用http://localhost:9200/可以正常访问,但是使用http://ip:9200/无法访问
    解决办法:
    修改elasticsearch.yml文件

    vi config/elasticsearch.yml
    

    取消注释network.host并改为0.0.0.0

    network.host: 0.0.0.0
    

    3. max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]

    切换到root用户,编辑limits.conf文件

    vi /etc/security/limits.conf
    

    添加下面内容

    * soft nofile 65536
    * hard nofile 65536
    

    其中 * 代表所有用户也可以指定具体用户
    此文件修改后需要重新登录用户,才会生效
    登录后使用ulimit -Sn/ulimit -Hn查看

    4. max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

    切换到root用户,编辑sysctl.conf 文件

    vi /etc/sysctl.conf
    

    增加配置

    vm.max_map_count=262144
    

    执行命令sysctl -p使配置生效

    5. 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

    修改elasticsearch.yml

    vi config/elasticsearch.yml
    

    取消cluster.initial_master_nodes注释并保留一个节点

    cluster.initial_master_nodes: ["node-1"]
    

    后台启动es

    nohup ./elasticsearch &

  • 相关阅读:
    iPhone 移植到 iPad:
    在Xcode4 中将iPhone使用的xib转换成iPad使用的xib
    IOS7开发~Xcode5制作framework
    汇总iOS开发中需要用到的开源库
    Objective-C学习笔记 利用协议实现回调函数
    xcode 4 制作通用静态库
    (难)Codeforces Round #406 (Div. 2) D题Legacy(线段树+最短路)解题报告
    (十字链表)CodeForces
    (并查集)poj1182——食物链
    (dp)17bupt新生赛——B. Hmz 的女装
  • 原文地址:https://www.cnblogs.com/dawnyxl/p/13140955.html
Copyright © 2011-2022 走看看