美文网首页关于搜索,我们聊聊Elasticsearch
在linux上安装与启动Elasticsearch

在linux上安装与启动Elasticsearch

作者: 缓慢移动的蜗牛 | 来源:发表于2017-03-15 22:44 被阅读7947次

    环境要求:

    1. jdk至少需要在1.8.0_73以上版本
    2. linux的内核版本需要在2.6以上(我用的是centos7.x)

    Elasticsearch 下载地址

    把下载好的tar包解压至/usr/local目录下

    [root@localhost local]# tar -zxvf elasticsearch-5.2.2
    

    如果此时只接启动elasticsearch的话,会报错

    [root@localhost elasticsearch-5.2.2]# ./bin/elasticsearch
    //部分错误如下
    [2017-03-15T22:16:22,913][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]
    org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
    

    报错明确指出,不能以root用户启动
    这种情况下,需要先改变目录的用户权限,然后再以普通用户启动

    [root@localhost local]# chown -R hncl elasticsearch-5.2.2
    [root@localhost local]# su - hncl
    [hncl@localhost elasticsearch-5.2.2]$ ./bin/elasticsearch
    

    这是启动时,还会遇到一些的报错,可以看这篇博客解决

    启动后,在浏览器输入http://localhost:9200/?pretty检查ES是否启动成功

    启动成功的状态
    {
      "name" : "blbBlAJ",   //node名称
      "cluster_name" : "elasticsearch",  //集群名称(默认的集群名称就是elasticsearch)
      "cluster_uuid" : "87jfbfUXSJyZjjy6I6NZnA",
      "version" : {  
        "number" : "5.2.2",  //es版本号
        "build_hash" : "f9d9b74",
        "build_date" : "2017-02-24T17:26:45.835Z",
        "build_snapshot" : false,
        "lucene_version" : "6.4.1"
      },
      "tagline" : "You Know, for Search"
    }
    

    如果要修改集群的名称的话,可以修改config/elasticsearch.yml这个文件

    学习阶段我们可以用kibana来操作elasticsearch,它作为我们学习es知识点的一个主要的界面入口

    kibana下载地址

    解压缩,并启动kibana

    [root@localhost local]# tar -zxvf kibana-5.2.2-linux-x86_64.tar.gz 
    [root@localhost kibana-5.2.2-linux-x86_64]# ./bin/kibana
    

    在浏览器输入: http://localhost:5601,然后点击“Dev Tools"

    2($M9HK$0PB94IBIS}$2C5Y.png

    然后输入:"GET _cluster/health"


    图示

    至此,初步安装与体验完成

    相关文章

      网友评论

      本文标题:在linux上安装与启动Elasticsearch

      本文链接:https://www.haomeiwen.com/subject/olvrnttx.html