在CentOS上安装ElasticSearch

安装Java

由于需要Java,需要安装它。

yum -y install java-1.8.0-openjdk-devel.x86_64

添加yum仓库

rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch
vim /etc/yum.repos.d/elasticsearch.repo
[elasticsearch-2.x]
name=Elasticsearch repository for 2.x packages
baseurl=http://packages.elastic.co/elasticsearch/2.x/centos
gpgcheck=1
gpgkey=http://packages.elastic.co/GPG-KEY-elasticsearch
enabled=1

安装

yum install elasticsearch

启动

/etc/init.d/elasticsearch start

确认

curl localhost:9200
[root@b1d204be4849 /]# curl localhost:9200
{
  "name" : "Kilmer",
  "cluster_name" : "elasticsearch",
  "version" : {
    "number" : "2.2.0",
    "build_hash" : "8ff36d139e16f8720f2947ef62c8167a888992fe",
    "build_timestamp" : "2016-01-27T13:32:39Z",
    "build_snapshot" : false,
    "lucene_version" : "5.4.1"
  },
  "tagline" : "You Know, for Search"
}

安装kuromoji

/usr/share/elasticsearch/bin/plugin install analysis-kuromoji

您能确认一下是否已安装?

curl -X GET localhost:9200/_nodes/plugins?pretty
{
  "cluster_name" : "elasticsearch",
  "nodes" : {
    "ZbA9wH8NSaKORP0o-mR1Pg" : {
      "name" : "Kilmer",
      "transport_address" : "127.0.0.1:9300",
      "host" : "127.0.0.1",
      "ip" : "127.0.0.1",
      "version" : "2.2.0",
      "build" : "8ff36d1",
      "http_address" : "127.0.0.1:9200",
      "plugins" : [ {
        "name" : "analysis-kuromoji",
        "version" : "2.2.0",
        "description" : "The Japanese (kuromoji) Analysis plugin integrates Lucene kuromoji analysis module into elasticsearch.",
        "jvm" : true,
        "classname" : "org.elasticsearch.plugin.analysis.kuromoji.AnalysisKuromojiPlugin",
        "isolated" : true,
        "site" : false
      } ],
      "modules" : [ {
        "name" : "lang-expression",
        "version" : "2.2.0",
        "description" : "Lucene expressions integration for Elasticsearch",
        "jvm" : true,
        "classname" : "org.elasticsearch.script.expression.ExpressionPlugin",
        "isolated" : true,
        "site" : false
      }, {
        "name" : "lang-groovy",
        "version" : "2.2.0",
        "description" : "Groovy scripting integration for Elasticsearch",
        "jvm" : true,
        "classname" : "org.elasticsearch.script.groovy.GroovyPlugin",
        "isolated" : true,
        "site" : false
      } ]
    }
  }
}

以备忘之用

请参考以下资料

– Please refer to the following materials.
– 请查阅以下资料。
– 请参考下列参考资料。
– 请参考下述资料。

在CentOS上使用yum安装Elasticsearch。

bannerAds