Elastic Search Config

jvm.options

  • ์ž๋ฐ” ๋ฉ”๋ชจ๋ฆฌ ์˜ต์…˜์€ ๋ฉ”๋ชจ๋ฆฌ ์šฉ๋Ÿ‰์ด ๋ณ€๊ฒฝ๋˜๋Š” ๋ถˆํ•„์š”ํ•œ ์˜ค๋ฒ„ํ—ค๋“œ๋ฅผ ๋ฐฉ์ง€ํ•˜๊ธฐ ์œ„ํ•ด
    • ์ตœ์†Œ ๋ฉ”๋ชจ๋ฆฌ์™€ ์ตœ๋Œ€ ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ๋™์ผํ•˜๊ฒŒ ์ง€์ •ํ•ด์„œ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์„ ๊ถŒ์žฅ
  • ์ž๋ฐ” Heap Memory Error๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉด ์˜ค๋ฅ˜ ๋‚ด์šฉ์„ heapdump.hprof์™€ ๊ฐ™์€ ํŒŒ์ผ์— ์ €์žฅ
    • Default HeapDump Path : Home
    • ์ˆ˜๋ฐฑMB ~ ์ˆ˜GB ์ •๋„๋กœ ์šฉ๋Ÿ‰์ด ํฌ๋ฏ€๋กœ ๋„‰๋„‰ํ•œ ์šฉ๋Ÿ‰์„ ๊ฐ€์ง„ ๋ณ„๋„์˜ ๊ฒฝ๋กœ์— ์ €์žฅํ•˜๋Š” ๊ฒƒ์„ ๊ถŒ์žฅ

elasticsearch.yml

  • cluster.name
    • Elastic Search Cluster : ๊ฐ ๋…ธ๋“œ๊ฐ€ ์—ฐ๊ฒฐ๋œ ์ „์ฒด ์‹œ์Šคํ…œ
  • node.name
    • ํ•˜๋‚˜์˜ Node : ์‹คํ–‰๋œ ํ•˜๋‚˜์˜ Elastic Search ํ”„๋กœ์„ธ์Šค
  • path.data
    • data/ ๋ฐ์ดํ„ฐ ํŒŒ์ผ ๊ฒฝ๋กœ
    • ,๋กœ ๊ตฌ๋ถ„ํ•ด์„œ ์—ฌ๋Ÿฌ ๊ฒฝ๋กœ๋ฅผ ์ง€์ •ํ•  ์ˆ˜ ์žˆ๋‹ค. ์ƒ‰์ธ ๋œ ๋ฐ์ดํ„ฐ๋ฅผ ์—ฌ๋Ÿฌ ๊ฐœ์˜ ๋“œ๋ผ์ด๋ธŒ์— ๋‚˜๋ˆ ์„œ ์ €์žฅ
  • path.logs
    • logs/ ๋กœ๊ทธ ํŒŒ์ผ ๊ฒฝ๋กœ
  • bootstrap.memory_lock
    • ElasticSearch๊ฐ€ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋Š” ๋ฉ”๋ชจ๋ฆฌ Lock
    • Swap์„ ๋ฐฉ์ง€ํ•  ์ˆ˜ ์žˆ๋‹ค.
    • ๋„ˆ๋ฌด ๋งŽ์€ ๋ฉ”๋ชจ๋ฆฌ๋ฅผ Elastic Search ํ• ๋‹นํ•˜์ง€ ์•Š๋„๋ก ์ ์ ˆํ•œ ์กฐ์ ˆ์ด ํ•„์š”.
    • ์ „์ฒด ๋ฉ”๋ชจ๋ฆฌ์˜ 50%๊ฐ€ ๋„˜์ง€ ์•Š๋„๋ก ํ•˜๋Š” ๊ฒƒ์ด ์•ˆ์ •์ 
  • network.host
    • ElasticSearch ๋‚ด๋ถ€/์™ธ๋ถ€ IP ์ฃผ์†Œ ๋ชจ๋‘ ๋ฐ˜์˜
  • http.port
    • Default Port : 9200
    • ElasticSearch Port : 9200~9299
    • ๋‹ค๋ฅธ Node์™€ Binding๋˜์–ด ๋ฐ์ดํ„ฐ ๊ตํ™˜์„ ์œ„ํ•ด ํ†ต์‹ ํ•˜๋Š” ํฌํŠธ : 9300~9399

Gateway

  • ElasticSearch์˜ ์ „์ฒด Cluster์˜ ์ƒํƒœ๋ฅผ ์ €์žฅํ•˜๋Š” ์ €์žฅ์†Œ
  • Recovery
    • ElasticSearch์˜ ์ „์ฒด Cluster๊ฐ€ ์ข…๋ฃŒ๋œ ํ›„ ์žฌ์‹คํ–‰ ๋  ๋•Œ Gateway์— ์ €์žฅ๋œ ์ƒํƒœ ๊ฐ’์„ ์ฝ์–ด ๋“ค์—ฌ ๋…ธ๋“œ์™€ ์ธ๋ฑ์Šค ๋“ฑ์— ๋Œ€ํ•ด ์ƒˆ๋กœ ์„ค์ •ํ•˜๋Š” ๊ณผ์ •
  • gateway.recover_after_nodes
    • ์ „์ฒด Cluster๊ฐ€ ์žฌ์‹œ์ž‘ ๋˜๊ณ  ๋ช‡ ๊ฐœ์˜ ๋…ธ๋“œ๊ฐ€ ํ™œ์„ฑํ™”๋์„๋•Œ ๋ฆฌ์ปค๋ฒ„๋ฆฌ๋ฅผ ์‹œ์ž‘ํ• ์ง€ ์„ค์ •ํ•œ๋‹ค.

Discovery

  • ์›๊ฒฉ ๋„คํŠธ์›Œํฌ์— ์žˆ๋Š” Node์™€์˜ Binding์„ ์„ค์ •ํ•˜๋Š” ๋ฐ ํ•„์š”ํ•˜๋‹ค.

Slow Log

  • Query, Fetch, Indexing ํ™œ๋™์— ๋Œ€ํ•ด Slow Log๋ฅผ ๋‚จ๊ธธ ์ˆ˜ ์žˆ๋‹ค.
  • index.search.slowlog.threshold.(query,fetch,index).(warn,info,error)
  • Example
    • index.search.slowlog.threshold.query.debug: 2s
    • Query๊ฐ€ 2์ดˆ ์ด์ƒ ์†Œ์š”๋˜์—ˆ์„๋•Œ Debug Level์˜ ๋กœ๊ทธ๋ฅผ ๊ธฐ๋กํ•œ๋‹ค.

cluster ์ •๋ณด ํ™•์ธ

curl -XGET http://localhost:9200/_cluster/stats\?pretty=true

log4j2.properties

  • ํด๋Ÿฌ์Šคํ„ฐ๋ช…๋ณ„๋กœ ์„ค์ •๋œ ๋กœ๊ทธ ํŒŒ์ผ์€ ๊ฐ™์€ ์„ค์น˜ ๋””๋ ‰ํ„ฐ๋ฆฌ์—์„œ ์„œ๋กœ ๋‹ค๋ฅธ ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ์‹คํ–‰ํ•ด๋„ ๋กœ๊ทธ ํŒŒ์ผ์ด ์„ž์ด์ง€ ์•Š๋„๋ก ๋ฐฉ์ง€ํ•˜๋Š” ๊ธฐ๋Šฅ์ด ์žˆ๋‹ค.

Reference