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"
}

 

 

 

 

     

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章