Skip to content
This repository was archived by the owner on Dec 11, 2023. It is now read-only.

3. Test drive

Torstein Nesby edited this page May 4, 2018 · 3 revisions

Prerequsite

Configuration as described on previous 2 pages are completed and LDAP server running on port 11636 (LDAPS).

Each section and topic management below should have their own terminal window.

Kafka

  1. Go to <confluent>/bin

Start kafka environment (Zookeeper, 1 kafka broker and 1 schema registry) ./confluent start

  1. Create a topic and define access control list

Create topic

./kafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test

Define producer access, all users in LDAP group ktprodTest

./kafka-acls --authorizer-properties zookeeper.connect=localhost:2181 --add --allow-principal User:ktprodTest --producer --topic test

Define consumer access, all users in LDAP group ktconsTest

./kafka-acls --authorizer-properties zookeeper.connect=localhost:2181 --add --allow-principal User:ktconsTest --consumer --topic test --group *

The kafka environment has some tools for easy testing, see the following sections

kafka-console-consumer

  1. Create a new consumer.properties file in ./etc/kafka

Content

security.protocol=SASL_PLAINTEXT
sasl.mechanism=PLAIN
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required \
    username="srvkafkaconsumer" \
    password="consumer";

# consumer group id
group.id=test-srvkafkaconsumer-grp
client.id=srvkafkaconsumer

# list of brokers used for bootstrapping knowledge about the rest of the cluster
# format: host1:port1,host2:port2 ...
bootstrap.servers=localhost:9092

  1. Start the consumer
./kafka-console-consumer --bootstrap-server localhost:9092 --topic test --consumer.config ./../etc/kafka/consumer.properties 

kafka-console-producer

  1. Create a new producer.properties file in ./etc/kafka

Content

security.protocol=SASL_PLAINTEXT
sasl.mechanism=PLAIN

sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required \
    username="srvkafkaproducer3" \
    password="producer3";

# list of brokers used for bootstrapping knowledge about the rest of the cluster
# format: host1:port1,host2:port2 ...
bootstrap.servers=localhost:9092

# specify the compression codec for all data generated: none, gzip, snappy, lz4
compression.type=none
  1. Start the producer
./kafka-console-producer --broker-list localhost:9092 --topic test --producer.config ./../etc/kafka/producer.properties 

Now you can type whatever, press enter and whatever will show up in the consumer window.

Clone this wiki locally