1. 程式人生 > >centos6.8 安裝elasticsearch6.5叢集

centos6.8 安裝elasticsearch6.5叢集

安裝es6.5

文章目錄

1、官網下載Linux rpm包

2、安裝:rpm -ivh *.rpm

3、配置

vim /ect/elasticsearch/elasticsearch.yml
cluster.name: master-node
node.name: master
node.master: true
node.data: false
network.host: 0.0.0.0
http.port: 9200
path.data: /data/es/data
path.logs: /data/es/log
bootstrap.system_call_filter: false  #這一行若不寫會報bootstrap checks failed

從節點修改node.name node.maste

node.name: data-node1
node.master: false
node.data: true

4、建立jdk軟連結,不讓找不到javahome

ln -s /usr/local/jdk1.8.0_73/bin/java /usr/bin

5、新增檔案及許可權給elastic search

chown -R elasticsearch:elasticsearch /data

6、系統引數配置

(1)配置limits.conf,再底部新增下面內容:

vi /etc/security/limits.conf 

* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096

(2)配置90-nproc.conf

vi /etc/security/limits.d/90-nproc.conf
* soft nproc 1024
1

修改為

* soft nproc 4096

(3)配置sysctl.conf,在底部新增如下內容

vi /etc/sysctl.conf
vm.max_map_count=655360

(4)執行sysctl -p

7、啟動

首先在主節點上啟動,其次到子節點上啟動

sudo service elasticsearch start

啟動後會出現兩個埠:9300埠是叢集通訊用的,9200則是資料傳輸時用的。

8、檢視叢集狀態

curl -XGET 'http://mini2:9200/_cluster/health?pretty'
{
  "cluster_name" : "bigdata",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 3,
  "number_of_data_nodes" : 2,
  "active_primary_shards" : 0,
  "active_shards" : 0,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 100.0
}

檢視叢集詳細資訊

curl 'mini2:9200/_cluster/state?pretty'