zoukankan      html  css  js  c++  java
  • 完整记录安装elasticsearch的过程

    1.修改config/elsatcisearch.yml配置

    cluster.name: my-application
    node.name: node-1
    network.host: 0.0.0.0
    http.port: 9200
    cluster.initial_master_nodes: ["node-1"]

    2.如果直接运行./bin/elsaticsearch,报错

    [o.e.b.ElasticsearchUncaughtExceptionHandler] [node-1] uncaught exception in thread [main]
    org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root

    3. 添加一个用来运行es的用户

    useradd zen
    passwd zen

    4.把/opt/elasticsearch-7.13.1目录以及子目录拥有者和组改为zen这个用户

    chown -R zen:zen /opt/elasticsearch-7.13.1

    5.切换到zen用户,运行elsaticsearch报错:

    max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
    bootstrap check failure [2] of [2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

    su zen
    ./bin/elasticsearch

     6. 解决上面的问题

    1#解决文件创建限制问题,#切换到root用户
    su root
    #修改最大可创建文件大小限制
    vim /etc/security/limits.conf
    #在文件末尾添加下面两项
    zen soft nofile 65536
    zen hard nofile 65536
    
    #==
    vim /etc/security/limits.d/20-nproc.conf
    #在末尾添加
    zen soft nofile 65536
    zen hard nofile 65536
    * hard nproc 4096
    # * 代表所有linux用户名称
    
    2# 解决虚拟内存太小问题
    vim /etc/sysctl.conf
    #添加如下内容
    vm.max_map_count=655360
    # 重新加载
    sysctl -p

     7.切换zen用户,运行

    su zen
    ./elasticsearch

     8.输入http://192.168.135.100:9200/访问不到,因为centos7没有打开9200端口,开启9200端口

    firewall-cmd --add-port=9200/tcp --zone=public --permanent
    firewall-cmd --reload

    9.http://192.168.135.100:9200/正常打开

    {
    "name": "node-1",
    "cluster_name": "my-application",
    "cluster_uuid": "mzOq-NcVS_2SwVH3G2kV9w",
    "version": {
    "number": "7.13.1",
    "build_flavor": "default",
    "build_type": "tar",
    "build_hash": "9a7758028e4ea59bcab41c12004603c5a7dd84a9",
    "build_date": "2021-05-28T17:40:59.346932922Z",
    "build_snapshot": false,
    "lucene_version": "8.8.2",
    "minimum_wire_compatibility_version": "6.8.0",
    "minimum_index_compatibility_version": "6.0.0-beta1"
    },
    "tagline": "You Know, for Search"
    }
  • 相关阅读:
    [oracle 使用(1)] win7/10 下Oracle10g的安装与卸载
    [原创]利用爬虫技术获取网页数据,以及想要的指定数据
    [mysql使用(1)] 64位Linux下安装mysql-5.7.13-linux-glibc2.5-x86_64
    aop 常见的问题
    Git技巧:右键菜单怎么去除?
    jrebel激活
    python与mysql连接
    linux下mysql的安装
    Linux下jdk和tomcat安装
    Lotto
  • 原文地址:https://www.cnblogs.com/powerbear/p/14879649.html
Copyright © 2011-2022 走看看