본문 바로가기
기타

Redpanda Cluster HA 구성하기

by aws-evan 2025. 1. 10.
반응형

 

 

 

구성도

 

  • VM Ubuntu 3대
  • 각 서버에 Keepalived, HAproxy, Redapnada

 

 

 

1. Redpanda 공식문서

https://docs.redpanda.com/current/deploy/deployment-option/self-hosted/manual/production/production-deployment/

 

Deploy for Production: Manual | Redpanda Self-Managed

Steps to deploy a Redpanda production cluster.

docs.redpanda.com

 

 

2. Redpanda Port 정보

Port Service Name
9092 Kafka(비 암호화 통신
19092 Kafka(암호화 통신)
9644 Admin API
9644 Promethues
8081 Schema Registry
8080 Console

 

 

3. Redpanda 설치

  • ubuntu
curl -1sLf \
  'https://dl.redpanda.com/nzc4ZYQK3WRGd9sy/redpanda/cfg/setup/bash.deb.sh' \
  | sudo -E bash

sudo apt-get install redpanda -y

 

  • Centos
curl -1sLf 'https://dl.redpanda.com/nzc4ZYQK3WRGd9sy/redpanda/cfg/setup/bash.rpm.sh' | \
sudo -E bash && sudo yum install redpanda -y

 

 

4. Redapanda-Console

  • Ubuntu
curl -1sLf 'https://dl.redpanda.com/nzc4ZYQK3WRGd9sy/redpanda/cfg/setup/bash.deb.sh' | \
sudo -E bash && sudo apt-get install redpanda-console -y
  • Centos
curl -1sLf 'https://dl.redpanda.com/nzc4ZYQK3WRGd9sy/redpanda/cfg/setup/bash.rpm.sh' | \
sudo -E bash && sudo yum install redpanda-console -y
  • 콘솔 설정
vi /etc/redpanda/redpanda-console-config.yaml
  • Keepalived, Haproxy 설정 후 해당 IP , 포트로 정의
kafka:
  brokers:
    - "192.168.0.132:9090"  ##Keepalived IP + HAproxy Port

 

 

5. 프로덕션을 위해 Linux 커널 조정

1) 프로덕션 모드 설정

sudo rpk redpanda mode production

 

2) Linux 커널 조정

sudo rpk redpanda tune all

 

3) 서비스 재시작

sudo systemctl start redpanda-tuner
sudo systemctl enable redpanda-tuner
sudo systemctl start redpanda-tuner

 

6. 최적의 I/O 구성 설정 생성

sudo rpk iotune # takes 10mins

 

 

7. Redpanda Cluster YAML

1) redpanda yaml 수정하기

  • seed_servers :  redpanda cluster  IP, Port
  • advertised_rpc_api  :  자신의 IP
  • advertised_kafka_api :  자신의 IP
vi /etc/redpanda/redpanda.yaml
redpanda:
  data_directory: /var/lib/redpanda/data
  empty_seed_starts_cluster: true
  seed_servers:
    - host:
        address: 192.168.0.130
        port: 33145
    - host:
        address: 192.168.0.131
        port: 33145
    - host:
        address: 192.168.0.132
        port: 33145
  rpc_server:
    address: 0.0.0.0
    port: 33145
  kafka_api:
    - address: 0.0.0.0
      port: 9092
      name: internal
    - address: 0.0.0.0
      port: 19092
      name: external
  admin:
    - address: 0.0.0.0
      port: 9644
  advertised_rpc_api:
    address: 192.168.0.132  ##자신의 서버IP 맞추기
    port: 33145
  advertised_kafka_api:
    - address: 192.168.0.132 ##자신의 서버IP 맞추기
      port: 9092
      name: internal
rpk:
  tune_network: true
  tune_disk_scheduler: true
  tune_disk_nomerges: true
  tune_disk_write_cache: true
  tune_disk_irq: true
  tune_cpu: true
  tune_aio_events: true
  tune_clocksource: true
  tune_swappiness: true
  coredump_dir: /var/lib/redpanda/coredump
  tune_ballast_file: true
pandaproxy: {}
schema_registry: {}

 

 

2) 기존 데이터로 인하여 삭제

sudo systemctl stop redpanda
sudo rm -rf /var/lib/redpanda/data

 

3) 서비스 재시작

systemctl restart redpanda-tuner redpanda

 

8. Redpanda Cluster 

1) Cluster 상태 확인

rpk cluster info

 

 

 

 

 

9. Redpanda Cluter 토픽 테스트

1)  Redpanda Console 확인

  • clutster 토픽에 데이터 테스트

2)  Redpanda Consumer

  • clutster 토픽에 데이터 테스트
  • 테스트는 Python 코드로 테스트

 

3)  Redpanda 클러스터 노드 중지

 

4)  Redpanda 추가 Consumer

  • 데이터 정상 등록되는 거 보니 Cluster는 정상적으로 동작하는 거 같습니다.

 

 

 

반응형

'기타' 카테고리의 다른 글

K8SGPT 구성하기  (0) 2024.11.23
LocalAI 설치  (0) 2024.11.23
[zabbix] zabbix Agent 설치  (2) 2024.11.14
[zabbix] zabbix Server 설치  (1) 2024.11.14
NFS 서버,클라이언트 설치 및 설정  (1) 2024.07.25

댓글