国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

目錄
Elasticsearch單機雙節(jié)點叢集部署
首頁 php教程 php手冊 如何理解Elasticsearch單機雙節(jié)點集群部署

如何理解Elasticsearch單機雙節(jié)點集群部署

Sep 14, 2018 pm 04:03 PM
es

? ?這篇文章,我們還是做些基礎的學習,在Elasticsearch如何進行CRUD。

Elasticsearch單機雙節(jié)點叢集部署

環(huán)境:CentOS?7.2???????JDK?1.8.0_74


#一、安裝第一個ElasticSearch(主節(jié)點)

#1、創(chuàng)建es用戶,啟動es不能使用root用戶

useradd es
passwd es

root用戶進入/home/es目錄下

2、取得ElasticSearch安裝套件

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

3、解壓縮、改名(方便叢集時區(qū)別另一個ES)

tar xf elasticsearch-6.1.2.tar.gzmv elasticsearch-6.1.2.tar.gz elasticsearch-node2

4、修改設定檔

vi elasticsearch-node2/config/elasticsearch.yml

修改內容如下:

cluster.name: my-application      
  各節(jié)點此名稱必須一致node.name: node-2           
        節(jié)點名稱,不能與其他節(jié)點相同        
         network.host: ***.***.***.***   
        自己的服務器IPhttp.port: ****         
           訪問端口transport.tcp.port: ****  
    集群各節(jié)點間的通訊端口 discovery.zen.ping.unicast.hosts: ["主節(jié)點IP:通訊端口","輔節(jié)點IP:通訊端口"]

檔案最後追加以下內容,以便連接head顯示健康值(注意每行程式碼前面不要有空格)

http.cors.enabled: truehttp.cors.allow-origin: "*"

5、啟動

sh elasticsearch-node2/bin/elasticsearch
[2018-01-24T15:36:41,990][INFO ][o.e.n.Node               ] [KMyyO-3] started
[2018-01-24T15:36:41,997][INFO ][o.e.g.GatewayService     ] [KMyyO-3] recovered [0] indices into cluster_state

啟動成功,瀏覽器中輸入IP:存取連接埠

網頁顯示以下內容,說明部署成功

{
  "name" : "node-2",
  "cluster_name" : "my-application",
  "cluster_uuid" : "j2aJ7CsRSuSo0G8Bgky2Ww",    
  "version" : {
    "number" : "6.1.2",
    "build_hash" : "5b1fea5",
    "build_date" : "2018-01-10T02:35:59.208Z",
    "build_snapshot" : false,
    "lucene_version" : "7.1.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"}

6、報錯及其處理
【類型一】

Caused by: java.lang.RuntimeException: can not run elasticsearch as root

該問題是因為執(zhí)行es不能使用root用戶,因此要切換es用戶再次啟動

chown -R es:es elasticsearch-node2/su - es
sh elasticsearch-node2/bin/elasticsearch

【類型二】

max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

解決方法,換回root用戶,修改設定檔

vi /etc/security/limits.conf#在最后面追加下面內容es hard nofile 65536es soft nofile 65536

【類型三】

max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

解決方法,換回root用戶,修改設定檔

vi /etc/sysctl.conf 
#在最后面追加下面內容vm.max_map_count=655360#執(zhí)行命令:sysctl -p

#二、安裝第二個ElasticSearch(子節(jié)點)
安裝方法與第一個一致,注意修改設定檔
root用戶進入/home/es目錄下

1、解壓縮、改名

tar xf elasticsearch-6.1.2.tar.gzmv elasticsearch-6.1.2.tar.gz elasticsearch-node3

2、修改設定檔

vi elasticsearch-node3/config/elasticsearch.yml

修改內容如下:

cluster.name: my-application      
  各節(jié)點此名稱必須一致node.name: node-3      
               節(jié)點名稱,不能與其他節(jié)點相同network.host: ***.***.***.***   
                   自己的服務器IPhttp.port: ****          
                              訪問端口(注意不要與第一個端口重復)                              transport.tcp.port: ****            集群各節(jié)點間的通訊端口(注意不要與第一個端口重復)discovery.zen.ping.unicast.hosts: ["主節(jié)點IP:通訊端口","輔節(jié)點IP:通訊端口"]

檔案最後同樣追加下面程式碼

http.cors.enabled: truehttp.cors.allow-origin: "*"

3.啟動

sh elasticsearch-node3/bin/elasticsearch

瀏覽器,瀏覽器中輸入? IP:存取連接埠
網頁顯示以下內容,說明第二個部署成功

{
  "name" : "node-3",
  "cluster_name" : "my-application",
  "cluster_uuid" : "j2aJ7CsRSuSo0G8Bgky2Ww",
  "version" : {
    "number" : "6.1.2",
    "build_hash" : "5b1fea5",
    "build_date" : "2018-01-10T02:35:59.208Z",
    "build_snapshot" : false,
    "lucene_version" : "7.1.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"}

三、安裝Elasticsearch-head外掛程式
1、安裝head外掛程式之前需要安裝node.js

curl -sL https://rpm.nodesource.com/setup_8.x | bash -
yum install -y nodejs

安裝完成後執(zhí)行指令查看node與npm版本

[root@host]# node -vv8.12.0[root@host]# npm -v6.4.1

2、從git取得head外掛

wget https://github.com/mobz/elasticsearch-head/archive/master.zip

3、解壓縮安裝套件(可以改名,方便操作)

unzip master.zip
mv elasticsearch-head-master/ head

4、修改設定檔

vi head/Gruntfile.js

更改head連接埠號碼

connect: {          server: {
                   options: {
                              port: ****,    改為head訪問端口
                              base: '.',
                              keepalive: true                             }
                    }
          }
vi head/_site/app.js

更改head連結位址

init: function(parent) {
                        this._super();                        this.prefs = services.Preferences.instance();                        this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://主節(jié)點IP:訪問端口";

5、啟動head

nohup npm run start > ../head.log 2>&1 &

6.瀏覽器登入head
如何理解Elasticsearch單機雙節(jié)點集群部署

URL輸入伺服器IP:head訪問連接埠
連結位址輸如主節(jié)點的存取位址
7、安裝head常見錯誤
【類型一】啟動成功,但網頁不能存取
解決方法
關閉伺服器防火牆

service iptables stop

【類型二】叢集健康值未連線
在elasticsearch.yml裡追加下列程式碼(注意程式碼前面不要有空格)

http.cors.enabled: truehttp.cors.allow-origin: "*"

問:為什麼es節(jié)點用node2、node3?
回答:因為之前用node1搭建了一套未集群的ES,所以後面集群就用2和3了

相關推薦:

Yii2-elasticsearch?怎麼用???

Elasticsearch中的CRUD


#

以上是如何理解Elasticsearch單機雙節(jié)點集群部署的詳細內容。更多資訊請關注PHP中文網其他相關文章!

本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發(fā)現(xiàn)涉嫌抄襲或侵權的內容,請聯(lián)絡admin@php.cn

熱AI工具

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創(chuàng)建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發(fā)環(huán)境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發(fā)工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)