You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OpenSearch는 오픈소스 검색 및 로그 분석 엔진이에요.
Elasticsearch + Kibana를 기반으로 만들어진 AWS 주도의 프로젝트예요.
🤔 왜 OpenSearch가 나왔을까?
원래 Elasticsearch와 Kibana는 오픈소스였어요.
그런데 Elastic사(엘라스틱)가 2021년에 라이선스를 **비공개(BSL)**로 바꾸면서,
**AWS가 오픈소스로 포크(Fork)**해서 만든 게 바로 OpenSearch예요.
즉, Elasticsearch의 오픈 버전 대체품이에요!
구성요소
설명
OpenSearch
검색 엔진, 데이터를 저장하고 분석 (Elasticsearch 역할)
OpenSearch Dashboards
시각화 도구 (Kibana 역할)
🛠 OpenSearch는 어떤 걸 할 수 있냐면…
로그 분석
검색 기능 구현 (웹, 문서 등)
모니터링 시스템 만들기
알림 설정, 대시보드 만들기
🔄 데이터 흐름은 이렇게!
txt
복사편집
[로그나 데이터 발생]
↓
Logstash or Fluentd 등으로 수집
↓
OpenSearch로 저장
↓
OpenSearch Dashboards로 시각화
✅ OpenSearch의 장점
완전 오픈소스 (Apache 2.0)
Elasticsearch 7.10.2와 호환 (이 버전 이후부터 갈라짐)
플러그인 확장성 좋음 (Alerting, Anomaly Detection 등 내장)
AWS OpenSearch 서비스에서도 바로 사용 가능
🔍 누가 쓰면 좋을까?
로그 분석 시스템을 직접 구축하려는 팀
Elastic의 라이선스 변경이 부담스러운 기업
오픈소스를 선호하는 기술 조직
AWS와 잘 통합하고 싶은 사용자
✨ 요약하면?
항목
내용
🧠 OpenSearch란?
오픈소스 검색/로그 분석 도구
🧱 포함된 도구
OpenSearch (검색) + Dashboards (시각화)
🆚 Elasticsearch와 차이
라이선스 다름, 오픈소스 유지
🔧 쓰임새
로그 분석, 모니터링, 실시간 검색 등
우리가 배우고 있는 스프링 부트를 활용해서 적용한다면? 알아보자
디펜던시 추가
implementation 'org.opensearch.client:opensearch-rest-client:2.13.0'
implementation 'org.opensearch.client:opensearch-java:2.13.0'
@Bean
public OpenSearchClient openSearchClient() {
RestClient restClient = RestClient.builder(new HttpHost("localhost", 9200)).build();
RestClientTransport transport = new RestClientTransport(
restClient, new JacksonJsonpMapper());
return new OpenSearchClient(transport);
}
}
도메인 클래스 추가
package com.example.demo.model;
public class Article {
private String id;
private String title;
private String content;
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
OpenSearch는 오픈소스 검색 및 로그 분석 엔진이에요.
Elasticsearch + Kibana를 기반으로 만들어진 AWS 주도의 프로젝트예요.
🤔 왜 OpenSearch가 나왔을까?
원래 Elasticsearch와 Kibana는 오픈소스였어요.
그런데 Elastic사(엘라스틱)가 2021년에 라이선스를 **비공개(BSL)**로 바꾸면서,
**AWS가 오픈소스로 포크(Fork)**해서 만든 게 바로 OpenSearch예요.
즉, Elasticsearch의 오픈 버전 대체품이에요!
🛠 OpenSearch는 어떤 걸 할 수 있냐면…
로그 분석
검색 기능 구현 (웹, 문서 등)
모니터링 시스템 만들기
알림 설정, 대시보드 만들기
🔄 데이터 흐름은 이렇게!
✅ OpenSearch의 장점
완전 오픈소스 (Apache 2.0)
Elasticsearch 7.10.2와 호환 (이 버전 이후부터 갈라짐)
플러그인 확장성 좋음 (Alerting, Anomaly Detection 등 내장)
AWS OpenSearch 서비스에서도 바로 사용 가능
🔍 누가 쓰면 좋을까?
로그 분석 시스템을 직접 구축하려는 팀
Elastic의 라이선스 변경이 부담스러운 기업
오픈소스를 선호하는 기술 조직
AWS와 잘 통합하고 싶은 사용자
✨ 요약하면?
우리가 배우고 있는 스프링 부트를 활용해서 적용한다면? 알아보자
디펜던시 추가
implementation 'org.opensearch.client:opensearch-rest-client:2.13.0'
implementation 'org.opensearch.client:opensearch-java:2.13.0'
yaml 추가
package com.example.demo.config;
import org.opensearch.client.opensearch.OpenSearchClient;
import org.opensearch.client.opensearch.OpenSearchClientBuilder;
import org.opensearch.client.transport.rest_client.RestClientTransport;
import org.opensearch.client.json.jackson.JacksonJsonpMapper;
import org.apache.http.HttpHost;
import org.opensearch.client.transport.rest_client.RestClientBuilder;
import org.opensearch.client.transport.rest_client.RestClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@configuration
public class OpenSearchConfig {
}
package com.example.demo.model;
public class Article {
private String id;
private String title;
private String content;
}
package com.example.demo.service;
import com.example.demo.model.Article;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.io.FileWriter;
import java.io.IOException;
import java.time.LocalDateTime;
@service
@requiredargsconstructor
public class OpenSearchService {
}
package com.example.demo.controller;
import com.example.demo.model.Article;
import com.example.demo.service.OpenSearchService;
import jakarta.json.JsonObject;
import lombok.RequiredArgsConstructor;
import org.opensearch.client.opensearch.core.search.Hit;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.List;
@RestController
@RequestMapping("/articles")
@requiredargsconstructor
public class ArticleController {
}
저장
curl -X POST http://localhost:8080/articles
-H 'Content-Type: application/json'
-d '{"id": "1", "title": "First Doc", "content": "OpenSearch is great!"}'
검색:
curl "http://localhost:8080/articles/search?q=great"
대시보드로 볼려면?
[Spring Boot 앱]
↓ (로그파일)
[/var/log/randomlog/app.log]
↓
[Logstash] → [OpenSearch]
↓
[OpenSearch Dashboards]
logstash 설치
sudo apt-get install logstash
Logstash 설정
input {
file {
path => "/var/log/randomlog/app.log"
start_position => "beginning"
sincedb_path => "/dev/null"
}
}
filter {
grok {
match => { "message" => "Generated random number: %{NUMBER:random_value:int}" }
}
date {
match => [ "timestamp", "ISO8601" ]
target => "@timestamp"
}
}
output {
opensearch {
hosts => ["http://localhost:9200"]
index => "randomlog"
user => "admin"
password => "admin"
}
}
Logstash 실행
sudo /usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/randomlog.conf
http://localhost:5601 접속
Index Pattern 생성: randomlog*
필드 random_value로 필터, 집계, 차트 생성 가능!
Beta Was this translation helpful? Give feedback.
All reactions