ES(elasticsearch)环境搭建之单实例安装

注:选择elasticsearch要与之spring-data-elasticsearch的版本相对应

elasticsearch

spring data elasticsearch

6.2.2 3.1.x
5.5.0 3.0.x
2.4.0 2.1.x
2.2.0 2.0.x
1.5.2 1.3.x

系统环境

  • Linux Centos 7.X
  • JDK 1.8

ES安装步骤

   1.下载elasticsearch

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

 

   2.解压并移动到 /usr/local 目录下

tar -zxvf elasticsearch-5.5.2.tar.gz
mv elasticsearch-5.5.2 /usr/local/elasticsearch

 

3.修改 config 目录下的 elasticsearch.yml 文件

//进入config目录
cd /usr/local/elasticsearch/config

//修改elasticsearch.yml
vi elasticsearch.yml

//在elasticsearch.yml文件末尾追加
cluster.name: timoker
network.host: 0.0.0.0
http.port: 9200
transport.tcp.port: 9300
transport.host: 0.0.0.0

 

4.修改config目录下的jvm.options 文件

//服务器内存大的可忽略此步 5.X版本默认2G
//找到-Xms2G -Xmx2G 修改为
-Xms256m
-Xmx256m

//在末尾追加
-XX:+AssumeMP

 

5.修改/etc/security/limits.conf 文件

//在末尾追加

* soft nofile 65536
* hard nofile 65536

* soft nproc 4096
* hard nproc 4096

 

6.修改 /etc/sysctl.conf 文件,修改完成后,执行命令「 sysctl -p 」使之生效

vm.max_map_count=262144

 

7.ES的版本为5.X以后,不能用root用户启动,因此新建 ES 用户

//新建用户组 elasticsearch

groupadd elasticsearch

//新建用户并指定用户组
useradd -g elasticsearch elasticsearch

//修改 ES 目录所属者
chown -R elasticsearch:elasticsearch elasticsearch

//切换es用户启动
su elasticsearch

 

8.启动ES

 //进入elasticsearch目录
cd /usr/local/elasticsearch

//启动elasticsearch
./bin/elasticsearch -d

 

9.测试  浏览器输入 服务器公网IP:9200端口,返回一下结果则安装成功

{
  "name" : "oUGFiNw",
  "cluster_name" : "timoker",
  "cluster_uuid" : "pjItbQboSny6pAoV7H1y4A",
  "version" : {
    "number" : "5.5.2",
    "build_hash" : "b2f0c09",
    "build_date" : "2017-08-14T12:33:14.154Z",
    "build_snapshot" : false,
    "lucene_version" : "6.6.0"
  },
  "tagline" : "You Know, for Search"
}

 

 

 

 

     

你可能感兴趣的:(elasticsearch)