阿轉的blog


  • 首頁

  • 歸檔

  • 標籤

kibana發生Courier Fetch: n of m shards failed警告

發表於 2019-06-19

查看Elasticsearch的logs並沒有噴錯誤或警告
單純就在kibana查詢時,上頭會出現黃色警告 Courier Fetch: 5 of 25 shard failed

Google一下,大部分的解法都是調整elasticsearch.yml的設定
這邊是透過docker-compose啟動服務的,所以直接修改yml的內容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
version: '2.2'
services:
elasticsearch:
build:
context: ./elasticsearch
restart: always
container_name: elasticsearch
environment:
- cluster.name=elk-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms1536m -Xmx1536m"
- http.cors.enabled=true
- http.cors.allow-origin=*
# 參考google解法,加上下列這段設定
- thread_pool.search.queue_size=10000
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- esdata1:/usr/share/elasticsearch/data
ports:
- 9200:9200
networks:
- esnet

但是!加了好像沒用,還是持續跳出這個錯誤阿…

後來改用Dev Tools,將Discover的Request內容重新POST一次
發現,原來是某一個index有問題,導致該index的shard出錯了

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"_shards": {
"total": 25,
"successful": 20,
"skipped": 0,
// 明顯跟你說有shard失敗
"failed": 5,
"failures": [
{
"shard": 0,
// 就是下面這個index出錯了
"index": "index-%{published_month}",
"node": "Tj7AFdTbTvO05iVumSWvLw",
"reason": {
"type": "illegal_argument_exception",
"reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [published] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead."
}
}
]
}

透過下列語法將這個有問題的index砍掉後,就沒問題了

1
DELETE index-%25{published_month}/

Docker使用筆記

發表於 2019-06-17

本篇包含 docker-compose的用法

安裝docker

安裝docker-compose

build image(編譯)

指定image的tag

將images推到registry

1
$ docker push your.registry.com/image_name:image_version

如果是推送到私有的registry,可能會出現以下問題

Logstash使用筆記

發表於 2017-09-20

下載mssql jdbc driver
https://docs.microsoft.com/en-us/sql/connect/jdbc/using-the-jdbc-driver

logstash for jdbc plugin
https://github.com/logstash-plugins/logstash-input-jdbc

如果執行後,只出現一筆資料,則有可能是被覆蓋了,檢查index中_id是否都長的一樣

可以透過mutate plugin
過濾html tag, 更改欄位名稱,合併或增加欄位

使用分頁的時候,查詢語法不能包含order by的條件

clean_run => true
每次都會清空last_run的計數器

last_run_value 會是查詢結果的最後一筆資料,所以以時間排序的話,就需要使用遞增排序,才能取到最近的時間

多個設定檔時,input會獨立存在,filter、output則會合併共用

參考教學
http://www.codingmecha.com/tag/logstash/

logstash設定檔也可以寫判斷式?
logstash if/else表达式
http://vinc.top/2016/07/15/logstash-ifelse%E8%A1%A8%E8%BE%BE%E5%BC%8F/

簡體中文教學
https://kibana.logstash.es/content/logstash/get-start/hello-world.html

logstash for jdbc doc
https://www.elastic.co/guide/en/logstash/current/plugins-inputs-jdbc.html#plugins-inputs-jdbc-record_last_run

mutate使用方法
https://www.elastic.co/guide/en/logstash/current/plugins-filters-mutate.html#plugins-filters-mutate-rename

logstash config example
https://www.elastic.co/guide/en/logstash/current/config-examples.html

列出logstash plugins
https://www.elastic.co/guide/en/logstash/current/working-with-plugins.html

設定檔
output加入以下,則會在consolo出現相關訊息
output{
stdout {
codec => rubydebug
}
}

logstash in unix 資料夾定義
https://www.elastic.co/guide/en/logstash/current/dir-layout.html

output加入document_id,數值可以利用%{}方式指定為查詢結果的欄位,例如%{id}

在ubuntu利用mono執行C#程式

發表於 2017-08-24

不需要微軟的環境就可以編譯與執行C#,真的蠻方便的
mac(osx)也可以,但還沒實際試過
mono在ubuntu安裝步驟挺簡單的,可以參考底下的Ref.

閱讀全文 »

Xdebug搭配Visual Studio Code使用方法與設定

發表於 2017-07-26

方便的在vc code透過xdebug進行php的偵錯

閱讀全文 »

npm用法

發表於 2017-04-24

有關npm各種用法

閱讀全文 »

使用mitmproxy快速建立並透過proxy監控http封包

發表於 2017-04-19

想要查看iphone app的各種網路封包、連線的網址
只要是http Request就可以透過mitmproxy獲得相關資訊
https也可以,只需額外在iphone安裝mitmproxy憑證

閱讀全文 »

透過ngrok讓外網可以瀏覽本機服務

發表於 2017-04-19

Ubuntu 14.04安裝ffmpeg

發表於 2017-04-13

Ubuntu 14.04 版本已經不支援ffmpeg,由Libav取代
想要安裝的話,需要手動執行一些步驟

閱讀全文 »

利用ffmpeg合併m3u8串流影片,並且轉成MP4格式

發表於 2017-04-13

嘗試使用ffmpeg指令,下載m3u8來源的串流影片
Ubuntu 14.04 ffmpeg version git-2017-01-22
ffmpeg 安裝方式

利用ffmpeg下載串流影片的使用方法

1
ffmpeg -i "m3u8網址" -c copy media.mp4

透過-i指令,下載串流影片,網址最好用雙引號標示
-c copy 告知影音編碼用複製就好,不需要再次轉碼
filename.mp4 使用mp4副檔名,直接告知存成mp4格式

沒有ffmpeg的話,還有其他下載方法

閱讀全文 »
12
Shime Hsu

Shime Hsu

18 文章
5 標籤
© 2019 Shime Hsu
由 Hexo 強力驅動
主題 - NexT.Muse