CentOS 7上安装Elasticsearch

微魔 / 来源

Elasticsearch可能不少朋友都会比较陌生,但是提到Sphinx,不少童鞋可能就比较熟悉了,和Sphinx一样,Elasticsearch也是作为搜索引擎的存在(简介见下文),最近微魔在学django建立一个数据库系统,需要用到搜索功能,于是就挑选了django+haystack+Elasticsearch作为整体的框架,今天先介绍Elasticsearch的安装好了,后面如果有时间再把其他部分补上。

来自百度百科:

ElasticSearch是一个基于Lucene的搜索服务器。它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口。Elasticsearch是用Java开发的,并作为Apache许可条款下的开放源码发布,是当前流行的企业级搜索引擎。设计用于云计算中,能够达到实时搜索,稳定,可靠,快速,安装使用方便。

CentOS 7上安装Elasticsearch

1.安装Java Runtime Environment(JRE)

yum install java-1.8.0-openjdk.x86_64
java -version

2.下载&安装Elasticsearch(rpm方式)

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.2.2.rpm

强烈推荐到官网查找最新的稳定版本,另外,官方也提供了源安装的方式。

rpm -ivh elasticsearch-5.2.2.rpm
warning: elasticsearch-5.2.2.rpm: Header V4 RSA/SHA512 Signature, key ID d88e42b4: NOKEY
Preparing...                          ################################# [100%]
Creating elasticsearch group... OK
Creating elasticsearch user... OK
Updating / installing...
   1:elasticsearch-0:5.2.2-1          ################################# [100%]
### NOT starting on installation, please execute the following statements to configure elasticsearch service to start automatically using systemd
 sudo systemctl daemon-reload
 sudo systemctl enable elasticsearch.service
### You can start elasticsearch service by executing
 sudo systemctl start elasticsearch.service

3.运行Elasticsearch

systemctl start elasticsearch

4.创建启动

systemctl enable elasticsearch

5.测试Elasticsearch

curl http://127.0.0.1:9200/

若返回如下字段则表示安装成功

{
  "name" : "2o9bVcF",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "SXArlRvbQoymTg7g-SrzKg",
  "version" : {
    "number" : "5.2.2",
    "build_hash" : "f9d9b74",
    "build_date" : "2017-02-24T17:26:45.835Z",
    "build_snapshot" : false,
    "lucene_version" : "6.4.1"
  },
  "tagline" : "You Know, for Search"
}

The post #跑偏教程# CentOS 7上安装Elasticsearch appeared first on 微魔部落.

Tags: , , , , , Categorised in: This post was written by PopVPS

Comments are closed here.