iT邦幫忙

第 12 屆 iThome 鐵人賽

DAY 8
0
Elastic Stack on Cloud

親愛的,我把ElasticSearch上雲了系列 第 8

Day 8 Elasticsearch基本設定及查詢(續)

Day 8 Elasticsearch基本設定及查詢(續)


前言及未來規劃

今天稍微提一下之後的規劃,從今天到Day10左右,會繼續介紹基本的Elasticsearch的設定及查詢,而關於Kibana以及一些Elasticsearch的query實務操作,可以參考我的隊友的文章

而我這邊會繼續講述的是比較系統上的建構,以及實務上這些資安資訓(各式各樣log),從蒐集到維護;另外就是在ElasticCloud上的操作

昨天我們簡單介紹了如何應用ElasticCloud上面的Console去進行API的查詢,今天我們繼續介紹有哪些基本查詢;除此之外,關於基本設定這邊也會在前頭先帶到一下。


Elasticsearch的功能窗格

首先昨天我們先回到ElasticCloud的左邊功能窗格,Elasticsearch中,包含Logs、Snapshots以及API console;昨天我們講過API console是可以讓我們在網頁介面上去操作elasticsearch的API。

今天我們來簡單介紹一下剩下兩個:

Logs

Logs顧名思義,其實就是Elasticcloud會自動蒐集elasticsearch服務中,所接受到的log訊息,舉例來說,如果你對elasticsearch去做request,log這邊就會有訊息;除了request以外,建立snapshot或是RAM超載等等,都會有LOG被建立起來。

log有主要幾個欄位:時間(Timestamp、Level、instance/Zone、Message)
其中時間就是這個log紀錄的時間點;Level則是訊息的重要程度(Info、Warn、Error)
基本上Info可以想像成是Routine回傳的Log、Warn及Error則分別是告警以及錯誤噴出來的,告警不代表會直接造成影響,但可能往後造成影響(例如RAM不足的Warn,當下可能不會怎樣,但再有其他request就可能會爆開來);Error則是某個程序發生問題了,報錯了,這個基本上就會變成拿來Debug的重要關鍵。

Snapshots

Snapshots就是快造,也就是會定期備份,當如果發生一些狀況,就可以還原到之前時間點,也算是確保資料的完整性及安全性。

ElasticCloud中只要有設定Snapshots功能,他就會定期去做快造,並且你可以在這個功能窗格中去還原,或是立即進行快造的服務。

每一個快造就會如下圖,若沒有特別設定,基本上是半小時會進行一次快造

當然快造時間會基於你的大小,越大的話會需要花越多的時間


Elasticsearch基本查詢(續)

昨天講了_cat的API,今天我們再繼續介紹還有哪些查詢的API,首先是cluster相關的。

Cluster API

Cluster API主要是為了查詢cluster中的node(忘記
node是什麼可以複習一下:Node介紹)。
而查詢nodes有以下幾種方式:
1.直接選取全部
(若沒下參數,預設是全部)

# If no filters are given, the default is to select all nodes
GET /_nodes
# Explicitly select all nodes
GET /_nodes/_all

2.只選取local的node

# Select just the local node
GET /_nodes/_local

3.選取可投票的node

# Select the elected master node
GET /_nodes/_master

4.透過node的名字

# Select nodes by name, which can include wildcards
GET /_nodes/node_name_goes_here
GET /_nodes/node_name_goes_*

5.透過IP

# Select nodes by address, which can include wildcards
GET /_nodes/10.0.0.3,10.0.0.4
GET /_nodes/10.0.0.*

6.透過node角色(多重選擇)

# Select nodes by role
GET /_nodes/_all,master:false
GET /_nodes/data:true,ingest:true
GET /_nodes/coordinating_only:true
GET /_nodes/master:true,voting_only:false

7.透過node的其他屬性名稱

# Select nodes by custom attribute (e.g. with something like `node.attr.rack: 2` in the configuration file)
GET /_nodes/rack:2
GET /_nodes/ra*:2
GET /_nodes/ra*:2*

上一篇
Day 7 Elasticsearch基本設定及查詢
下一篇
Day 9 Elasticsearch API 查詢(Monitor)
系列文
親愛的,我把ElasticSearch上雲了30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言