centos安装Elasticsearch

Posted maduar

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos安装Elasticsearch相关的知识,希望对你有一定的参考价值。

一、yum安装:

  1. 在/etc/yum.repos.d/目录创建文件elasticsearch.repo

  2. 添加以下内容

[elasticsearch-6.x]
name=Elasticsearch repository for 6.x packages
baseurl=https://artifacts.elastic.co/packages/6.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

  3. 执行yum命令:sudo yum install elasticsearch -y

  4. 设置开机启动:sudo chkconfig --add elasticsearch

  5. 启动:sudo -i service elasticsearch start

    -- 关闭 sudo -i service elasticsearch stop

    -- 重启 sudo -i service elasticsearch restart

二、测试项目是否运行

  -- curl -X GET ‘http://localhost:9200/?pretty‘  

  返回结果类似如下显示:

{
  "name" : "Cp8oag6",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "AT69_T_DTp-1qgIJlatQqA",
  "version" : {
    "number" : "6.4.3",
    "build_flavor" : "default",
    "build_type" : "zip",
    "build_hash" : "f27399d",
    "build_date" : "2016-03-30T09:51:41.449Z",
    "build_snapshot" : false,
    "lucene_version" : "7.4.0",
    "minimum_wire_compatibility_version" : "1.2.3",
    "minimum_index_compatibility_version" : "1.2.3"
  },
  "tagline" : "You Know, for Search"
} 

三、更改配置,增加远程访问

  -- 配置文件目录:/etc/elasticsearch/

  -- elasticsearch.yml文件增加如下属性:

    - network.host: 0.0.0.0

 

以上是关于centos安装Elasticsearch的主要内容,如果未能解决你的问题,请参考以下文章

elasticsearch代码片段,及工具类SearchEsUtil.java

Centos6.5安装Elasticsearch

centos6.8下安装elasticsearch

Centos7下安装Elasticsearch6步骤

centos安装Elasticsearch

CentOS下 elasticsearch集群安装