Spring boot 에서 aws msk iam-auth 이슈
원인
- 배포할 때 spring boot에서 kafkaConfig를 bean 생성에 실패하는 오류 발생
Feb 29 17:04:29 ip-172-31-10-98 web[118840]: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'kafkaConfig': Injection of autowired dependencies failed
Feb 29 17:04:29 ip-172-31-10-98 web[118840]: #011at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:514) ~[spring-beans-6.1.3.jar!/:6.1.3]
Feb 29 17:04:29 ip-172-31-10-98 web[118840]: #011at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1418) ~[spring-beans-6.1.3.jar!/:6.1.3]
Feb 29 17:04:29 ip-172-31-10-98 web[118840]: #011at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:598) ~[spring-beans-6.1.3.jar!/:6.1.3]
Feb 29 17:04:29 ip-172-31-10-98 web[118840]: #011at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[spring-beans-6.1.3.jar!/:6.1.3]
Feb 29 17:04:29 ip-172-31-10-98 web[118840]: #011at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[spring-beans-6.1.3.jar!/:6.1.3]
Feb 29 17:04:29 ip-172-31-10-98 web[118840]: #011at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.3.jar!/:6.1.3]
Feb 29 17:04:29 ip-172-31-10-98 web[118840]: #011at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[spring-beans-6.1.3.jar!/:6.1.3]
Feb 29 17:04:29 ip-172-31-10-98 web[118840]: #011at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-6.1.3.jar!/:6.1.3]
Feb 29 17:04:29 ip-172-31-10-98 web[118840]: #011at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:975) ~[spring-beans-6.1.3.jar!/:6.1.3]
Feb 29 17:04:29 ip-172-31-10-98 web[118840]: #011at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:959) ~[spring-context-6.1.3.jar!/:6.1.3]
Feb 29 17:04:29 ip-172-31-10-98 web[118840]: #011at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:624) ~[spring-context-6.1.3.jar!/:6.1.3]
Feb 29 17:04:29 ip-172-31-10-98 web[118840]: #011at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.2.2.jar!/:3.2.2]
해결
KafkaConfig 파일에 MSK IAM-auth 인증을 위해 추가
써드 파티 쿠키 공유
- 테스트로 크롬에서 시도하였습니다.
- 크롬에서 써드 파티 쿠키를 허용을 해주고 개발자 도구에서 비동기로 요청 하였습니다.
var calltest = new XMLHttpRequest; //객체 생성
calltest.open("POST","<https://web.tmomi.site/api/v1/signin>",true);//요청 방식
calltest.setRequestHeader("Content-Type","application/json"); //헤더 정보
calltest.send(JSON.stringify({"email":"admin@test.com","password":"1234"}));
MSK Producer 서버에서 토픽 생성 오류 및 disconnected
에러 내용
Mar 1 04:25:10 ip-172-31-9-179 web: 2024-03-01T04:25:10.968+09:00 INFO 30246 --- [| adminclient-1] org.apache.kafka.clients.NetworkClient : [AdminClient clientId=adminclient-1] Node -1 disconnected.
Mar 1 04:25:10 ip-172-31-9-179 web: 2024-03-01T04:25:10.969+09:00 INFO 30246 --- [| adminclient-1] org.apache.kafka.clients.NetworkClient : [AdminClient clientId=adminclient-1] Cancelled in-flight API_VERSIONS request with correlation id 28 due to node -1 being disconnected (elapsed time since creation: 64ms, elapsed time since send: 64ms, request timeout: 3600000ms)
Mar 1 04:25:11 ip-172-31-9-179 web: 2024-03-01T04:25:11.291+09:00 INFO 30246 --- [| adminclient-1] o.a.k.c.a.i.AdminMetadataManager : [AdminClient clientId=adminclient-1] Metadata update failed
Mar 1 04:25:11 ip-172-31-9-179 web: org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment. Call: fetchMetadata
Mar 1 04:25:11 ip-172-31-9-179 web: 2024-03-01T04:25:11.291+09:00 ERROR 30246 --- [ main] o.springframework.kafka.core.KafkaAdmin : Could not configure topics
Mar 1 04:25:11 ip-172-31-9-179 web: org.springframework.kafka.KafkaException: Timed out waiting to get existing topics
해결
@Bean
public NewTopic createTopic() {
return TopicBuilder.name(TOPIC_NAME)
.partitions(1)
.replicas(1)
.build();
}
Spring Boot에서 토픽을 생성해주지 않으면 에러가 해결이 됐다.
[배포] Grafana, Prometheus
Node Exporter
설치한 EC2
Prometheus
서버실행
nohup ./prometheus -—config.file=prometheus.yml —web.listen-address=:9090 > prometheus.log 2>&1
nohup: ignoring input
Error parsing command line arguments: unexpected —config.file=./prometheus.yml
prometheus: error: unexpected —config.file=./prometheus.yml
Grafana
수집한 데이터를 대시보드를 사용해 시각화 해준다. sudo systemctl start grafana-server
id : admin
pwd : 1q2w3e4r!!
auto scaling group으로 지정된 beanstalk 환경을 어떻게 동적으로 메트릭을 수집할 것인가? ?
-
prometheus의 service discovery 활용
-
프로메테우스 설정에서 서비스 디스커버리를 활성화합니다.
prometheus가 설치된 ec2에서 prometheus 설정 파일(
prometheus.yml
)에서 EC2 SD 설정을 추가scrape_configs: - job_name: 'ec2' ec2_sd_configs: - region: ap-northeast-2 access_key: your_access_key secret_key: your_secret_key port: 9100 relabel_configs: - source_labels: [__meta_ec2_tag_Name] regex: 'tmomi-web' action: keep - source_labels: [__meta_ec2_tag_Name] regex: 'tmomi-consumer' action: keep - source_labels: [__meta_ec2_tag_Name] regex: 'tmomi-producer' action: keep
-
Auto Scaling 그룹을 생성할 때, 적절한 레이블을 설정하여 각 인스턴스에 레이블을 부여합니다. 이 레이블은 프로메테우스가 해당 인스턴스를 식별하는 데 사용됩니다.
-
Auto Scaling 그룹에서 인스턴스가 생성 또는 제거될 때, 이벤트를 트리거하고, 해당 이벤트를 감지하여 새로운 인스턴스의 엔드포인트를 프로메테우스에 등록하거나, 제거되는 인스턴스의 엔드포인트를 프로메테우스에서 삭제합니다.
-
프로메테우스는 설정된 레이블 셀렉터와 일치하는 모든 엔드포인트에서 지표를 수집합니다.
-
-
Prometheus Node Exporter와 Pushgateway를 사용하는 방법을 들 수 있습니다.
-
EC2 인스턴스 설정: 각 EC2 인스턴스는 시작할 때 Node Exporter를 실행하고, 필요한 메트릭을 Pushgateway에 푸시하는 작업을 수행해야 합니다. 이를 위해 User Data 스크립트나 초기화 스크립트를 사용할 수 있습니다.
Node Exporter 설치 스크립트 작성: 예를 들어, Node Exporter를 설치하고 실행하는 스크립트를 작성할 수 있습니다.
#!/bin/bash # Node Exporter 버전을 변수에 저장 NODE_EXPORTER_VERSION="1.1.2" # /tmp 디렉토리로 이동 cd /tmp # Node Exporter를 다운로드 curl -LO "<https://github.com/prometheus/node_exporter/releases/download/v${NODE_EXPORTER_VERSION}/node_exporter-${NODE_EXPORTER_VERSION}.linux-amd64.tar.gz>" # 압축 해제 tar -xvzf "node_exporter-${NODE_EXPORTER_VERSION}.linux-amd64.tar.gz" # node_exporter 바이너리를 /usr/local/bin 디렉토리로 이동 sudo mv "node_exporter-${NODE_EXPORTER_VERSION}.linux-amd64/node_exporter" /usr/local/bin/ # Node Exporter 서비스 파일 생성 echo "[Unit] Description=Node Exporter After=network.target [Service] User=root ExecStart=/usr/local/bin/node_exporter [Install] WantedBy=default.target" > node_exporter.service # 서비스 파일을 /etc/systemd/system 디렉토리로 이동 sudo mv node_exporter.service /etc/systemd/system/node_exporter.service # 서비스 활성화 및 시작 sudo systemctl daemon-reload sudo systemctl enable node_exporter sudo systemctl start node_exporter
이 스크립트는 EC2 인스턴스가 시작될 때 실행되며, Node Exporter를 다운로드하고 설치하고, Node Exporter 서비스를 실행합니다.
-
Launch Template 설정
AWS Management Console에 로그인 한 후, EC2 서비스로 이동합니다.
"Create launch template"를 선택합니다. 필요한 설정들을 입력합니다. 예를 들어, AMI, Instance Type, Key Pair 등을 선택합니다.“Advanced Details” 섹션으로 이동하면 “User data” 필드가 있습니다. 여기에 1번에서 작성한 Node Exporter 설치 스크립트를 붙여넣습니다. 모든 설정을 완료한 후 "Create launch template"를 클릭하여 생성을 완료합니다.
* * * * * curl localhost:9100/metrics | curl --data-binary @- <http://pushgateway:9091/metrics/job/node_exporter>
이 cron 작업은 매분마다 실행되며, Node Exporter의 메트릭을 localhost의 9100 포트에서 읽어 Pushgateway의 9091 포트에 푸시합니다. 이때
localhost:9100/metrics
는 Node Exporter가 메트릭을 제공하는 HTTP 엔드포인트이며,http://pushgateway:9091/metrics/job/node_exporter
는 Pushgateway가 메트릭을 받는 엔드포인트입니다.이렇게 설정하면, 각 EC2 인스턴스는 Node Exporter를 통해 메트릭을 수집하고, 이를 Pushgateway로 전송하게 됩니다. 이후 Prometheus 서버는 Pushgateway로부터 이 메트릭을 ‘pull’ 방식으로 수집합니다. 이렇게 하면 EC2 인스턴스가 동적으로 생성되고 삭제되더라도, 각 인스턴스에서 생성된 메트릭을 안정적으로 수집하고 모니터링할 수 있습니다.
-
Prometheus 설정: Prometheus 서버는 Pushgateway를 스크레이핑하도록 설정해야 합니다. 이를 위해 Prometheus의 설정 파일에 다음과 비슷한 항목을 추가합니다:
-
Grafana 설정: 마지막으로 Grafana에서 Prometheus 데이터 소스를 추가하고, 대시보드를 생성하여 원하는 메트릭을 시각화합니다.
-
** Pushgateway: 일반적으로 Prometheus는 메트릭 수집 대상 서버로부터 직접 메트릭을 ‘pull’ 방식으로 가져옵니다. 하지만 일부 환경에서는 ‘push’ 방식이 더 적합한 경우가 있습니다. 예를 들어, 짧은 수명을 가진 배치 작업이나, 임시적인 작업들이 생성하는 메트릭을 수집하기 위해 사용됩니다. 이러한 메트릭들을 Prometheus 서버가 직접 ‘pull’ 하기 어려운 경우, Pushgateway가 중간에서 메트릭을 받아 Prometheus가 수집할 수 있도록 돕습니다.
'항해99' 카테고리의 다른 글
항해99 실전 프로젝트 (29일차) (0) | 2024.03.04 |
---|---|
항해99 실전 프로젝트 (28일차) (0) | 2024.03.02 |
항해99 실전 프로젝트 (26일차) (0) | 2024.02.28 |
항해99 실전 프로젝트 (25일차) (0) | 2024.02.27 |
항해99 실전 프로젝트 (24일차) (0) | 2024.02.26 |
Spring boot 에서 aws msk iam-auth 이슈
원인
- 배포할 때 spring boot에서 kafkaConfig를 bean 생성에 실패하는 오류 발생
Feb 29 17:04:29 ip-172-31-10-98 web[118840]: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'kafkaConfig': Injection of autowired dependencies failed
Feb 29 17:04:29 ip-172-31-10-98 web[118840]: #011at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:514) ~[spring-beans-6.1.3.jar!/:6.1.3]
Feb 29 17:04:29 ip-172-31-10-98 web[118840]: #011at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1418) ~[spring-beans-6.1.3.jar!/:6.1.3]
Feb 29 17:04:29 ip-172-31-10-98 web[118840]: #011at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:598) ~[spring-beans-6.1.3.jar!/:6.1.3]
Feb 29 17:04:29 ip-172-31-10-98 web[118840]: #011at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[spring-beans-6.1.3.jar!/:6.1.3]
Feb 29 17:04:29 ip-172-31-10-98 web[118840]: #011at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[spring-beans-6.1.3.jar!/:6.1.3]
Feb 29 17:04:29 ip-172-31-10-98 web[118840]: #011at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.3.jar!/:6.1.3]
Feb 29 17:04:29 ip-172-31-10-98 web[118840]: #011at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[spring-beans-6.1.3.jar!/:6.1.3]
Feb 29 17:04:29 ip-172-31-10-98 web[118840]: #011at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-6.1.3.jar!/:6.1.3]
Feb 29 17:04:29 ip-172-31-10-98 web[118840]: #011at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:975) ~[spring-beans-6.1.3.jar!/:6.1.3]
Feb 29 17:04:29 ip-172-31-10-98 web[118840]: #011at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:959) ~[spring-context-6.1.3.jar!/:6.1.3]
Feb 29 17:04:29 ip-172-31-10-98 web[118840]: #011at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:624) ~[spring-context-6.1.3.jar!/:6.1.3]
Feb 29 17:04:29 ip-172-31-10-98 web[118840]: #011at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.2.2.jar!/:3.2.2]
해결
KafkaConfig 파일에 MSK IAM-auth 인증을 위해 추가
써드 파티 쿠키 공유
- 테스트로 크롬에서 시도하였습니다.
- 크롬에서 써드 파티 쿠키를 허용을 해주고 개발자 도구에서 비동기로 요청 하였습니다.
var calltest = new XMLHttpRequest; //객체 생성
calltest.open("POST","<https://web.tmomi.site/api/v1/signin>",true);//요청 방식
calltest.setRequestHeader("Content-Type","application/json"); //헤더 정보
calltest.send(JSON.stringify({"email":"admin@test.com","password":"1234"}));
MSK Producer 서버에서 토픽 생성 오류 및 disconnected
에러 내용
Mar 1 04:25:10 ip-172-31-9-179 web: 2024-03-01T04:25:10.968+09:00 INFO 30246 --- [| adminclient-1] org.apache.kafka.clients.NetworkClient : [AdminClient clientId=adminclient-1] Node -1 disconnected.
Mar 1 04:25:10 ip-172-31-9-179 web: 2024-03-01T04:25:10.969+09:00 INFO 30246 --- [| adminclient-1] org.apache.kafka.clients.NetworkClient : [AdminClient clientId=adminclient-1] Cancelled in-flight API_VERSIONS request with correlation id 28 due to node -1 being disconnected (elapsed time since creation: 64ms, elapsed time since send: 64ms, request timeout: 3600000ms)
Mar 1 04:25:11 ip-172-31-9-179 web: 2024-03-01T04:25:11.291+09:00 INFO 30246 --- [| adminclient-1] o.a.k.c.a.i.AdminMetadataManager : [AdminClient clientId=adminclient-1] Metadata update failed
Mar 1 04:25:11 ip-172-31-9-179 web: org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment. Call: fetchMetadata
Mar 1 04:25:11 ip-172-31-9-179 web: 2024-03-01T04:25:11.291+09:00 ERROR 30246 --- [ main] o.springframework.kafka.core.KafkaAdmin : Could not configure topics
Mar 1 04:25:11 ip-172-31-9-179 web: org.springframework.kafka.KafkaException: Timed out waiting to get existing topics
해결
@Bean
public NewTopic createTopic() {
return TopicBuilder.name(TOPIC_NAME)
.partitions(1)
.replicas(1)
.build();
}
Spring Boot에서 토픽을 생성해주지 않으면 에러가 해결이 됐다.
[배포] Grafana, Prometheus
Node Exporter
설치한 EC2
Prometheus
서버실행
nohup ./prometheus -—config.file=prometheus.yml —web.listen-address=:9090 > prometheus.log 2>&1
nohup: ignoring input
Error parsing command line arguments: unexpected —config.file=./prometheus.yml
prometheus: error: unexpected —config.file=./prometheus.yml
Grafana
수집한 데이터를 대시보드를 사용해 시각화 해준다. sudo systemctl start grafana-server
id : admin
pwd : 1q2w3e4r!!
auto scaling group으로 지정된 beanstalk 환경을 어떻게 동적으로 메트릭을 수집할 것인가? ?
-
prometheus의 service discovery 활용
-
프로메테우스 설정에서 서비스 디스커버리를 활성화합니다.
prometheus가 설치된 ec2에서 prometheus 설정 파일(
prometheus.yml
)에서 EC2 SD 설정을 추가scrape_configs: - job_name: 'ec2' ec2_sd_configs: - region: ap-northeast-2 access_key: your_access_key secret_key: your_secret_key port: 9100 relabel_configs: - source_labels: [__meta_ec2_tag_Name] regex: 'tmomi-web' action: keep - source_labels: [__meta_ec2_tag_Name] regex: 'tmomi-consumer' action: keep - source_labels: [__meta_ec2_tag_Name] regex: 'tmomi-producer' action: keep
-
Auto Scaling 그룹을 생성할 때, 적절한 레이블을 설정하여 각 인스턴스에 레이블을 부여합니다. 이 레이블은 프로메테우스가 해당 인스턴스를 식별하는 데 사용됩니다.
-
Auto Scaling 그룹에서 인스턴스가 생성 또는 제거될 때, 이벤트를 트리거하고, 해당 이벤트를 감지하여 새로운 인스턴스의 엔드포인트를 프로메테우스에 등록하거나, 제거되는 인스턴스의 엔드포인트를 프로메테우스에서 삭제합니다.
-
프로메테우스는 설정된 레이블 셀렉터와 일치하는 모든 엔드포인트에서 지표를 수집합니다.
-
-
Prometheus Node Exporter와 Pushgateway를 사용하는 방법을 들 수 있습니다.
-
EC2 인스턴스 설정: 각 EC2 인스턴스는 시작할 때 Node Exporter를 실행하고, 필요한 메트릭을 Pushgateway에 푸시하는 작업을 수행해야 합니다. 이를 위해 User Data 스크립트나 초기화 스크립트를 사용할 수 있습니다.
Node Exporter 설치 스크립트 작성: 예를 들어, Node Exporter를 설치하고 실행하는 스크립트를 작성할 수 있습니다.
#!/bin/bash # Node Exporter 버전을 변수에 저장 NODE_EXPORTER_VERSION="1.1.2" # /tmp 디렉토리로 이동 cd /tmp # Node Exporter를 다운로드 curl -LO "<https://github.com/prometheus/node_exporter/releases/download/v${NODE_EXPORTER_VERSION}/node_exporter-${NODE_EXPORTER_VERSION}.linux-amd64.tar.gz>" # 압축 해제 tar -xvzf "node_exporter-${NODE_EXPORTER_VERSION}.linux-amd64.tar.gz" # node_exporter 바이너리를 /usr/local/bin 디렉토리로 이동 sudo mv "node_exporter-${NODE_EXPORTER_VERSION}.linux-amd64/node_exporter" /usr/local/bin/ # Node Exporter 서비스 파일 생성 echo "[Unit] Description=Node Exporter After=network.target [Service] User=root ExecStart=/usr/local/bin/node_exporter [Install] WantedBy=default.target" > node_exporter.service # 서비스 파일을 /etc/systemd/system 디렉토리로 이동 sudo mv node_exporter.service /etc/systemd/system/node_exporter.service # 서비스 활성화 및 시작 sudo systemctl daemon-reload sudo systemctl enable node_exporter sudo systemctl start node_exporter
이 스크립트는 EC2 인스턴스가 시작될 때 실행되며, Node Exporter를 다운로드하고 설치하고, Node Exporter 서비스를 실행합니다.
-
Launch Template 설정
AWS Management Console에 로그인 한 후, EC2 서비스로 이동합니다.
"Create launch template"를 선택합니다. 필요한 설정들을 입력합니다. 예를 들어, AMI, Instance Type, Key Pair 등을 선택합니다.“Advanced Details” 섹션으로 이동하면 “User data” 필드가 있습니다. 여기에 1번에서 작성한 Node Exporter 설치 스크립트를 붙여넣습니다. 모든 설정을 완료한 후 "Create launch template"를 클릭하여 생성을 완료합니다.
* * * * * curl localhost:9100/metrics | curl --data-binary @- <http://pushgateway:9091/metrics/job/node_exporter>
이 cron 작업은 매분마다 실행되며, Node Exporter의 메트릭을 localhost의 9100 포트에서 읽어 Pushgateway의 9091 포트에 푸시합니다. 이때
localhost:9100/metrics
는 Node Exporter가 메트릭을 제공하는 HTTP 엔드포인트이며,http://pushgateway:9091/metrics/job/node_exporter
는 Pushgateway가 메트릭을 받는 엔드포인트입니다.이렇게 설정하면, 각 EC2 인스턴스는 Node Exporter를 통해 메트릭을 수집하고, 이를 Pushgateway로 전송하게 됩니다. 이후 Prometheus 서버는 Pushgateway로부터 이 메트릭을 ‘pull’ 방식으로 수집합니다. 이렇게 하면 EC2 인스턴스가 동적으로 생성되고 삭제되더라도, 각 인스턴스에서 생성된 메트릭을 안정적으로 수집하고 모니터링할 수 있습니다.
-
Prometheus 설정: Prometheus 서버는 Pushgateway를 스크레이핑하도록 설정해야 합니다. 이를 위해 Prometheus의 설정 파일에 다음과 비슷한 항목을 추가합니다:
-
Grafana 설정: 마지막으로 Grafana에서 Prometheus 데이터 소스를 추가하고, 대시보드를 생성하여 원하는 메트릭을 시각화합니다.
-
** Pushgateway: 일반적으로 Prometheus는 메트릭 수집 대상 서버로부터 직접 메트릭을 ‘pull’ 방식으로 가져옵니다. 하지만 일부 환경에서는 ‘push’ 방식이 더 적합한 경우가 있습니다. 예를 들어, 짧은 수명을 가진 배치 작업이나, 임시적인 작업들이 생성하는 메트릭을 수집하기 위해 사용됩니다. 이러한 메트릭들을 Prometheus 서버가 직접 ‘pull’ 하기 어려운 경우, Pushgateway가 중간에서 메트릭을 받아 Prometheus가 수집할 수 있도록 돕습니다.
'항해99' 카테고리의 다른 글
항해99 실전 프로젝트 (29일차) (0) | 2024.03.04 |
---|---|
항해99 실전 프로젝트 (28일차) (0) | 2024.03.02 |
항해99 실전 프로젝트 (26일차) (0) | 2024.02.28 |
항해99 실전 프로젝트 (25일차) (0) | 2024.02.27 |
항해99 실전 프로젝트 (24일차) (0) | 2024.02.26 |