As Kafka audit system, Chaperone monitors the completeness and latency of data stream. The audit metrics are persisted in database for Kafka users to quantify the loss of their topics if any.
Basically, Chaperone cuts timeline into 10min buckets and assigns message to corresponding bucket according to its event time. The stats of the bucket are updated accordingly, like the total message count. Periodically, the stats are sent out to a dedicated Kafka topic, say 'chaperone-audit'. ChaperoneCollector consumes those stats from this topic and persists them into database.
Chaperone is made of several components:
Check out the Chaperone project:
git clone git@github.com:uber/chaperone.git cd chaperone
This project contains everything you’ll need to run Chaperone.
Before you can run Chaperone, you need to build a package for it.
mvn clean package
Or command below to skip tests
mvn clean package -DskipTests
To test Chaperone locally, you need two systems: Kafka , and ZooKeeper . The script “grid” is to help you set up these systems.
bin/grid bootstrap
./ChaperoneDistribution/target/ChaperoneDistribution-pkg/bin/start-chaperone-controller.sh
./ChaperoneDistribution/target/ChaperoneDistribution-pkg/bin/start-chaperone-worker.sh
./bin/produce-data-to-kafka-topic-dummyTopic.sh
./deploy/kafka/bin/kafka-console-consumer.sh --zookeeper localhost:2181/cluster1 --topic dummyTopic
You should get this data:
Kafka topic dummy topic data 1 Kafka topic dummy topic data 2 Kafka topic dummy topic data 3 Kafka topic dummy topic data 4 …
In this example, the topic dummyTopic will be auto-detected and assigned to worker to audit. Periodically, the audit stats are sent to a topic called 'chaperone-audit'.
./deploy/kafka/bin/kafka-console-consumer.sh --zookeeper localhost:2181/cluster1 --topic chaperone-audit
One can also manually add topic to audit by command below:
curl -X POST -d '{"topic":"dummyTopic", "numPartitions":"1"}' http://localhost:9000/topics
To start ChaperoneCollector, MySQL is required and Redis is optional. MySQL is used to persist audit stats and Redis is used to deduplicate. Deduplication can be turned off. The configuration file for ChaperoneCollector is ./config/chaperonecollector.properties, which might be updated to connect to MySQL and Redis.
./ChaperoneDistribution/target/ChaperoneDistribution-pkg/bin/start-chaperone-collector.sh