elasticsearch6.2.2安裝

安裝環境:cendos7.2html

角色分配:本次安裝節點爲3個(不一樣機器),採用下圖左側方案node

 

1.安裝jdk1.8linux

參考:vim

http://www.cnblogs.com/libin2015/p/8086047.html瀏覽器

2.添加elasticsearch用戶並修改密碼安全

useradd elasticsearch
passwd elasticsearch

3.增長sudo免密碼cors

vim /etc/sudoers

添加以下內容:

elasticsearch   ALL=(ALL)       NOPASSWD: ALL

4.獲取elasticsearch安裝包,解壓,進入目錄curl

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.2.tar.gz
tar zxvf elasticsearch-6.2.2.tar.gz 
cd elasticsearch-6.2.2/

 

5.修改elasticsearch.yml配置文件jvm

vim config/elasticsearch.yml
修改以下配置項:
節點1:
cluster.name: es2018  #機器名稱
node.name: node01    #節點名稱
path.data: /var/lib/elasticsearch    #數據路徑
path.logs: /home/elasticsearch/elasticsearch-6.2.2/logs    #日誌路徑
network.host: 0.0.0.0  #服務ip
http.port: 9200      #端口
discovery.zen.ping.unicast.hosts: ["172.30.154.74", "172.30.154.78"]  #單播請求主機列表
http.cors.enabled: true    #用了HTTP端口,容許REST請求
http.cors.allow-origin: "*"  #指定容許請求的範圍
node.master: true  #容許選舉master節點
node.data: false    #不存儲數據
#node.ingest: false

(## cendos6.8 安裝es5.6.4不須要此項配置)
action.auto_create_index: .security,.monitoring*,.watches,.triggered_watches,.watcher-history*,.ml*  #x-pack使用,容許自動建立的索引名稱

節點2:
cluster.name: es2018
node.name: node02
path.data: /var/lib/elasticsearch
path.logs: /home/elasticsearch/elasticsearch-6.2.2/logs
network.host: 0.0.0.0
http.port: 9200
discovery.zen.ping.unicast.hosts: ["172.30.154.74", "172.30.154.78"]
http.cors.enabled: true
http.cors.allow-origin: "*"
node.master: true  #容許選舉master節點
node.data: true    #存儲數據
#node.ingest: false
action.auto_create_index: .security,.monitoring*,.watches,.triggered_watches,.watcher-history*,.ml*

節點3:
cluster.name: es2018
node.name: node03
path.data: /var/lib/elasticsearch
path.logs: /home/elasticsearch/elasticsearch-6.2.2/logs
network.host: 0.0.0.0
http.port: 9200
discovery.zen.ping.unicast.hosts: ["172.30.154.74", "172.30.154.78"]
http.cors.enabled: true
http.cors.allow-origin: "*"
node.master: false  #不容許選舉master節點
node.data: true    #存儲數據
#node.ingest: false
action.auto_create_index: .security,.monitoring*,.watches,.triggered_watches,.watcher-history*,.ml*

 6.修改jvm.options配置文件elasticsearch

vim config/jvm.options
內存調整爲31G(根據主機狀況調整)
-Xms31g
-Xmx31g

7.修改linux系統配置

vim /etc/security/limits.conf
添加如下內容: # NS_PER_INSTALL
* soft nofile 65536 * hard nofile 65536 * soft nproc 131072 * hard nproc 131072 vim /etc/sysctl.conf
添加如下內容: vm.max_map_count
=262144

#cendos6.8須要修改下面內容
vim /etc/security/limits.d/90-nproc.conf
修改成2048

  #* soft nproc 1024
  * soft nproc 2048

 

8.重複上述步驟,安裝其餘兩節點。安裝步驟相同,配置elasticsearch.yml稍有不一樣,參考第5步便可。

9.啓動各節點

./bin/elasticsearch
#後臺啓動 #.
/bin/elasticsearch -d -p pid #中止節點 #kill `cat pid`

10.驗證

curl http://172.30.154.74:9200/

{
"name" : "node01", "cluster_name" : "es2018", "cluster_uuid" : "Gk3P3i0YQyOiDLqdAWdCOA", "version" : { "number" : "6.2.2", "build_hash" : "10b1edd", "build_date" : "2018-02-16T19:01:30.685723Z", "build_snapshot" : false, "lucene_version" : "7.2.1", "minimum_wire_compatibility_version" : "5.6.0", "minimum_index_compatibility_version" : "5.0.0" }, "tagline" : "You Know, for Search" }

curl http://172.30.154.74:9200/_cat/nodes
172.30.154.79  6 70 1 0.33 0.20 0.16 di  - node03
172.30.154.78  4 73 0 0.33 0.35 0.41 mdi * node02
172.30.154.74 18 95 0 0.36 0.29 0.25 mi  - node01

#安裝成功,主節點暫爲node02

 

11.安裝x-pack(可選)

X-Pack是一個Elastic Stack的擴展,將安全,警報,監視,報告和圖形功能包含在一個易於安裝的軟件包中


在線安裝: .
/bin/elasticsearch-plugin install x-pack 離線安裝: wget https://artifacts.elastic.co/downloads/packs/x-pack/x-pack-6.2.2.zip ./bin/elasticsearch-plugin install file:///path/to/file/x-pack-6.2.2.zip #注意路徑
#每一個節點都須要安裝!!!
#安裝是必須停掉elasticsearch進程,不然可能安裝不成功!
 

12.修改elastic、kibana、logstash等用戶密碼

./bin/x-pack/setup-passwords interactive
按提示輸入密碼便可

#默認用戶名密碼爲:
#用戶名:elastic
#密碼:changeme

13.啓動elaticsearch,驗證

打開瀏覽器,輸入 http://172.30.154.74:9200/,提示輸入密碼,則x-pack安裝成功

 

 參考資料:

http://blog.csdn.net/laoyang360/article/details/78290484

https://www.elastic.co/guide/en/elasticsearch/reference/6.2/install-elasticsearch.html

https://www.elastic.co/guide/en/elasticsearch/reference/6.2/installing-xpack-es.html

相關文章
相關標籤/搜索