Skip to content

Commit

Permalink
[ADD] Elasticsearch Coordinate Node และการเชื่อม Kibana เข้ากับ Multi…
Browse files Browse the repository at this point in the history
…ple Elastic
  • Loading branch information
wdrdres3qew5ts21 committed May 30, 2020
1 parent eba49dc commit 1177105
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
9 changes: 7 additions & 2 deletions docker-compose-elastic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ services:
- http.cors.enabled=true
- http.cors.allow-origin=*
- network.host=_eth0_
# ด้วยสาม parameter นี้จะทำให้ Elasticsearch Node นี้เป็นแค่ Coordinate ใช้ประสานคำสั่งเฉยๆ
# จะไม่มีการเก้บข้อมูลใดๆที่ตัวมันดังนั้น Volume จึงไม่ทำงานและห้ามใช้ด้วยนั่นเอง ถ้าใช้ก็จะบึ้มเพราะเป็น Coordinate Node
- node.master=false
- node.data=false
- node.ingest=false
# หลังติดตั้งเสร็จแล้วต้องรันคำสั่ง bin/elasticsearch-setup-passwords interactive
# เพื่อให้ xpack module ที่ลงไว้ทำการตั้ง password ตามที่เราตั้งด้วยนั่นเอง
# ถ้าใช้ xpack บน cluster mode จะโดน bootstrap สั่งให้ทำ TLS ด้วยทันทีไม่งั้นจะ bootstrap ไม่ผ่าน
Expand All @@ -87,8 +92,8 @@ services:
memlock:
soft: -1
hard: -1
volumes:
- data03:/usr/share/elasticsearch/data
# volumes:
# - data03:/usr/share/elasticsearch/data
networks:
- elastic

Expand Down
7 changes: 7 additions & 0 deletions kibana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
# ถ้าไม่ระบุ host จะเข้าไม่ได้ถึงแม้ default จะระบุเป็น localhost ก็ตาม
server.host: 0.0.0.0
# hostname ที่อยู่ของ elasticsearch
# สังเกตดูว่าเรามี Cluster Elasticsearch ก็จริงแต่จะเกิดอะไรขึ้นถ้า Kibana ที่ต้องอยุ่ซึ่ง ต้องบังคับ fix url
# เอาไว้ว่าต่อไป ES ตัวไหน ? แล้วตัวนั้นล่มมา Kibana ก็จะพังล่ะ วิธีแก้คือยัด host url ไปหลายๆตัว แต่สุดท้ายมันก็เจ๊งอยู่ดี
# เพราะถ้า list ใน url นี้มันพังหมด 3 ตัว แต่ยังเหลืออีกตัวนึงซึ่งพึ่งเพิ่มมาใหม่จะทำยังไง ? เพราะจริงๆยังมีตัวใหม่แต่ต่อไปไม่ได้
# เพราะใน config ไมไ่ด้มี URL ของตัวใหม่ ดังนั้นวิธีแก้คือเอา Load Balancer มาครอบ ES ไว้ให้เป้น Group Domain เดียว
# แทนที่จะเป็น ชื่อ Container ซึ่งการแก้ก็คือนำ Kubernetes มาสร้าง Network Overlay ไว้นั่นเอง !!! เพราะ K8s จะรวม
# Pods หลายๆตัวให้เป้น Service และใช้ URL Domain นั้นแทนได้ !!!
# elasticsearch.hosts: [ "http://elasticsearch1:9200"]
elasticsearch.hosts: [ "http://elasticsearch1:9200","http://elasticsearch2:9200" ,"http://elasticsearch3:9200" ]
# user ต้องเป้น user ชื่อ kibana เท่านั้นเพราะเงื่อนไขการติดต่อคือ
# user ต้องตรงกับ app เช่น apm ต้องใช้ apm ไม่งั้นจะเข้าไมไ่ด้ !!!
Expand Down

0 comments on commit 1177105

Please sign in to comment.