Linux-CentOS6.9安装Elasticsearch

Linux-CentOS6.9安装Elasticsearch

sudo -s
安装java

手动下载 jdk-8u181-linux-x64.tar.gz
官网下载地址 https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

解压到 /usr/local/java/jdk1.8

tar zxvf jdk-8u181-linux-x64.tar.gz
mv jdk1.8.0_181/* /usr/local/java/jdk1.8

设置环境变量

vi /etc/profile
export JAVA_HOME=/usr/local/java/jdk1.8
export PATH=$PATH:$JAVA_HOME/bin

使环境变量设置立即生效

source /etc/profile

查看版本

java -version
java version "1.8.0_181"
安装elasticsearch

下载elasticsearch-6.4.0.tar.gz
wget 或手动下载
官网下载 https://www.elastic.co/cn/downloads/elasticsearch
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.4.0.tar.gz

解压到/usr/local/elasticsearch

tar zxvf elasticsearch-6.4.0.tar.gz
mv elasticsearch-6.4.0/* /usr/local/elasticsearch

由于ES默认不能使用root用户运行,创建elastic用户组和elastic用户

/usr/sbin/groupadd elastic
/usr/sbin/useradd -g elastic elastic

更改elasticsearch文件夹所属用户及组

chown -R elastic:elastic /usr/local/elasticsearch

切换至elastic用户,并启动ES

su elastic
cd /usr/local/elasticsearch/
./bin/elasticsearch
./bin/elasticsearch -d # 后台运行

检查是否启动成功

curl 127.0.0.1:9200
{
  "name" : "P4WB0lQ",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "kZl1ZE1oT0Gqq433Y8qJoQ",
  "version" : {
    "number" : "6.4.0",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "595516e",
    "build_date" : "2018-08-17T23:18:47.308994Z",
    "build_snapshot" : false,
    "lucene_version" : "7.4.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

http://www.ruanyifeng.com/blog/2017/08/elasticsearch.html
https://www.elastic.co/guide/en/elasticsearch/reference/current/zip-targz.html
https://blog.csdn.net/showhilllee/article/details/53404042

©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页