I am trying to follow these instructions for connecting locally to my heroku kafka using kafkacat: https://gist.github.com/crcastle/cb21c2148fc57ad89753bf28b561d910
I am creating an env file like this:
heroku config -s > .env
and then running this script to try to listen
#! /usr/bin/env bash
set -e
source .env
kafkacat -C -t ${KAFKA_PREFIX}test-topic -b $KAFKA_URL \
-X security.protocol=ssl \
-X ssl.key.location=<(echo $KAFKA_CLIENT_CERT_KEY) \
-X ssl.ca.location=<(echo $KAFKA_TRUSTED_CERT) \
-X ssl.certificate.location=<(echo $KAFKA_CLIENT_CERT)
Then I get this error:
% ERROR: Failed to create producer: ssl.ca.location failed: No error
Funny thing is it says producer even though I am trying to consume.
I can produce and consume from the same topic using
heroku kafka:topics:write test-topic "test 1"
and
heroku kafka:topics:tail test-topic
On OSX, I don't think the <(...)
syntax is supported. Try:
heroku config:get KAFKA_TRUSTED_CERT -a my-app > $PWD/ca.pem
heroku config:get KAFKA_CLIENT_CERT -a my-app > $PWD/cert.pem
heroku config:get KAFKA_CLIENT_CERT_KEY -a my-app > $PWD/cert.key
export KAFKA_URL="$(heroku config:get KAFKA_URL -a my-app | sed 's/kafka\+ssl\:\/\///g')"
export TOPIC="my-topic"
kafkacat -C -t $TOPIC -b $KAFKA_URL \
-X security.protocol=ssl \
-X ssl.key.location=$PWD/cert.key \
-X ssl.ca.location=$PWD/ca.pem \
-X ssl.certificate.location=$PWD/cert.pem
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.