IBM developer:Setting up the Kafka plugin for Ranger
Follow these steps to enable and configure the Kafka plugin for Ranger.
Before you begin
Procedure
Example
The following is an example of how to use the Kafka Ranger plugin for authorization:
- Ensure that the default policy created when the plugin is enabled is enabled and synced.
- Ensure that Kerberos tickets are not expired by using the kinit command as the kafka user.
- Run the following command to create a topic in Kafka. Run the command as the kafka user and from the /usr/iop/current/kafka-broker/ directory:
bin/kafka-topics.sh --create --zookeeper hostname.fyre.ibm.com:2181 --replication-factor 1 --partitions 1 --topic test-topic
- Create files named producer.properties and consumer.properties, each with a single line with the value security.protocol=SASL_PLAINTEXT.
- Run the following command to start the producer. Run the command as the kafka user and from the /usr/iop/current/kafka-broker/ directory:
bin/kafka-console-producer.sh --broker-list <cluster url>:6667 --topic test-topic --producer.config <path>/producer.properties
- In another window, run the following command to start the consumer. Run the command as the root user and from the /usr/iop/current/kafka-broker/ directory:
bin/kafka-console-consumer.sh --topic test-topic --from-beginning --bootstrap-server <cluster url>:6667 --consumer.config <path>/consumer.properties
- In the producer window, write some test messages and observe that they appear in the consumer window.
- Disable the policy and observe that error messages show up in both windows that they can no longer connect.
- Re-enable the policy and observe that messages can be sent and received properly again.
欢迎关注微信公众号:大数据从业者