在CentOS上使用yum安装Elasticsearch

只需按照此链接中所述的步骤进行操作即可。

1. 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

2. 安装

# yum install elasticsearch

3. 启动

# /etc/init.d/elasticsearch start

Starting elasticsearch:                                    [  OK  ]

4. 自动启动设置

# chkconfig --add elasticsearch

5. 更改设置

設定文件位於 /etc/elasticsearch/elasticsearch.yml。
本次設定為本地的Vagrant IP,端口則維持不變。

 # network.host: 192.168.0.1
+network.host: 192.168.33.10
# /etc/init.d/elasticsearch restart

请访问 http://192.168.33.10:9200/ 进行确认。

$ curl 'http://192.168.33.10:9200/'
{
  "name" : "Obituary",
  "cluster_name" : "elasticsearch",
  "version" : {
    "number" : "2.1.1",
    "build_hash" : "40e2c53a6b6c2972b3d13846e450e66f4375bd71",
    "build_timestamp" : "2015-12-15T13:05:55Z",
    "build_snapshot" : false,
    "lucene_version" : "5.3.1"
  },
  "tagline" : "You Know, for Search"
}

6. 安装 kuromoji

执行日语(kuromoji)分析插件中所写的内容。

$ cd /usr/share/elasticsearch
$ sudo bin/plugin install analysis-kuromoji

确认是否已安装

$ curl -X GET 'http://192.168.33.10:9200/_nodes/plugins?pretty'

{
  "cluster_name" : "elasticsearch",
  "nodes" : {
    "t3aQ5-NMTmGUno7vqRYVgg" : {
      "name" : "Aleksander Lukin",
      "transport_address" : "192.168.33.10:9300",
      "host" : "192.168.33.10",
      "ip" : "192.168.33.10",
      "version" : "2.1.1",
      "build" : "40e2c53",
      "http_address" : "192.168.33.10:9200",
      "plugins" : [ {
        "name" : "analysis-kuromoji",
        "version" : "2.1.1",
        "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
      } ]
    }
  }
}

其他

数据和日志默认会放在下面的位置。

路径.主页=/usr/share/elasticsearch
默认.路径.日志=/var/log/elasticsearch
默认.路径.数据=/var/lib/elasticsearch
默认.路径.配置=/etc/elasticsearch

广告
将在 10 秒后关闭
bannerAds