CentOS6.9安装ElasticSearch

本篇笔记记录了CentOS6.9下安装ElasticSearch的过程

安装jdk1.8

yum install java-1.8.0-openjdk

添加elasticsearch用户和组

groupadd elasticsearch
useradd -g elasticsearch elasticsearch

创建目录

mkdir -p /usr/local
cd /usr/local

下载ElasticSearch

wget -c https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.6.0.tar.gz

解压

tar -zxvf elasticsearch-6.6.0.tar.gz

设置权限

chown -R elasticsearch:elasticsearch elasticsearch-6.6.0

进入elasticsearch-6.6.0/bin目录

cd elasticsearch-6.6.0/bin

切换用户

su elasticsearch

启动elasticsearch

./elasticsearch

打开新的终端curl测试

curl 127.0.0.1:9200
{
  "name" : "ihfrmHG",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "ZaeOC9IoTviJVT6m-bkWkg",
  "version" : {
    "number" : "6.6.0",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "a9861f4",
    "build_date" : "2019-01-24T11:27:09.439740Z",
    "build_snapshot" : false,
    "lucene_version" : "7.6.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

后台启动方式

elasticsearch -d
#或
elasticsearch &