1. 程式人生 > >elasticsearch6.5.0安裝搭建以及kibana,cerebro,head,beat

elasticsearch6.5.0安裝搭建以及kibana,cerebro,head,beat

首先,安裝java環境,java8以上版本。

echo $JAVA_HOME
/home/admin/java/jdk1.8.0_131
es安裝不能使用root使用者啟動,所以要新建一個使用者,賦予使用者安裝目錄許可權
然後去官網下載es最新版本,我這裡用的是es6.2.3和es6.5.0,其中6.5.0是最新的穩定版。
解壓安裝後,進入配置檔案目錄,修改配置檔案。
cd elasticsearch-6.5.0/config/
vi jvm.options
![](http://doc.ailinux.net/uploads/es/images/m_983b9e9eb763a549d157765213dbb9e6_r.png)
修改記憶體為小於你伺服器記憶體,比如如果你伺服器的記憶體是8G,那麼這邊可以配置為-Xms3g
接下來我們就可以正式去修改es的配置了
vi elasticsearch.yml
這邊先配置叢集名,節點名,資料目錄存放路徑(此處需要新建es資料資料夾和日誌資料夾,然後在配置檔案中指定出來,資料資料夾裡存放的是es的索引資料,如果做資料遷移,小版本之間可以直接拷貝資料資料夾中的indices資料夾完成遷移)
cluster.name: sxy
node.name: 6
node.master: true
node.data: true
path.data: /home/admin/dddd/es_data/data
path.logs: /home/admin/dddd/es_data/logs

設定為true來鎖住記憶體

bootstrap.memory_lock: true
    設定任意地址連線
network.host: 0.0.0.0
    http訪問埠
http.port: 9200
    tcp訪問埠
transport.tcp.port: 9300
http.cors.enabled: true
http.cors.allow-credentials: true
http.cors.allow-methods: OPTIONS, HEAD, GET, POST, PUT, DELETE
http.cors.allow-origin: "*"
http.cors.allow-headers: X-Requested-With, X-Auth-Token, Content-Type, Content-Length, Authorization

叢集配置

    我這邊設內網ip192.168.0.6為主節點,es的配置一共分為主節點,資料節點,協調節點和攝取節點。節點配置請參考官網:https://www.elastic.co/guide/en/elasticsearch/reference/6.2/modules-node.html
discovery.zen.ping.unicast.hosts: ["192.168.0.6"]
discovery.zen.minimum_master_nodes: 1
gateway.recover_after_nodes: 3
path.repo: ["/home/admin/dddd/es_data/backup"]
discovery.zen.ping_timeout: 300s
discovery.zen.fd.ping_timeout: 300s
discovery.zen.fd.ping_interval: 300s
discovery.zen.fd.ping_retries: 6

叢集索引快取配置

indices.memory.index_buffer_size: 30%
indices.recovery.max_bytes_per_sec: 30gb
indices.breaker.fielddata.limit: 65%
indices.breaker.request.limit: 45%
indices.breaker.total.limit: 75%
http.max_content_length: 100mb
transport.tcp.compress: true
indices.fielddata.cache.size: 50mb

叢集執行緒池配置

thread_pool.index.queue_size: 1600
thread_pool.index.size: 9
thread_pool.search.size: 64
thread_pool.get.size: 32
thread_pool.get.queue_size: 1600
thread_pool.bulk.size: 9
thread_pool.bulk.queue_size: 1600

在es6.2中需要用外掛命令去安裝xpach做安全認證,而在es6.5中xpack已經變為內部模組,所以直接配置就好了,因為xpach可以做許可權控制,所以建議把它配置上。
es6.2配置方式為:cd elasticsearch-6.5.0/bin/x-pack
./certgen     然後生成ca.zip作為公鑰 ,依次輸入所有伺服器的命令和內網ip來作為私鑰方便叢集之間通訊。
es6.5的配置方式為:cd elasticsearch-6.5.0/bin/
./elasticsearch-certgen     和es6.2一樣的方式生成各臺伺服器公鑰和私鑰,不一樣的是,es6.5必須將各個伺服器註冊內網域名,然後在詢問dns name的時候輸入內網域名(外網域名也可以,只是網速不如內網通訊快),不然程式碼tcp連線會報錯
在所有金鑰生成好後,將ca.zip資料夾分別拷貝至各個節點的config資料夾內,新建資料夾為x-pack_ssl (命名隨意),然後將ca.zip檔案移動進去,解壓,然後在es配置檔案裡開啟xpack配置,如下:
xpack.security.enabled: true
xpack.ssl.key: x-pack_ssl/es6/es6.key
xpack.ssl.certificate: x-pack_ssl/es6/es6.crt
xpack.ssl.certificate_authorities: x-pack_ssl/ca/ca.crt
xpack.security.transport.ssl.enabled: true

開啟嗅探,叢集通訊使用

xpack.security.audit.index.client.transport.sniff: true

然後就可以啟動es叢集了,cd elasticsearch-6.5.0/bin , sh elasticsearch
根據啟動報錯來判斷還有哪些配置沒有更改
可參考連結:https://blog.csdn.net/ntc10095/article/details/73650794
最後,用nginx代理,訪問域名:
   {
  "name" : "6",
  "cluster_name" : "sxy",
  "cluster_uuid" : "UV3fkxf2T7WH8r_bjUKrig",
  "version" : {
    "number" : "6.5.0",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "816e6f6",
    "build_date" : "2018-11-09T18:58:36.352602Z",
    "build_snapshot" : false,
    "lucene_version" : "7.5.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

整個叢集便搭建完成

後續會更新es6.5的各個外掛安裝,以及分詞器破解,包括head,cerebro,kibana,beat等等,這邊先提供一些參考圖片

文件更新時間: 2018-11-22 10:30 作者:星語 聯絡方式:QQ 2445067568

elasticsearch6.5.0安裝搭建以及kibana,cerebro,head,beat
elasticsearch6.5.0安裝搭建以及kibana,cerebro,head,beat
elasticsearch6.5.0安裝搭建以及kibana,cerebro,head,beat
elasticsearch6.5.0安裝搭建以及kibana,cerebro,head,beat