zoukankan      html  css  js  c++  java
  • centos7下elasticSearch安装配置

    OS:Centos7x虚拟机 1H2G
    jdk:1.8
    elasticsearch:5.6.0

    1、下载“elasticsearch-5.6.0.tar.gz”解压到/usr/local/elasticsearch目录下。

    2、启动elasticSearch

    这里需要注意的是es 规定 root 用户不能启动 es,所以需要创建一个用户来启动 es

    # 创建用户名为 es 的用户
    useradd es
    # 设置 es 用户的密码
    passwd es
    
    # 创建 es 的 data 和 logs 目录
    mkdir elasticsearch-5.6.0/data
    mkdir elasticsearch-5.6.0/logs 
    
    # 将 /usr/local/elasticsearch/elasticsearch-5.6.0 的拥有者设置为 es
    chown -R es:es /usr/local/elasticsearch/elasticsearch-5.6.0

    编辑配置文件config/elasticsearch.yml

    network.host: 你自己的服务器ip
    http.port: 9200

    切换到 es 用户,启动 es

    su es
    
    # -d是后台启动,第一次不建议后台启动,前台启动可以直观的看到日志信息
    bin/elasticsearch -d

    可能遇到的错误:

    问题:

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

    解决方法:

    #切换到root用户修改
    vim /etc/security/limits.conf
    
    # 在最后面追加下面内容
    es hard nofile 65536
    es soft nofile 65536

    修改后重新登录 es 用户,使用如下命令查看是否修改成功

    ulimit -Hn
    65536

    问题:

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

    解决方法 提高vm.max_map_count 的大小

    # 切换到root用户
    vim /etc/sysctl.conf
    # 在最后面追加下面内容
    vm.max_map_count=262144
    # 使用 sysctl -p 查看修改后的结果
    sysctl -p

    问题:

    Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error='Cannot allocate memory' (errno=12)

    解决方法:

    # 由于elasticsearch5.0默认分配jvm空间大小为2g,修改jvm空间分配
    # 如果使用虚拟机安装,内存最好不小于2G
    # vim config/jvm.options  
    -Xms512m
    -Xmx512m

    阿里云上可能出现的问题:

    system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk

    解决方法:在es配置中加入下面命令即可

    bootstrap.system_call_filter: false

     在确定服务器端口(9200)开启,elasticsearch启动的情况下(ps -ef | grep elasticsearch)可以在浏览器中访问

    3、关闭elasticSearch

    # 找到elasticsearch的进程号
    jps | grep Elasticsearch
    3673 Elasticsearch
    
    kill -9 3673

    技术交流群:576269252

    ------------------------------------------
    声明: 原创文章,未经允许,禁止转载!
    ------------------------------------------

  • 相关阅读:
    node 命令
    nodejs项目搭建
    linux 安装与配置
    GestureDetector
    activity切换效果
    hadoop
    phonegap 自定义插件
    自定义控件-属性自定义
    zxing demo
    select 语句的执行顺序
  • 原文地址:https://www.cnblogs.com/xxoome/p/6663993.html
Copyright © 2011-2022 走看看