본문 바로가기
실시간 데이터 수집

실시간 데이터 수집-2 (AWS에서 Confluent 설치)

by Sunyoung95 2024. 2. 11.
실제로 Confluent를 서버에 설치해본다.
리소스 한계상 Standalone 버전으로 진행했다.

 

설치 환경

서버

  • aws ec2 : t2.xlarge 유형

OS / 소프트웨어 버전

S/W Version
Ubuntu 20.04.6
JAVA 11
Confluent - Community 7.6.0

 

JAVA 설치

java 17 버전 설치시 아래 에러발생
Error: the Confluent CLI requires Java version 1.8 or 1.11.
See https://docs.confluent.io/current/installation/versions-interoperability.html .
If you have multiple versions of Java installed, you may need to set JAVA_HOME to the version you want Confluent to use.​
Confluent 7.2.x 버전이상에서 지원하는 JAVA  1.11버전을 설치한다
$ sudo apt-get update && sudo apt-get upgrade
$ sudo apt-get install openjdk-11-jdk
  • 설치한 JAVA 버전 확인
$ java --version
  • 환경변수 설정
$ sudo vi ~/.bashrc

###########################가장 하단에 추가###################################
export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java))))
export PATH=$PATH:$JAVA_HOME/bin
##############################################################

$ source ~/.bashrc
$ echo $JAVA_HOME
  • 설치한 JAVA 삭제
$ sudo apt remove openjdk-11-jdk

 

Confluent 설치

$ mkdir ~/confluent
$ cd ~/confluent
  • tar file 받기 및 압축풀기
$ curl -O https://packages.confluent.io/archive/7.6/confluent-7.6.0.tar.gz
$ tar xzf confluent-7.6.0.tar.gz
  • 압축 푼 폴더에 들어가서 하단의 폴더들이 있는지 확인
    • bin : 서비스를 start / stop 할 수 있는 스크립트 존재
    • etc : configuration 파일이 존재
    • lib : Systemd services
    • libexec : Platform의 CLI 바이너리 파일 존재
    • share : Jar 파일들과 라이센스 존재 
    • src : Platform 설치에 필요한 소스파일들 존재
  • 환경변수 설정 및 확인
$ export CONFLUENT_HOME=/home/ubuntu/confluent/confluent-7.6.0
$ export PATH=$PATH:$CONFLUENT_HOME/bin
$ confluent --help
  • server 재부팅 시 topic 유지 하도록 설정 변경 (log.dirs설정 변경)
$ vi /home/ubuntu/confluent/confluent-7.6.0/etc/kafka/server.properties
=======================================================================
...
############################# Log Basics #############################

# A comma separated list of directories under which to store log files
#log.dirs=/tmp/kafka-logs
log.dirs=/home/ubuntu/confluent/kafka-logs
...
wq!
  • Confluent service 시작
$ confluent local services start

 

서버 재부팅시 자동실행 설정

  • 서버 재부팅 시 실행할 스크립트 작성
    • 재부팅시 환경변수가 잡히지 않은 상태로 시작하기 때문에 환경변수를 선언한 뒤 실행해주어야한다.
$ cat /etc/rc.local
=====================================================
#!/bin/bash

export CONFLUENT_HOME=/home/ubuntu/confluent/confluent-7.6.0

/home/ubuntu/confluent/confluent-7.6.0/bin/confluent local services start

exit 0
  • 실행권한 부여
$ sudo chmod +x /etc/rc.local
  • 실행레벨 수정
    • 가장 하단에 [Install] 섹션추가 
$ sudo vi /lib/systemd/system/rc-local.service

#  SPDX-License-Identifier: LGPL-2.1+
#
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

# This unit gets pulled automatically into multi-user.target by
# systemd-rc-local-generator if /etc/rc.local is executable.
[Unit]
Description=/etc/rc.local Compatibility
Documentation=man:systemd-rc-local-generator(8)
ConditionFileIsExecutable=/etc/rc.local
After=network.target

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
RemainAfterExit=yes
GuessMainPID=no

[Install]
WantedBy=multi-user.target
  • re-local 서비스 등록 및 자동실행 설정
$ sudo systemctl start re-local.service
$ sudo systemctl enable re-local.service
$ sudo systemctl status re-local.service

 

AWS EC2 포트설정 

  • ec2의 보안 탭에서 설정되어있는 보안그룹의 인바운드 규칙을 수정한다.

 

  • 인바운드 규칙에서 다음과 같이 포트 설정 추가 (어떤 포트를 열어줘야하는지 좀 더 조사 필요)
유형 프로토콜 포트범위 소스   설명
사용자 지정 TCP TCP 9091 사용자 지정 0.0.0.0/0 Interbroker listener
사용자 지정 TCP TCP 2181 사용자 지정 0.0.0.0/0 Client access
사용자 지정 TCP TCP 2888 사용자 지정 0.0.0.0/0 Peer-to-peer communication
사용자 지정 TCP TCP 2182 사용자 지정 0.0.0.0/0 Client access via TLS
사용자 지정 TCP TCP 8090 사용자 지정 0.0.0.0/0 Confluent Server REST API
사용자 지정 TCP TCP 3888 사용자 지정 0.0.0.0/0 Peer-to-peer communication
사용자 지정 TCP TCP 9092 사용자 지정 0.0.0.0/0 External listener
사용자 지정 TCP TCP 9021 사용자 지정 0.0.0.0/0 Control Center

 

Control Center 접근

  • 접근 주소 : http://<ec2 퍼블릭 IPv4 DNS>:9021

 

 

S/W 별 사용 메모리 / CPU

Confluent만 구성한다고 한다면 2core 8G 환경에서도 충분히 올릴 수 있을 듯하다.
S/W Xms Xmx Total
Zookeeper 512MB 512MB 512M
Kafka 1GB 1GB 1G
Schema Registry (50MB) 512MB 512M
Kafka REST (50MB) 256MB 256M
Connect 256MB 2GB 2G
ksqlDB (50MB) 3GB 3G
Control Center (50MB) 6GB 6G
메모리 총합 약 2GB 13.25GB 13.25GB
  • confluent를 실행만 했을 때는 16GB 서버기준으로 약 10GB가 free memory로 확인되었다.(기본적인 가동에 약 6GB!!)
    • 이후에 추가적인 어플리케이션을 올릴 수 있을 듯 하다!
  • CPU는 약 10%정도만 사용되고 있었다.

참조

https://languagestory.tistory.com/154

 

Ubuntu JDK(JAVA Development Kit) 17 설치

1. 시험환경 · Ubuntu 20.04 x64 · openjdk-amd64 v17 2. 목적 · Ubuntu 환경에서 JDK를 설치한다. · 설치한 JDK 환경을 설정한다. 3. 적용 ① sudo 권한으로 apt 업데이트하고 openjdk v17을 설치한다. - $ sudo apt update

languagestory.tistory.com

https://docs.confluent.io/platform/current/installation/installing_cp/zip-tar.html#configure-confluent-home

 

Install Confluent Platform using ZIP and TAR Archives | Confluent Documentation

Start Confluent Platform by using Kafka CLI commands. Tip In ZooKeeper mode, ZooKeeper must be started first. Kafka, and Schema Registry must be started in this order, and must be started after ZooKeeper, if you are using it, and before any other component

docs.confluent.io

https://docs.confluent.io/platform/current/installation/system-requirements.html#ports

 

Confluent Platform System Requirements | Confluent Documentation

The following machine recommendations are for installing individual Confluent Platform components: Note If deploying Confluent Platform on AWS VMs and running Replicator as a connector, be aware that VMs with burstable CPU types (T2, T3, T3a, and T4g) will

docs.confluent.io

댓글