• linux安装ES


    1.需要先安装JDK(必须是1.8以上)    

    参考链接:https://blog.csdn.net/qq_40806970/article/details/104553635

    2.下载ES包    参考链接:https://blog.csdn.net/he19970408/article/details/107359861/

    wget http://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.4.1.tar.gz    #后面是es的版本

    3.解压压缩包

    tar -zxvf elasticsearch-6.4.1.tar.gz

    4.运行ES服务   (注意用root用户启动会报错)

    在bin目录中执行   ./elasticsearch
        
    注意:root用户启动[2018-09-19T14:50:04,029][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root

    5.不能以root用户身份来启动

    创建新用户:adduser es
    修改用户密码:passwd es
    配置文件权限:chown -R es /home/elasticsearch-6.4.1 #在root用户下根目录,赋予用户文件权限
    切换用户: su es

    6.启动ES

    进入ES文件目录:/home/elasticsearch-6.4.1/bin
    启动: ./elasticsearch       或者./elasticsearch -d  (-d代表在后台执行)

    7.测试是否安装成功

    另起一个终端执行: curl http://localhost:9200   出现以下内容说明成功
    {
      "name" : "r7rn72t",
      "cluster_name" : "elasticsearch",
      "cluster_uuid" : "x5gy7QF6T6mDkxMlw5aDjQ",
      "version" : {
        "number" : "6.4.1",
        "build_flavor" : "default",
        "build_type" : "tar",
        "build_hash" : "e36acdb",
        "build_date" : "2018-09-13T22:18:07.696808Z",
        "build_snapshot" : false,
        "lucene_version" : "7.4.0",
        "minimum_wire_compatibility_version" : "5.6.0",
        "minimum_index_compatibility_version" : "5.0.0"
      },
      "tagline" : "You Know, for Search"
    }

    8.开启ES远程访问

    在es根目录下的config文件夹下elasticsearch.yml 
    vim elasticsearch.yml   将原来的network修改为以下配置:
    network.host:0.0.0.0

     9.重启ES

    重新启动出现如下错误
    ERROR: [2] bootstrap checks failed
    [1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
    [2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
    
    解决方法:
    切换到root用户修改: su root
    vim /etc/security/limits.conf
    在最后面加上以下内容
    * soft nofile 65536
    * hard nofile 65536
    * soft nproc 4096
    * hard nproc 4096
    
    修改 vim /etc/sysctl.conf
    在最后面加上  vm.max_map_count=655360
    
    修改完之后  sysctl -p
    再次切换到es用户启动ES

    10.外部浏览器访问   (阿里云服务器需要开启9200端口,才能访问)

    http://es的主机名:9200  出现以下信息说明安装成功:
    {
      "name" : "r7rn72t",
      "cluster_name" : "elasticsearch",
      "cluster_uuid" : "x5gy7QF6T6mDkxMlw5aDjQ",
      "version" : {
        "number" : "6.4.1",
        "build_flavor" : "default",
        "build_type" : "tar",
        "build_hash" : "e36acdb",
        "build_date" : "2018-09-13T22:18:07.696808Z",
        "build_snapshot" : false,
        "lucene_version" : "7.4.0",
        "minimum_wire_compatibility_version" : "5.6.0",
        "minimum_index_compatibility_version" : "5.0.0"
      },
      "tagline" : "You Know, for Search"
    }
  • 相关阅读:
    djongo 前端页面展示自定义api返回的列表数据,并拼接到table上
    ou are trying to add a non-nullable field 'address' to person without a default; we can't do that (the database needs something to populate existing rows).
    python string 类型的公钥转换类型并解密
    Django 禁止访问403,CSRF验证失败,相应中断
    springboot async
    此博客可能不再更新,往后博文将发布在 GitHub 中
    css 中 transition 需要注意的问题
    学习笔记(九)
    微信小程序 drawImage 问题
    学习笔记(八)
  • 原文地址:https://www.cnblogs.com/wangcuican/p/13864370.html
Copyright © 2020-2023  润新知