13장. Kafka 클러스터에 대한 클라이언트 액세스 설정
AMQ Streams를 배포한 후 Kafka 클러스터에 대한 클라이언트 액세스를 설정할 수 있습니다. 배포를 확인하려면 예제 생산자 및 소비자 클라이언트를 배포할 수 있습니다. 그렇지 않으면 OpenShift 클러스터 내부 또는 외부의 클라이언트 액세스를 제공하는 리스너를 생성합니다.
13.1. 예제 클라이언트 배포 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
메시지를 보내고 받기 위해 생산자 및 소비자 클라이언트 예제를 배포합니다. 이러한 클라이언트를 사용하여 AMQ Streams 배포를 확인할 수 있습니다.
사전 요구 사항
- Kafka 클러스터는 클라이언트에서 사용할 수 있습니다.
프로세스
Kafka 생산자를 배포합니다.
oc run kafka-producer -ti --image=registry.redhat.io/amq-streams/kafka-36-rhel8:2.6.0 --rm=true --restart=Never -- bin/kafka-console-producer.sh --bootstrap-server cluster-name-kafka-bootstrap:9092 --topic my-topic
oc run kafka-producer -ti --image=registry.redhat.io/amq-streams/kafka-36-rhel8:2.6.0 --rm=true --restart=Never -- bin/kafka-console-producer.sh --bootstrap-server cluster-name-kafka-bootstrap:9092 --topic my-topicCopy to Clipboard Copied! Toggle word wrap Toggle overflow - 생산자가 실행 중인 콘솔에 메시지를 입력합니다.
- Enter 를 눌러 메시지를 보냅니다.
Kafka 소비자를 배포합니다.
oc run kafka-consumer -ti --image=registry.redhat.io/amq-streams/kafka-36-rhel8:2.6.0 --rm=true --restart=Never -- bin/kafka-console-consumer.sh --bootstrap-server cluster-name-kafka-bootstrap:9092 --topic my-topic --from-beginning
oc run kafka-consumer -ti --image=registry.redhat.io/amq-streams/kafka-36-rhel8:2.6.0 --rm=true --restart=Never -- bin/kafka-console-consumer.sh --bootstrap-server cluster-name-kafka-bootstrap:9092 --topic my-topic --from-beginningCopy to Clipboard Copied! Toggle word wrap Toggle overflow - 소비자 콘솔에 들어오는 메시지가 표시되는지 확인합니다.