• elastic search 第一次安装 报错记录


    安装版本 elasticsearch-5.5.2
    安装路径 /usr/local/es/

    启动报错:
    /usr/local/es/elasticsearch-5.5.2/bin/
    bash ./bash ./elasticsearch

    Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error='Cannot allocate memory' (errno=12)
    #
    # There is insufficient memory for the Java Runtime Environment to continue.
    # Native memory allocation (mmap) failed to map 2060255232 bytes for committing reserved memory.
    # An error report file with more information is saved as:
    # /usr/local/es/elasticsearch-5.5.2/bin/hs_err_pid2353.log
    

      

    解决:
    切换到配置目录下  /usr/local/es/elasticsearch-5.5.2/config/
    打开  jvm.options
    将 -Xms2g 改为1g  (改1g不行就试试 改成 512m)

    再次启动试一试吧。

    报错:

    org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
    	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:127) ~[elasticsearch-5.5.2.jar:5.5.2]
    	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:114) ~[elasticsearch-5.5.2.jar:5.5.2]
    	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:67) ~[elasticsearch-5.5.2.jar:5.5.2]
    	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122) ~[elasticsearch-5.5.2.jar:5.5.2]
    	at org.elasticsearch.cli.Command.main(Command.java:88) ~[elasticsearch-5.5.2.jar:5.5.2]
    	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-5.5.2.jar:5.5.2]
    	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.5.2.jar:5.5.2]
    Caused by: java.lang.RuntimeException: can not run elasticsearch as root
    	at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:106) ~[elasticsearch-5.5.2.jar:5.5.2]
    	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:194) ~[elasticsearch-5.5.2.jar:5.5.2]
    	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:351) ~[elasticsearch-5.5.2.jar:5.5.2]
    	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:123) ~[elasticsearch-5.5.2.jar:5.5.2]
    

      

    意思是不能用root用户来启动,那我们新建一个用户来启动

    继续解决这个问题

    ## 意思是不能用root用户来启动,那我们新建一个用户来启动
    [root@VM_0_13_centos bin]# useradd elastic
    
    ##新建elastic用户 并且把目录权限赋予给elastic 
    [root@VM_0_13_centos bin]#  chown -R elastic:elastic /usr/local/es/elasticsearch-5.5.2/
    
    ##我们切换成elastic用户,然后执行
    [root@VM_0_13_centos bin]# su elastic
    [elastic@VM_0_13_centos bin]$ sh /usr/local/es/elasticsearch-5.5.2/bin/elasticsearch

      

    ## -d 后台运行
    
    [elastic@VM_0_13_centos bin]$ sh /usr/local/es/elasticsearch-5.5.2/bin/elasticsearch -d
    
    ## 检查是否启动成功
    [elastic@VM_0_13_centos bin]$ ps -ef | grep elasticsearch
    

      

    若出现这个表示成功

    我们来验证下服务是否正常运行
     curl http://localhost:9200
    

      

    {
      "name" : "QHNWXbg",
      "cluster_name" : "elasticsearch",
      "cluster_uuid" : "hVyq1z2LR9aEiyBhEsU-fw",
      "version" : {
        "number" : "5.5.2",
        "build_hash" : "b2f0c09",
        "build_date" : "2017-08-14T12:33:14.154Z",
        "build_snapshot" : false,
        "lucene_version" : "6.6.0"
      },
      "tagline" : "You Know, for Search"
    }
    

      

    感谢:
    java1234 小锋

    https://m.aliyun.com/yunqi/articles/523874

    温故而知新
  • 相关阅读:
    深入理解JVM(六)——类加载器原理
    深入理解JVM(五)——垃圾回收器
    深入理解JVM(四)——垃圾回收算法
    Let's Encrypt,免费好用的 HTTPS 证书
    开源框架(整理)
    【转】JS组件系列——Bootstrap组件福利篇:几款好用的组件推荐(二)
    C#开源项目大全
    window平台搭建Hudson服务器
    Git 常用命令
    Mongodb Windows 集群
  • 原文地址:https://www.cnblogs.com/Uzai/p/11297365.html
Copyright © 2020-2023  润新知