中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

EFK教程(3) - ElasticSearch多實例部署

發布時間:2020-07-25 01:04:58 來源:網絡 閱讀:636 作者:小慢哥 欄目:系統運維

EFK教程(3) - ElasticSearch多實例部署

基于ElasticSearch多實例架構,實現資源合理分配、冷熱數據分離

作者:“發顛的小狼”,歡迎轉載與投稿


目錄

? 用途
? 架構
? 192.168.1.51 elasticsearch-data部署雙實例
? 192.168.1.52 elasticsearch-data部署雙實例
? 192.168.1.53 elasticsearch-data部署雙實例
? 測試


用途

前情提要:

? 在第一篇《EFK教程 - 快速入門指南》中,闡述了EFK的安裝部署,其中ES的架構為三節點,即master、ingest、data角色同時部署在三臺服務器上。
? 在第二篇《EFK教程 - ElasticSearch高性能高可用架構》中,闡述了EFK的data/ingest/master角色的用途及分別部署三節點,在實現性能最大化的同時保障高可用

前兩篇文章,ES集群中只存在一個實例,而在本文中,將在一個集群中部署多個ES實例,來實現資源合理分配。例如data服務器存在SSD與SAS硬盤,可以將熱數據存放到SSD,而冷數據存放到SAS,實現數據冷熱分離。

在本文中,將為data服務器創建2個實例,分別基于SSD和基于SAS硬盤,將nginx的9月份索引放在SAS盤上,其它的全放在SSD盤上


架構

架構圖

EFK教程(3) - ElasticSearch多實例部署

服務器配置

EFK教程(3) - ElasticSearch多實例部署


192.168.1.51 elasticsearch-data部署雙實例

索引遷移(此步不能忽略):將192.168.1.51上的索引放到其它2臺data節點上

curl -X PUT "192.168.1.31:9200/*/_settings?pretty" -H 'Content-Type: application/json' -d'
{
  "index.routing.allocation.include._ip": "192.168.1.52,192.168.1.53"
}'

確認當前索引存儲位置:確認所有索引不在192.168.1.51節點上

curl "http://192.168.1.31:9200/_cat/shards?h=n"

EFK教程(3) - ElasticSearch多實例部署

停掉192.168.1.51的進程,修改目錄結構及配置:請自行按SSD和SAS硬盤掛載好數據盤

EFK教程(3) - ElasticSearch多實例部署

# 安裝包下載和部署請參考第一篇《EFK教程 - 快速入門指南》
cd /opt/software/
tar -zxvf elasticsearch-7.3.2-linux-x86_64.tar.gz
mv /opt/elasticsearch /opt/elasticsearch-SAS
mv elasticsearch-7.3.2 /opt/
mv /opt/elasticsearch-7.3.2 /opt/elasticsearch-SSD
chown elasticsearch.elasticsearch /opt/elasticsearch-* -R
rm -rf /data/SAS/*
chown elasticsearch.elasticsearch /data/* -R
mkdir -p /opt/logs/elasticsearch-SAS
mkdir -p /opt/logs/elasticsearch-SSD
chown elasticsearch.elasticsearch /opt/logs/* -R

SAS實例/opt/elasticsearch-SAS/config/elasticsearch.yml配置

cluster.name: my-application
node.name: 192.168.1.51-SAS
path.data: /data/SAS
path.logs: /opt/logs/elasticsearch-SAS
network.host: 192.168.1.51

http.port: 9200
transport.port: 9300
# discovery.seed_hosts和cluster.initial_master_nodes 一定要帶上端口號,不然會走http.port和transport.port端口
discovery.seed_hosts: ["192.168.1.31:9300","192.168.1.32:9300","192.168.1.33:9300"]
cluster.initial_master_nodes: ["192.168.1.31:9300","192.168.1.32:9300","192.168.1.33:9300"]
http.cors.enabled: true
http.cors.allow-origin: "*"

node.master: false
node.ingest: false
node.data: true

# 本機只允行啟2個實例
node.max_local_storage_nodes: 2

SSD實例/opt/elasticsearch-SSD/config/elasticsearch.yml配置

cluster.name: my-application
node.name: 192.168.1.51-SSD
path.data: /data/SSD
path.logs: /opt/logs/elasticsearch-SSD
network.host: 192.168.1.51

http.port: 9201
transport.port: 9301
# discovery.seed_hosts和cluster.initial_master_nodes 一定要帶上端口號,不然會走http.port和transport.port端口
discovery.seed_hosts: ["192.168.1.31:9300","192.168.1.32:9300","192.168.1.33:9300"]
cluster.initial_master_nodes: ["192.168.1.31:9300","192.168.1.32:9300","192.168.1.33:9300"]
http.cors.enabled: true
http.cors.allow-origin: "*"

node.master: false
node.ingest: false
node.data: true

# 本機只允行啟2個實例
node.max_local_storage_nodes: 2

SAS實例和SSD實例啟動方式

sudo -u elasticsearch /opt/elasticsearch-SAS/bin/elasticsearch
sudo -u elasticsearch /opt/elasticsearch-SSD/bin/elasticsearch

確認SAS和SSD已啟2實例

curl "http://192.168.1.31:9200/_cat/nodes?v"

EFK教程(3) - ElasticSearch多實例部署


192.168.1.52 elasticsearch-data部署雙實例

索引遷移(此步不能忽略):將192.168.1.52上的索引放到其它2臺data節點上

curl -X PUT "192.168.1.31:9200/*/_settings?pretty" -H 'Content-Type: application/json' -d'
{
  "index.routing.allocation.include._ip": "192.168.1.51,192.168.1.53"
}'

確認當前索引存儲位置: 確認所有索引不在192.168.1.52節點上

curl "http://192.168.1.31:9200/_cat/shards?h=n"

EFK教程(3) - ElasticSearch多實例部署

EFK教程(3) - ElasticSearch多實例部署

停掉192.168.1.52的進程,修改目錄結構及配置:請自行按SSD和SAS硬盤掛載好數據盤

EFK教程(3) - ElasticSearch多實例部署

# 安裝包下載和部署請參考第一篇《EFK教程 - 快速入門指南》
cd /opt/software/
tar -zxvf elasticsearch-7.3.2-linux-x86_64.tar.gz
mv /opt/elasticsearch /opt/elasticsearch-SAS
mv elasticsearch-7.3.2 /opt/
mv /opt/elasticsearch-7.3.2 /opt/elasticsearch-SSD
chown elasticsearch.elasticsearch /opt/elasticsearch-* -R
rm -rf /data/SAS/*
chown elasticsearch.elasticsearch /data/* -R
mkdir -p /opt/logs/elasticsearch-SAS
mkdir -p /opt/logs/elasticsearch-SSD
chown elasticsearch.elasticsearch /opt/logs/* -R

SAS實例/opt/elasticsearch-SAS/config/elasticsearch.yml配置

cluster.name: my-application
node.name: 192.168.1.52-SAS
path.data: /data/SAS
path.logs: /opt/logs/elasticsearch-SAS
network.host: 192.168.1.52

http.port: 9200
transport.port: 9300
# discovery.seed_hosts和cluster.initial_master_nodes 一定要帶上端口號,不然會走http.port和transport.port端口
discovery.seed_hosts: ["192.168.1.31:9300","192.168.1.32:9300","192.168.1.33:9300"]
cluster.initial_master_nodes: ["192.168.1.31:9300","192.168.1.32:9300","192.168.1.33:9300"]
http.cors.enabled: true
http.cors.allow-origin: "*"

node.master: false
node.ingest: false
node.data: true

# 本機只允行啟2個實例
node.max_local_storage_nodes: 2

SSD實例/opt/elasticsearch-SSD/config/elasticsearch.yml配置

cluster.name: my-application
node.name: 192.168.1.52-SSD
path.data: /data/SSD
path.logs: /opt/logs/elasticsearch-SSD
network.host: 192.168.1.52

http.port: 9201
transport.port: 9301
# discovery.seed_hosts和cluster.initial_master_nodes 一定要帶上端口號,不然會走http.port和transport.port端口
discovery.seed_hosts: ["192.168.1.31:9300","192.168.1.32:9300","192.168.1.33:9300"]
cluster.initial_master_nodes: ["192.168.1.31:9300","192.168.1.32:9300","192.168.1.33:9300"]
http.cors.enabled: true
http.cors.allow-origin: "*"

node.master: false
node.ingest: false
node.data: true

# 本機只允行啟2個實例
node.max_local_storage_nodes: 2

SAS實例和SSD實例啟動方式

sudo -u elasticsearch /opt/elasticsearch-SAS/bin/elasticsearch
sudo -u elasticsearch /opt/elasticsearch-SSD/bin/elasticsearch

確認SAS和SSD已啟2實例

curl "http://192.168.1.31:9200/_cat/nodes?v"

EFK教程(3) - ElasticSearch多實例部署


192.168.1.53 elasticsearch-data部署雙實例

索引遷移(此步不能忽略):一定要做這步,將192.168.1.53上的索引放到其它2臺data節點上

curl -X PUT "192.168.1.31:9200/*/_settings?pretty" -H 'Content-Type: application/json' -d'
{
  "index.routing.allocation.include._ip": "192.168.1.51,192.168.1.52"
}'

確認當前索引存儲位置:確認所有索引不在192.168.1.52節點上

curl "http://192.168.1.31:9200/_cat/shards?h=n"

EFK教程(3) - ElasticSearch多實例部署

EFK教程(3) - ElasticSearch多實例部署

停掉192.168.1.53的進程,修改目錄結構及配置:請自行按SSD和SAS硬盤掛載好數據盤

EFK教程(3) - ElasticSearch多實例部署

# 安裝包下載和部署請參考第一篇《EFK教程 - 快速入門指南》
cd /opt/software/
tar -zxvf elasticsearch-7.3.2-linux-x86_64.tar.gz
mv /opt/elasticsearch /opt/elasticsearch-SAS
mv elasticsearch-7.3.2 /opt/
mv /opt/elasticsearch-7.3.2 /opt/elasticsearch-SSD
chown elasticsearch.elasticsearch /opt/elasticsearch-* -R
rm -rf /data/SAS/*
chown elasticsearch.elasticsearch /data/* -R
mkdir -p /opt/logs/elasticsearch-SAS
mkdir -p /opt/logs/elasticsearch-SSD
chown elasticsearch.elasticsearch /opt/logs/* -R

SAS實例/opt/elasticsearch-SAS/config/elasticsearch.yml配置

cluster.name: my-application
node.name: 192.168.1.53-SAS
path.data: /data/SAS
path.logs: /opt/logs/elasticsearch-SAS
network.host: 192.168.1.53

http.port: 9200
transport.port: 9300
# discovery.seed_hosts和cluster.initial_master_nodes 一定要帶上端口號,不然會走http.port和transport.port端口
discovery.seed_hosts: ["192.168.1.31:9300","192.168.1.32:9300","192.168.1.33:9300"]
cluster.initial_master_nodes: ["192.168.1.31:9300","192.168.1.32:9300","192.168.1.33:9300"]
http.cors.enabled: true
http.cors.allow-origin: "*"

node.master: false
node.ingest: false
node.data: true

# 本機只允行啟2個實例
node.max_local_storage_nodes: 2

SSD實例/opt/elasticsearch-SSD/config/elasticsearch.yml配置

cluster.name: my-application
node.name: 192.168.1.53-SSD
path.data: /data/SSD
path.logs: /opt/logs/elasticsearch-SSD
network.host: 192.168.1.53

http.port: 9201
transport.port: 9301
# discovery.seed_hosts和cluster.initial_master_nodes 一定要帶上端口號,不然會走http.port和transport.port端口
discovery.seed_hosts: ["192.168.1.31:9300","192.168.1.32:9300","192.168.1.33:9300"]
cluster.initial_master_nodes: ["192.168.1.31:9300","192.168.1.32:9300","192.168.1.33:9300"]
http.cors.enabled: true
http.cors.allow-origin: "*"

node.master: false
node.ingest: false
node.data: true

# 本機只允行啟2個實例
node.max_local_storage_nodes: 2

SAS實例和SSD實例啟動方式

sudo -u elasticsearch /opt/elasticsearch-SAS/bin/elasticsearch
sudo -u elasticsearch /opt/elasticsearch-SSD/bin/elasticsearch

確認SAS和SSD已啟2實例

curl "http://192.168.1.31:9200/_cat/nodes?v"

EFK教程(3) - ElasticSearch多實例部署


測試

將所有索引移到SSD硬盤上

# 下面的參數會在后面的文章講解,此處照抄即可
curl -X PUT "192.168.1.31:9200/*/_settings?pretty" -H 'Content-Type: application/json' -d'
{
  "index.routing.allocation.include._host_ip": "",
  "index.routing.allocation.include._host": "",
  "index.routing.allocation.include._name": "",
  "index.routing.allocation.include._ip": "",
  "index.routing.allocation.require._name": "*-SSD"
}'

確認所有索引全在SSD硬盤上

curl "http://192.168.1.31:9200/_cat/shards?h=n"

EFK教程(3) - ElasticSearch多實例部署

將nginx9月份的日志索引遷移到SAS硬盤上

curl -X PUT "192.168.1.31:9200/nginx_*_2019.09/_settings?pretty" -H 'Content-Type: application/json' -d'
{
  "index.routing.allocation.require._name": "*-SAS"
}'

確認nginx9月份的日志索引遷移到SAS硬盤上

curl "http://192.168.1.31:9200/_cat/shards"

EFK教程(3) - ElasticSearch多實例部署

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

湄潭县| 寻乌县| 湖州市| 磐安县| 乐东| 洛宁县| 曲周县| 岳池县| 大城县| 江永县| 南木林县| 全州县| 石泉县| 深州市| 闵行区| 连城县| 武平县| 滕州市| 义乌市| 锡林郭勒盟| 永吉县| 中阳县| 墨竹工卡县| 威信县| 蓝山县| 宁城县| 习水县| 樟树市| 高阳县| 威远县| 启东市| 南丹县| 会宁县| 平远县| 井陉县| 安福县| 南溪县| 叶城县| 张家口市| 封丘县| 湘阴县|