SlideShare a Scribd company logo
Elasticsearch
동기화 개선을 위한 고군분투기
Yool 한유리
Full Stack Programmer
SPOQA conference 2021 : Always Evolving!
SPOQA conference 2021 : Always Evolving!
풀스택 프로그래머
도도 포인트 1년 3개월
도도 카트 1년(~ing)
프로덕트 만드는 걸 좋아해요. 😋
SPOQA conference 2021 : Always Evolving!
목차
1. Elasticsearch 도입 계기
2. Elasticsearch?
3. logstash와 데이터 동기화 과정
4. 문제점
5. 해결 과정
- index template, logstash pipeline
- index alias, delete index
- curator, Kubernetes cronjob
6. 후기
SPOQA conference 2021 : Always Evolving!
Elasticsearch, 우리도 도입합시다! 🗣
AS-IS
각각 분리되어 있는 검색 폼
SPOQA conference 2021 : Always Evolving!
Elasticsearch, 우리도 도입합시다! 🗣
TO-BE
단 하나의 통합 검색 폼
SPOQA conference 2021 : Always Evolving!
Elasticsearch가 뭐죠? 👀
모든 유형의 데이터를 위한 검색 및 분석엔진
SPOQA conference 2021 : Always Evolving!
Elasticsearch가 뭐죠? 👀
애플리케이션 / 웹사이트 / 엔터프라이즈 검색
로깅과 로그 분석
인프라 메트릭과 컨테이너 모니터링
애플리케이션 성능 모니터링
비즈니스 분석
…
SPOQA conference 2021 : Always Evolving!
Elasticsearch가 뭐죠? 👀
1. 검색이 빠르다! (Inverted Index)
2. 검색에 용이하다! (가중치, tokenizer 등)
SPOQA conference 2021 : Always Evolving!
RDBMS vs Elasticsearch
RDBMS Elasticsearch
Database Index
Table Type
Row Document
SPOQA conference 2021 : Always Evolving!
Logstash는 이렇게 동작해요 ✨
input { … } — 집계
filter { … } — 변환
output { … } — 저장
SPOQA conference 2021 : Always Evolving!
Logstash 설정 🧐
참고: <Logstash와 JDBC를 사용해 Elasticsearch와 관계형 데이터베이스의 동기화를 유지하는 방법>
input {
jdbc {
…
schedule => "*/10 * * * * *"
statement => "SELECT id, category, name, standard, unit, created_at, extract(epoch FROM updated_at) AS unix_ts_in_secs FROM product
WHERE updated_at > to_timestamp(:sql_last_value) AND updated_at < now()
ORDER BY updated_at ASC”
use_column_value => true
tracking_column => "unix_ts_in_secs"
tracking_column_type => “numeric"
…
}
}
10초마다 마지막으로 트래킹 된 updated_at 이후 변경된 품목들을 집계
SPOQA conference 2021 : Always Evolving!
output {
elasticsearch {
cloud_id => '${ELASTICSEARCH_CLOUD_ID}'
cloud_auth => '${ELASTICSEARCH_CLOUD_USER_NAME}:${ELASTICSEARCH_CLOUD_PASSWORD}'
index => "cart_product"
document_id => "%{[@metadata][_id]}"
}
}
Logstash 설정 🧐
cart_product index에 데이터 저장
SPOQA conference 2021 : Always Evolving!
여기서 드는 의문 🤭
DB에서 delete된 row는 그럼 어떻게 동기화 되는 거지?
SPOQA conference 2021 : Always Evolving!
해결책 🤨
1. soft deletion (delete하지 않고 deleted_at 컬럼에 삭제 시간 기록하기)
2. row가 삭제될 때 elasticsearch에 삭제 요청 보내기
SPOQA conference 2021 : Always Evolving!
Soft Deletion?
실제로 삭제되어야 하는 데이터인데
비즈니스 로직이 복잡해지는 것을 수용할 것인가?
쌓이기만 하는 데이터 괜찮을까?
🙅
SPOQA conference 2021 : Always Evolving!
직접 요청하기?
과연 매번 Elasticsearch를 고려할 수 있을까?
어떠한 상황에서도 100% 동기화시킬 수 있을까?
🙅
SPOQA conference 2021 : Always Evolving!
Idea 💡
C님 🗣 “ 종종 동기화가 깨져서 인덱스를 새로 만들어서 다시 동기화해주어야 했어요.”
+
삭제된 데이터가 실시간으로 동기화되지 않아도 괜찮음
=
그럼 주기적으로 인덱스를 새로 만들자!
SPOQA conference 2021 : Always Evolving!
요구사항 📌
- 특정 주기마다 인덱스 새로 만들기
- 새로운 index를 통해 검색할 수 있도록 하기
- 이전에 만들어진 index 삭제하기 (저장공간 절약)
- 어떠한 과정에서도 검색은 항상 잘되도록 하기
SPOQA conference 2021 : Always Evolving!
행복회로 💗
- Elasticsearch REST API
- AWS lambda
- AWS CloudWatch Events
SPOQA conference 2021 : Always Evolving!
설계
인덱스 생성 동기화 인덱스
교체
이전 인덱스
삭제
SPOQA conference 2021 : Always Evolving!
문제
인덱스 생성 동기화 이전 인덱스
삭제
시점 불명확!
인덱스
교체
SPOQA conference 2021 : Always Evolving!
해결책
Index Template
새로운 logstash pipeline 추가
SPOQA conference 2021 : Always Evolving!
특정 주기마다 인덱스 새로 만들기
PUT _index_template/<템플릿 이름>
{
"index_patterns": ["cart_product*"],
"template": {
"mappings": {
"properties": {
"category": {
"type": "text",
"fields": {
"ngram": {
"type": "text",
"analyzer": "korean_ngram"
}
},
"analyzer": "korean"
}
}
…
인덱스 설정
인덱스 이름 패턴
SPOQA conference 2021 : Always Evolving!
input {
jdbc {
…
schedule => “0 3 * * * Asia/Seoul"
statement => "SELECT id, category, name, standard, unit, created_at, extract(epoch FROM updated_at) AS unix_ts_in_secs FROM product
ORDER BY updated_at ASC"
…
}
}
특정 주기마다 인덱스 새로 만들기
SPOQA conference 2021 : Always Evolving!
특정 주기마다 인덱스 새로 만들기
filter {
ruby {
init => "require 'time'"
code => "event.set('kstDate', Time.now.utc.getlocal('+09:00').strftime('%Y.%m.%d'))"
}
…
}
참고) %{+YYYY.MM.dd}를 이용해도 됨 (컨테이너 타임존을 따라감)
SPOQA conference 2021 : Always Evolving!
특정 주기마다 인덱스 새로 만들기
output {
…
elasticsearch {
index => "cart_product_%{kstDate}"
…
}
}
SPOQA conference 2021 : Always Evolving!
특정 주기마다 인덱스 새로 만들기
PUT /_security/role/<Role 이름>
{
"cluster": ["manage_index_templates", "monitor"],
"indices" : [
{
"names" : ["cart_product*"],
"privileges" : ["write","create", "delete", "create_index"]
}
]
}
SPOQA conference 2021 : Always Evolving!
설계 (1)
인덱스 생성
& 동기화
인덱스
이름 변경
이전 인덱스
삭제
SPOQA conference 2021 : Always Evolving!
문제 (1)
인덱스 생성
& 동기화
이전 인덱스
삭제
검색이 불가능!
기존 인덱스
이름 변경
cart_product
👇
cart_product_legacy
새로운 인덱스
이름 변경
cart_product_2021.02.01
👇
cart_product
SPOQA conference 2021 : Always Evolving!
해결책
Reindex
Clone
Index Alias
SPOQA conference 2021 : Always Evolving!
Index Alias
POST /_aliases
{
"actions" : [
{ "add" : { "index" : "cart_product_2021.02.14", "alias" : "cart_product" } },
{ "remove": {"index": “cart_product_2021.02.12.15", "alias" : "cart_product" } }
]
}
SPOQA conference 2021 : Always Evolving!
설계 (2)
인덱스 생성
& 동기화
인덱스 alias
수정
이전 인덱스
삭제
SPOQA conference 2021 : Always Evolving!
DELETE /<인덱스 이름>
Delete Index
SPOQA conference 2021 : Always Evolving!
설계 (2)
인덱스 생성
& 동기화
이전 인덱스
삭제
인덱스 alias
수정
SPOQA conference 2021 : Always Evolving!
발전 시키기
- index 관리
SPOQA conference 2021 : Always Evolving!
index 관리의 또 다른 방법
Curator
원하는 index (or snapshot)을 가져와 원하는 액션을 취할 수 있도록 함
yaml 파일로 어떠한 액션을 취할 것인지 선언
SPOQA conference 2021 : Always Evolving!
Curator 구성
- Action File
- Configuration File
SPOQA conference 2021 : Always Evolving!
Action File 구조
actions:
1:
action: ACTION1
description: OPTIONAL DESCRIPTION
options:
option1: value1
...
optionN: valueN
filters:
- filtertype: *first*
filter_element1: value1
...
filter_elementN: valueN
- filtertype: *second*
filter_element1: value1
...
filter_elementN: valueN
어떤 동작을 수행할 것인가
액션에 사용될 설정
어떤 인덱스를 대상으로 수행할 것인가
SPOQA conference 2021 : Always Evolving!
alias 업데이트
actions:
1:
action: alias
description: “…”
options:
name: cart_product
remove:
filters:
- filtertype: alias
aliases: cart_product
exclude: False
cart_product라는 alias를 가진 index로부터
cart_product alias를 제거
cart_product alias를 가진 index
SPOQA conference 2021 : Always Evolving!
alias 업데이트
remove:
…
add:
filters:
- filtertype: pattern
kind: prefix
value: cart_product_
- filtertype: count
count: 1
use_age: True
source: creation_date
reverse: True
exclude: False
cart_product_로 시작하는 index
가장 최근에 만들어진 index 1개
가장 마지막에 생성된 cart_proudct_로 시작하는
index에 cart_product alias 추가
SPOQA conference 2021 : Always Evolving!
2:
action: delete_indices
description: "…"
options:
timeout_override: 300
continue_if_exception: False
filters:
- filtertype: alias
aliases: cart_product
exclude: True
- filtertype: pattern
kind: prefix
value: cart_product_
index 삭제하기
cart_product alias를 가지지 않은 index
cart_product_로 시작하는 index
cart_product alias가 없으며 (=검색에 사용 중이지 않은)
cart_product_로 시작하는 인덱스 삭제
SPOQA conference 2021 : Always Evolving!
Curator 주기적으로 실행하기
Kubernetes Cronjob
참고: <Running Curator as a Kubernetes CronJob>
각자의 환경에서 가장 적절한 방법으로 실행
SPOQA conference 2021 : Always Evolving!
발전 시키기
- 조합하기
SPOQA conference 2021 : Always Evolving!
인덱스 생성
& 동기화
cart_product
pipeline
cart_product_yyyy.mm.dd
pipeline
스케쥴
새로운 인덱스
기존 인덱스
curator
SPOQA conference 2021 : Always Evolving!
매일 달라짐
curator
스케쥴
cart_product
pipeline
cart_product_yyyy.mm.dd
pipeline
SPOQA conference 2021 : Always Evolving!
새로운 인덱스
기존 인덱스
curator
스케쥴
cart_product
pipeline
cart_product_yyyy.mm.dd
pipeline
SPOQA conference 2021 : Always Evolving!
누락
curator
스케쥴
cart_product
pipeline
cart_product_yyyy.mm.dd
pipeline
SPOQA conference 2021 : Always Evolving!
curator
스케쥴
cart_product
pipeline
cart_product_yyyy.mm.dd
pipeline
새로운 인덱스
기존 인덱스
SPOQA conference 2021 : Always Evolving!
0.1% 모자람
하나의 인덱스에 동기화하는 파이프라인은 2개
curator
cart_product
pipeline
cart_product_yyyy.mm.dd
pipeline
SPOQA conference 2021 : Always Evolving!
input {
jdbc {
…
schedule => "*/5 3 * * * Asia/Seoul"
statement => "SELECT id, category, name, standard, unit, created_at, FROM product
WHERE now() - interval '1 hour' >= :sql_last_value
or (updated_at > :sql_last_value AND updated_at < now())
ORDER BY updated_at ASC”
use_column_value => false
…
}
}
logstash 수정
SPOQA conference 2021 : Always Evolving!
최종
3:00 3:45 4:00
curator
cart_product
pipeline
cart_product_yyyy.mm.dd
pipeline
SPOQA conference 2021 : Always Evolving!
요구사항 📌
- 특정 주기마다 인덱스 새로 만들기 ✅
- 새로운 index를 통해 검색할 수 있도록 하기 ✅
- 이전에 만들어진 index 삭제하기 ✅
- 어떠한 과정에서도 검색은 항상 잘되도록 하기 ✅ . o 0 (🤔)
SPOQA conference 2021 : Always Evolving!
후기
(너무 공들였나…)
SPOQA conference 2021 : Always Evolving!
같이 이야기해 봐요! ✨👀
비슷한 문제를 해결하기 위한 시도를 해보았다면
채팅창으로 공유해주세요!
[제3회 스포카콘] Elasticsearch 동기화 개선을 위한 고군분투기

More Related Content

What's hot

Redux and context api with react native app introduction, use cases, implemen...
Redux and context api with react native app introduction, use cases, implemen...Redux and context api with react native app introduction, use cases, implemen...
Redux and context api with react native app introduction, use cases, implemen...
Katy Slemon
 
React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)
Chiew Carol
 
Serverless Orchestration with Azure Durable Functions
Serverless Orchestration with Azure Durable FunctionsServerless Orchestration with Azure Durable Functions
Serverless Orchestration with Azure Durable Functions
Callon Campbell
 
Roman Iovlev. Comaqa Spring 2018. Архитектура Open Source решений для автомат...
Roman Iovlev. Comaqa Spring 2018. Архитектура Open Source решений для автомат...Roman Iovlev. Comaqa Spring 2018. Архитектура Open Source решений для автомат...
Roman Iovlev. Comaqa Spring 2018. Архитектура Open Source решений для автомат...
COMAQA.BY
 
AppSyncをReactで使ってみた
AppSyncをReactで使ってみたAppSyncをReactで使ってみた
AppSyncをReactで使ってみた
Takahiro Kobaru
 
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Codemotion
 
What's new in c# 8.0
What's new in c# 8.0What's new in c# 8.0
What's new in c# 8.0
Moaid Hathot
 
GraphQL over REST at Reactathon 2018
GraphQL over REST at Reactathon 2018GraphQL over REST at Reactathon 2018
GraphQL over REST at Reactathon 2018
Sashko Stubailo
 
Making Angular2 lean and Fast
Making Angular2 lean and FastMaking Angular2 lean and Fast
Making Angular2 lean and Fast
Vinci Rufus
 
James Baxley - Statically typing your GraphQL app
James Baxley - Statically typing your GraphQL appJames Baxley - Statically typing your GraphQL app
James Baxley - Statically typing your GraphQL app
React Conf Brasil
 
Corley cloud angular in cloud
Corley cloud   angular in cloudCorley cloud   angular in cloud
Corley cloud angular in cloud
Corley S.r.l.
 
Angular 2 - Core Concepts
Angular 2 - Core ConceptsAngular 2 - Core Concepts
Angular 2 - Core Concepts
Fabio Biondi
 
Taking Control of your Data with GraphQL
Taking Control of your Data with GraphQLTaking Control of your Data with GraphQL
Taking Control of your Data with GraphQL
Vinci Rufus
 
React: JSX and Top Level API
React: JSX and Top Level APIReact: JSX and Top Level API
React: JSX and Top Level API
Fabio Biondi
 
Introduction to Angular2
Introduction to Angular2Introduction to Angular2
Introduction to Angular2
Ivan Matiishyn
 
Creating applications with Grails, Angular JS and Spring Security - G3 Summit...
Creating applications with Grails, Angular JS and Spring Security - G3 Summit...Creating applications with Grails, Angular JS and Spring Security - G3 Summit...
Creating applications with Grails, Angular JS and Spring Security - G3 Summit...
Alvaro Sanchez-Mariscal
 
GraphQL across the stack: How everything fits together
GraphQL across the stack: How everything fits togetherGraphQL across the stack: How everything fits together
GraphQL across the stack: How everything fits together
Sashko Stubailo
 
PostGraphQL
PostGraphQLPostGraphQL
PostGraphQL
Daniel Büchele
 
Highload JavaScript Framework without Inheritance
Highload JavaScript Framework without InheritanceHighload JavaScript Framework without Inheritance
Highload JavaScript Framework without Inheritance
FDConf
 
Meteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern Apps
Meteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern AppsMeteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern Apps
Meteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern Apps
Sashko Stubailo
 

What's hot (20)

Redux and context api with react native app introduction, use cases, implemen...
Redux and context api with react native app introduction, use cases, implemen...Redux and context api with react native app introduction, use cases, implemen...
Redux and context api with react native app introduction, use cases, implemen...
 
React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)
 
Serverless Orchestration with Azure Durable Functions
Serverless Orchestration with Azure Durable FunctionsServerless Orchestration with Azure Durable Functions
Serverless Orchestration with Azure Durable Functions
 
Roman Iovlev. Comaqa Spring 2018. Архитектура Open Source решений для автомат...
Roman Iovlev. Comaqa Spring 2018. Архитектура Open Source решений для автомат...Roman Iovlev. Comaqa Spring 2018. Архитектура Open Source решений для автомат...
Roman Iovlev. Comaqa Spring 2018. Архитектура Open Source решений для автомат...
 
AppSyncをReactで使ってみた
AppSyncをReactで使ってみたAppSyncをReactで使ってみた
AppSyncをReactで使ってみた
 
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
 
What's new in c# 8.0
What's new in c# 8.0What's new in c# 8.0
What's new in c# 8.0
 
GraphQL over REST at Reactathon 2018
GraphQL over REST at Reactathon 2018GraphQL over REST at Reactathon 2018
GraphQL over REST at Reactathon 2018
 
Making Angular2 lean and Fast
Making Angular2 lean and FastMaking Angular2 lean and Fast
Making Angular2 lean and Fast
 
James Baxley - Statically typing your GraphQL app
James Baxley - Statically typing your GraphQL appJames Baxley - Statically typing your GraphQL app
James Baxley - Statically typing your GraphQL app
 
Corley cloud angular in cloud
Corley cloud   angular in cloudCorley cloud   angular in cloud
Corley cloud angular in cloud
 
Angular 2 - Core Concepts
Angular 2 - Core ConceptsAngular 2 - Core Concepts
Angular 2 - Core Concepts
 
Taking Control of your Data with GraphQL
Taking Control of your Data with GraphQLTaking Control of your Data with GraphQL
Taking Control of your Data with GraphQL
 
React: JSX and Top Level API
React: JSX and Top Level APIReact: JSX and Top Level API
React: JSX and Top Level API
 
Introduction to Angular2
Introduction to Angular2Introduction to Angular2
Introduction to Angular2
 
Creating applications with Grails, Angular JS and Spring Security - G3 Summit...
Creating applications with Grails, Angular JS and Spring Security - G3 Summit...Creating applications with Grails, Angular JS and Spring Security - G3 Summit...
Creating applications with Grails, Angular JS and Spring Security - G3 Summit...
 
GraphQL across the stack: How everything fits together
GraphQL across the stack: How everything fits togetherGraphQL across the stack: How everything fits together
GraphQL across the stack: How everything fits together
 
PostGraphQL
PostGraphQLPostGraphQL
PostGraphQL
 
Highload JavaScript Framework without Inheritance
Highload JavaScript Framework without InheritanceHighload JavaScript Framework without Inheritance
Highload JavaScript Framework without Inheritance
 
Meteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern Apps
Meteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern AppsMeteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern Apps
Meteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern Apps
 

Similar to [제3회 스포카콘] Elasticsearch 동기화 개선을 위한 고군분투기

WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
Fabio Franzini
 
From Backbone to Ember and Back(bone) Again
From Backbone to Ember and Back(bone) AgainFrom Backbone to Ember and Back(bone) Again
From Backbone to Ember and Back(bone) Again
jonknapp
 
SpringOne Platform recap 정윤진
SpringOne Platform recap 정윤진SpringOne Platform recap 정윤진
SpringOne Platform recap 정윤진
VMware Tanzu Korea
 
Scaling the Content Repository with Elasticsearch
Scaling the Content Repository with ElasticsearchScaling the Content Repository with Elasticsearch
Scaling the Content Repository with Elasticsearch
Nuxeo
 
AngularJS for Legacy Apps
AngularJS for Legacy AppsAngularJS for Legacy Apps
AngularJS for Legacy Apps
Peter Drinnan
 
Turku loves-storybook-styleguidist-styled-components
Turku loves-storybook-styleguidist-styled-componentsTurku loves-storybook-styleguidist-styled-components
Turku loves-storybook-styleguidist-styled-components
James Stone
 
Ako prepojiť aplikáciu s Elasticsearch
Ako prepojiť aplikáciu s ElasticsearchAko prepojiť aplikáciu s Elasticsearch
Ako prepojiť aplikáciu s Elasticsearch
bart-sk
 
Webpack Encore Symfony Live 2017 San Francisco
Webpack Encore Symfony Live 2017 San FranciscoWebpack Encore Symfony Live 2017 San Francisco
Webpack Encore Symfony Live 2017 San Francisco
Ryan Weaver
 
Mices 2018 cxp pavel_penchev_searchhub-searchcollector
Mices 2018 cxp pavel_penchev_searchhub-searchcollectorMices 2018 cxp pavel_penchev_searchhub-searchcollector
Mices 2018 cxp pavel_penchev_searchhub-searchcollector
CXP Commerce Experts GmbH
 
Remixing Confluence With Speakeasy
Remixing Confluence With SpeakeasyRemixing Confluence With Speakeasy
Remixing Confluence With Speakeasy
nabeelahali
 
Write once, ship multiple times
Write once, ship multiple timesWrite once, ship multiple times
Write once, ship multiple times
Željko Plesac
 
Fun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksFun Teaching MongoDB New Tricks
Fun Teaching MongoDB New Tricks
MongoDB
 
Relevance trilogy may dream be with you! (dec17)
Relevance trilogy  may dream be with you! (dec17)Relevance trilogy  may dream be with you! (dec17)
Relevance trilogy may dream be with you! (dec17)
Woonsan Ko
 
Art & music vs Google App Engine
Art & music vs Google App EngineArt & music vs Google App Engine
Art & music vs Google App Engine
thomas alisi
 
Angular js
Angular jsAngular js
Angular js
Brian Atkins
 
Microservices Chaos Testing at Jet
Microservices Chaos Testing at JetMicroservices Chaos Testing at Jet
Microservices Chaos Testing at Jet
C4Media
 
CI back to basis
CI back to basisCI back to basis
CI back to basis
Sergio Navarro Pino
 
Azure from scratch part 4
Azure from scratch part 4Azure from scratch part 4
Azure from scratch part 4
Girish Kalamati
 
Agile Machine Learning for Real-time Recommender Systems
Agile Machine Learning for Real-time Recommender SystemsAgile Machine Learning for Real-time Recommender Systems
Agile Machine Learning for Real-time Recommender Systems
Johann Schleier-Smith
 
Backbone js
Backbone jsBackbone js
Backbone js
Knoldus Inc.
 

Similar to [제3회 스포카콘] Elasticsearch 동기화 개선을 위한 고군분투기 (20)

WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
 
From Backbone to Ember and Back(bone) Again
From Backbone to Ember and Back(bone) AgainFrom Backbone to Ember and Back(bone) Again
From Backbone to Ember and Back(bone) Again
 
SpringOne Platform recap 정윤진
SpringOne Platform recap 정윤진SpringOne Platform recap 정윤진
SpringOne Platform recap 정윤진
 
Scaling the Content Repository with Elasticsearch
Scaling the Content Repository with ElasticsearchScaling the Content Repository with Elasticsearch
Scaling the Content Repository with Elasticsearch
 
AngularJS for Legacy Apps
AngularJS for Legacy AppsAngularJS for Legacy Apps
AngularJS for Legacy Apps
 
Turku loves-storybook-styleguidist-styled-components
Turku loves-storybook-styleguidist-styled-componentsTurku loves-storybook-styleguidist-styled-components
Turku loves-storybook-styleguidist-styled-components
 
Ako prepojiť aplikáciu s Elasticsearch
Ako prepojiť aplikáciu s ElasticsearchAko prepojiť aplikáciu s Elasticsearch
Ako prepojiť aplikáciu s Elasticsearch
 
Webpack Encore Symfony Live 2017 San Francisco
Webpack Encore Symfony Live 2017 San FranciscoWebpack Encore Symfony Live 2017 San Francisco
Webpack Encore Symfony Live 2017 San Francisco
 
Mices 2018 cxp pavel_penchev_searchhub-searchcollector
Mices 2018 cxp pavel_penchev_searchhub-searchcollectorMices 2018 cxp pavel_penchev_searchhub-searchcollector
Mices 2018 cxp pavel_penchev_searchhub-searchcollector
 
Remixing Confluence With Speakeasy
Remixing Confluence With SpeakeasyRemixing Confluence With Speakeasy
Remixing Confluence With Speakeasy
 
Write once, ship multiple times
Write once, ship multiple timesWrite once, ship multiple times
Write once, ship multiple times
 
Fun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksFun Teaching MongoDB New Tricks
Fun Teaching MongoDB New Tricks
 
Relevance trilogy may dream be with you! (dec17)
Relevance trilogy  may dream be with you! (dec17)Relevance trilogy  may dream be with you! (dec17)
Relevance trilogy may dream be with you! (dec17)
 
Art & music vs Google App Engine
Art & music vs Google App EngineArt & music vs Google App Engine
Art & music vs Google App Engine
 
Angular js
Angular jsAngular js
Angular js
 
Microservices Chaos Testing at Jet
Microservices Chaos Testing at JetMicroservices Chaos Testing at Jet
Microservices Chaos Testing at Jet
 
CI back to basis
CI back to basisCI back to basis
CI back to basis
 
Azure from scratch part 4
Azure from scratch part 4Azure from scratch part 4
Azure from scratch part 4
 
Agile Machine Learning for Real-time Recommender Systems
Agile Machine Learning for Real-time Recommender SystemsAgile Machine Learning for Real-time Recommender Systems
Agile Machine Learning for Real-time Recommender Systems
 
Backbone js
Backbone jsBackbone js
Backbone js
 

Recently uploaded

Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
c5vrf27qcz
 
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving
 
Must Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during MigrationMust Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during Migration
Mydbops
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Neo4j
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
Edge AI and Vision Alliance
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
Pablo Gómez Abajo
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
Safe Software
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
Alex Pruden
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
Ajin Abraham
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
Neo4j
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Pitangent Analytics & Technology Solutions Pvt. Ltd
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
LizaNolte
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
Jason Yip
 

Recently uploaded (20)

Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
 
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
 
Must Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during MigrationMust Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during Migration
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
 

[제3회 스포카콘] Elasticsearch 동기화 개선을 위한 고군분투기

  • 1. Elasticsearch 동기화 개선을 위한 고군분투기 Yool 한유리 Full Stack Programmer SPOQA conference 2021 : Always Evolving!
  • 2. SPOQA conference 2021 : Always Evolving! 풀스택 프로그래머 도도 포인트 1년 3개월 도도 카트 1년(~ing) 프로덕트 만드는 걸 좋아해요. 😋
  • 3. SPOQA conference 2021 : Always Evolving! 목차 1. Elasticsearch 도입 계기 2. Elasticsearch? 3. logstash와 데이터 동기화 과정 4. 문제점 5. 해결 과정 - index template, logstash pipeline - index alias, delete index - curator, Kubernetes cronjob 6. 후기
  • 4. SPOQA conference 2021 : Always Evolving! Elasticsearch, 우리도 도입합시다! 🗣 AS-IS 각각 분리되어 있는 검색 폼
  • 5. SPOQA conference 2021 : Always Evolving! Elasticsearch, 우리도 도입합시다! 🗣 TO-BE 단 하나의 통합 검색 폼
  • 6. SPOQA conference 2021 : Always Evolving! Elasticsearch가 뭐죠? 👀 모든 유형의 데이터를 위한 검색 및 분석엔진
  • 7. SPOQA conference 2021 : Always Evolving! Elasticsearch가 뭐죠? 👀 애플리케이션 / 웹사이트 / 엔터프라이즈 검색 로깅과 로그 분석 인프라 메트릭과 컨테이너 모니터링 애플리케이션 성능 모니터링 비즈니스 분석 …
  • 8. SPOQA conference 2021 : Always Evolving! Elasticsearch가 뭐죠? 👀 1. 검색이 빠르다! (Inverted Index) 2. 검색에 용이하다! (가중치, tokenizer 등)
  • 9. SPOQA conference 2021 : Always Evolving! RDBMS vs Elasticsearch RDBMS Elasticsearch Database Index Table Type Row Document
  • 10. SPOQA conference 2021 : Always Evolving! Logstash는 이렇게 동작해요 ✨ input { … } — 집계 filter { … } — 변환 output { … } — 저장
  • 11. SPOQA conference 2021 : Always Evolving! Logstash 설정 🧐 참고: <Logstash와 JDBC를 사용해 Elasticsearch와 관계형 데이터베이스의 동기화를 유지하는 방법> input { jdbc { … schedule => "*/10 * * * * *" statement => "SELECT id, category, name, standard, unit, created_at, extract(epoch FROM updated_at) AS unix_ts_in_secs FROM product WHERE updated_at > to_timestamp(:sql_last_value) AND updated_at < now() ORDER BY updated_at ASC” use_column_value => true tracking_column => "unix_ts_in_secs" tracking_column_type => “numeric" … } } 10초마다 마지막으로 트래킹 된 updated_at 이후 변경된 품목들을 집계
  • 12. SPOQA conference 2021 : Always Evolving! output { elasticsearch { cloud_id => '${ELASTICSEARCH_CLOUD_ID}' cloud_auth => '${ELASTICSEARCH_CLOUD_USER_NAME}:${ELASTICSEARCH_CLOUD_PASSWORD}' index => "cart_product" document_id => "%{[@metadata][_id]}" } } Logstash 설정 🧐 cart_product index에 데이터 저장
  • 13. SPOQA conference 2021 : Always Evolving! 여기서 드는 의문 🤭 DB에서 delete된 row는 그럼 어떻게 동기화 되는 거지?
  • 14. SPOQA conference 2021 : Always Evolving! 해결책 🤨 1. soft deletion (delete하지 않고 deleted_at 컬럼에 삭제 시간 기록하기) 2. row가 삭제될 때 elasticsearch에 삭제 요청 보내기
  • 15. SPOQA conference 2021 : Always Evolving! Soft Deletion? 실제로 삭제되어야 하는 데이터인데 비즈니스 로직이 복잡해지는 것을 수용할 것인가? 쌓이기만 하는 데이터 괜찮을까? 🙅
  • 16. SPOQA conference 2021 : Always Evolving! 직접 요청하기? 과연 매번 Elasticsearch를 고려할 수 있을까? 어떠한 상황에서도 100% 동기화시킬 수 있을까? 🙅
  • 17. SPOQA conference 2021 : Always Evolving! Idea 💡 C님 🗣 “ 종종 동기화가 깨져서 인덱스를 새로 만들어서 다시 동기화해주어야 했어요.” + 삭제된 데이터가 실시간으로 동기화되지 않아도 괜찮음 = 그럼 주기적으로 인덱스를 새로 만들자!
  • 18. SPOQA conference 2021 : Always Evolving! 요구사항 📌 - 특정 주기마다 인덱스 새로 만들기 - 새로운 index를 통해 검색할 수 있도록 하기 - 이전에 만들어진 index 삭제하기 (저장공간 절약) - 어떠한 과정에서도 검색은 항상 잘되도록 하기
  • 19. SPOQA conference 2021 : Always Evolving! 행복회로 💗 - Elasticsearch REST API - AWS lambda - AWS CloudWatch Events
  • 20. SPOQA conference 2021 : Always Evolving! 설계 인덱스 생성 동기화 인덱스 교체 이전 인덱스 삭제
  • 21. SPOQA conference 2021 : Always Evolving! 문제 인덱스 생성 동기화 이전 인덱스 삭제 시점 불명확! 인덱스 교체
  • 22. SPOQA conference 2021 : Always Evolving! 해결책 Index Template 새로운 logstash pipeline 추가
  • 23. SPOQA conference 2021 : Always Evolving! 특정 주기마다 인덱스 새로 만들기 PUT _index_template/<템플릿 이름> { "index_patterns": ["cart_product*"], "template": { "mappings": { "properties": { "category": { "type": "text", "fields": { "ngram": { "type": "text", "analyzer": "korean_ngram" } }, "analyzer": "korean" } } … 인덱스 설정 인덱스 이름 패턴
  • 24. SPOQA conference 2021 : Always Evolving! input { jdbc { … schedule => “0 3 * * * Asia/Seoul" statement => "SELECT id, category, name, standard, unit, created_at, extract(epoch FROM updated_at) AS unix_ts_in_secs FROM product ORDER BY updated_at ASC" … } } 특정 주기마다 인덱스 새로 만들기
  • 25. SPOQA conference 2021 : Always Evolving! 특정 주기마다 인덱스 새로 만들기 filter { ruby { init => "require 'time'" code => "event.set('kstDate', Time.now.utc.getlocal('+09:00').strftime('%Y.%m.%d'))" } … } 참고) %{+YYYY.MM.dd}를 이용해도 됨 (컨테이너 타임존을 따라감)
  • 26. SPOQA conference 2021 : Always Evolving! 특정 주기마다 인덱스 새로 만들기 output { … elasticsearch { index => "cart_product_%{kstDate}" … } }
  • 27. SPOQA conference 2021 : Always Evolving! 특정 주기마다 인덱스 새로 만들기 PUT /_security/role/<Role 이름> { "cluster": ["manage_index_templates", "monitor"], "indices" : [ { "names" : ["cart_product*"], "privileges" : ["write","create", "delete", "create_index"] } ] }
  • 28. SPOQA conference 2021 : Always Evolving! 설계 (1) 인덱스 생성 & 동기화 인덱스 이름 변경 이전 인덱스 삭제
  • 29. SPOQA conference 2021 : Always Evolving! 문제 (1) 인덱스 생성 & 동기화 이전 인덱스 삭제 검색이 불가능! 기존 인덱스 이름 변경 cart_product 👇 cart_product_legacy 새로운 인덱스 이름 변경 cart_product_2021.02.01 👇 cart_product
  • 30. SPOQA conference 2021 : Always Evolving! 해결책 Reindex Clone Index Alias
  • 31. SPOQA conference 2021 : Always Evolving! Index Alias POST /_aliases { "actions" : [ { "add" : { "index" : "cart_product_2021.02.14", "alias" : "cart_product" } }, { "remove": {"index": “cart_product_2021.02.12.15", "alias" : "cart_product" } } ] }
  • 32. SPOQA conference 2021 : Always Evolving! 설계 (2) 인덱스 생성 & 동기화 인덱스 alias 수정 이전 인덱스 삭제
  • 33. SPOQA conference 2021 : Always Evolving! DELETE /<인덱스 이름> Delete Index
  • 34. SPOQA conference 2021 : Always Evolving! 설계 (2) 인덱스 생성 & 동기화 이전 인덱스 삭제 인덱스 alias 수정
  • 35. SPOQA conference 2021 : Always Evolving! 발전 시키기 - index 관리
  • 36. SPOQA conference 2021 : Always Evolving! index 관리의 또 다른 방법 Curator 원하는 index (or snapshot)을 가져와 원하는 액션을 취할 수 있도록 함 yaml 파일로 어떠한 액션을 취할 것인지 선언
  • 37. SPOQA conference 2021 : Always Evolving! Curator 구성 - Action File - Configuration File
  • 38. SPOQA conference 2021 : Always Evolving! Action File 구조 actions: 1: action: ACTION1 description: OPTIONAL DESCRIPTION options: option1: value1 ... optionN: valueN filters: - filtertype: *first* filter_element1: value1 ... filter_elementN: valueN - filtertype: *second* filter_element1: value1 ... filter_elementN: valueN 어떤 동작을 수행할 것인가 액션에 사용될 설정 어떤 인덱스를 대상으로 수행할 것인가
  • 39. SPOQA conference 2021 : Always Evolving! alias 업데이트 actions: 1: action: alias description: “…” options: name: cart_product remove: filters: - filtertype: alias aliases: cart_product exclude: False cart_product라는 alias를 가진 index로부터 cart_product alias를 제거 cart_product alias를 가진 index
  • 40. SPOQA conference 2021 : Always Evolving! alias 업데이트 remove: … add: filters: - filtertype: pattern kind: prefix value: cart_product_ - filtertype: count count: 1 use_age: True source: creation_date reverse: True exclude: False cart_product_로 시작하는 index 가장 최근에 만들어진 index 1개 가장 마지막에 생성된 cart_proudct_로 시작하는 index에 cart_product alias 추가
  • 41. SPOQA conference 2021 : Always Evolving! 2: action: delete_indices description: "…" options: timeout_override: 300 continue_if_exception: False filters: - filtertype: alias aliases: cart_product exclude: True - filtertype: pattern kind: prefix value: cart_product_ index 삭제하기 cart_product alias를 가지지 않은 index cart_product_로 시작하는 index cart_product alias가 없으며 (=검색에 사용 중이지 않은) cart_product_로 시작하는 인덱스 삭제
  • 42. SPOQA conference 2021 : Always Evolving! Curator 주기적으로 실행하기 Kubernetes Cronjob 참고: <Running Curator as a Kubernetes CronJob> 각자의 환경에서 가장 적절한 방법으로 실행
  • 43. SPOQA conference 2021 : Always Evolving! 발전 시키기 - 조합하기
  • 44. SPOQA conference 2021 : Always Evolving! 인덱스 생성 & 동기화 cart_product pipeline cart_product_yyyy.mm.dd pipeline 스케쥴 새로운 인덱스 기존 인덱스 curator
  • 45. SPOQA conference 2021 : Always Evolving! 매일 달라짐 curator 스케쥴 cart_product pipeline cart_product_yyyy.mm.dd pipeline
  • 46. SPOQA conference 2021 : Always Evolving! 새로운 인덱스 기존 인덱스 curator 스케쥴 cart_product pipeline cart_product_yyyy.mm.dd pipeline
  • 47. SPOQA conference 2021 : Always Evolving! 누락 curator 스케쥴 cart_product pipeline cart_product_yyyy.mm.dd pipeline
  • 48. SPOQA conference 2021 : Always Evolving! curator 스케쥴 cart_product pipeline cart_product_yyyy.mm.dd pipeline 새로운 인덱스 기존 인덱스
  • 49. SPOQA conference 2021 : Always Evolving! 0.1% 모자람 하나의 인덱스에 동기화하는 파이프라인은 2개 curator cart_product pipeline cart_product_yyyy.mm.dd pipeline
  • 50. SPOQA conference 2021 : Always Evolving! input { jdbc { … schedule => "*/5 3 * * * Asia/Seoul" statement => "SELECT id, category, name, standard, unit, created_at, FROM product WHERE now() - interval '1 hour' >= :sql_last_value or (updated_at > :sql_last_value AND updated_at < now()) ORDER BY updated_at ASC” use_column_value => false … } } logstash 수정
  • 51. SPOQA conference 2021 : Always Evolving! 최종 3:00 3:45 4:00 curator cart_product pipeline cart_product_yyyy.mm.dd pipeline
  • 52. SPOQA conference 2021 : Always Evolving! 요구사항 📌 - 특정 주기마다 인덱스 새로 만들기 ✅ - 새로운 index를 통해 검색할 수 있도록 하기 ✅ - 이전에 만들어진 index 삭제하기 ✅ - 어떠한 과정에서도 검색은 항상 잘되도록 하기 ✅ . o 0 (🤔)
  • 53. SPOQA conference 2021 : Always Evolving! 후기 (너무 공들였나…)
  • 54. SPOQA conference 2021 : Always Evolving! 같이 이야기해 봐요! ✨👀 비슷한 문제를 해결하기 위한 시도를 해보았다면 채팅창으로 공유해주세요!