-
-
Notifications
You must be signed in to change notification settings - Fork 98
/
실습 커맨드 리스트.txt
50 lines (40 loc) · 2.57 KB
/
실습 커맨드 리스트.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Apache Kafka 입문과 활용
# EC2 카프카 설치, 실행
1 chmod 400 test-kafka.pem
2 ssh -i kafka-test.pem ec2-user@{aws ec2 public ip}
3 sudo yum install -y java-1.8.0-openjdk-devel.x86_64
4 wget https://downloads.apache.org/kafka/2.7.0/kafka_2.12-2.7.0.tgz
5 export KAFKA_HEAP_OPTS="-Xmx400m -Xms400m"
6 vi config/server.properties
7 listeners=PLAINTEXT://:9092
8 advertised.listeners=PLAINTEXT://{aws ec2 public ip}:9092
9 bin/zookeeper-server-start.sh -daemon config/zookeeper.properties
10 bin/kafka-server-start.sh -daemon config/server.properties
11 tail -f logs/*
# Local(macOS) 설치 및 CLI 실행
12 curl https://archive.apache.org/dist/kafka/2.5.0/kafka_2.13-2.5.0.tgz --output kafka.tgz
13 tar -xvf kafka.tgz
14 cd kafka_2.13-2.5.0/bin
15 ./kafka-topics.sh --create --bootstrap-server {aws ec2 public ip}:9092 --replication-factor 1 --partitions 3 --topic test
16 ./kafka-console-producer.sh --bootstrap-server {aws ec2 public ip}:9092 --topic test
17 ./kafka-console-consumer.sh --bootstrap-server {aws ec2 public ip}:9092 --topic test --from-beginning
18 ./kafka-console-consumer.sh --bootstrap-server {aws ec2 public ip}:9092 --topic test -group testgroup --from-beginning
19 ./kafka-consumer-groups.sh --bootstrap-server {aws ec2 public ip}:9092 --list
20 ./kafka-consumer-groups.sh --bootstrap-server {aws ec2 public ip}:9092 --group testgroup --describe
21 ./kafka-consumer-groups.sh --bootstrap-server {aws ec2 public ip}:9092 --group testgroup --topic test --reset-offsets --to-earliest --execute
22 ./kafka-consumer-groups.sh --bootstrap-server {aws ec2 public ip}:9092 --group testgroup --topic test:1 --reset-offsets --to-offset 10 --execute
# 카프카 프로듀서 실습 및 실행
23 git clone https://github.com/AndersonChoi/tacademy-kafka.git
24 ./kafka-console-consumer.sh --bootstrap-server {aws ec2 public ip}:9092 --topic test --property print.key=true --property key.separator="-"
# 홈브루 설치
25 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
# 텔레그래프 설치
26 brew install telegraf
또는 https://drive.google.com/file/d/1iRbOjRvHpEnzbezjdifRWDTOrrD2iDag/view?usp=sharing
27 telegraf -config telegraf.conf
또는 ./telegraf -config telegraf.conf
# 카프카 활용 실습 토픽 생성
28 ./kafka-topics.sh --create --bootstrap-server {aws ec2 public ip}:9092 --replication-factor 1 --partitions 5 --topic my-computer-metric
# 카프카 활용 실습 토픽 데이터 확인
29 ./kafka-console-consumer.sh --bootstrap-server {aws ec2 public ip}:9092 --topic my-computer-metric --from-beginning
30 tail -f *.csv