-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sarama to Kafka communication failure if ssl enabled in kafka #858
Comments
I don't really have anything I can add to this message. Are you sure you're connecting to the right port on the broker, and that the broker has TLS enabled? What do the logs from the broker say? |
Yup, this looks like a misconfigured broker, or you are connecting to the non-SSL port. |
I am also with this error and I am sure is connecting to the correct port. I can verify this with |
I'm seeing the same issue. I've enabled SSL in Kafka's
I can connect to the server just fine using the console consumer:
Where
And
I tried to now connect to the exact same Kafka server with sarama: caCert, err := ioutil.ReadFile("ca-cert.pem")
if err != nil {
// ...
}
caCertPool := x509.NewCertPool()
caCertPool.AppendCertsFromPEM(caCert)
tlsConfig := &tls.Config{
RootCAs: caCertPool,
InsecureSkipVerify: true,
}
config := sarama.NewConfig()
config.Producer.Return.Successes = true
config.Producer.Return.Errors = true
config.Net.TLS.Config = tlsConfig
config.Net.TLS.Enable = true
producer, err := sarama.NewSyncProducer(serverIps, config) This gives me the error:
|
After a lot more digging, I found the solution: as explained in #643, you need to set |
Thanks for digging into this @brikis98. I've added this problem/solution to the FAQ so hopefully it's a little more visible the next time somebody runs into trouble. |
Am facing similar kind off error : WARN kafka message: client/metadata got error from broker while fetching metadata:%!(EXTRA sarama.PacketDecodingError=kafka: error decoding packet: message of length 1213486160 too large or too small) |
Versions
Please specify real version numbers or git SHAs, not just "Latest" since that changes fairly regularly.
Sarama Version: 9a9e66f
Kafka Version: 0.10.1.1
Go Version: 1.7
Configuration
What configuration values are you using for Sarama and Kafka?
t = &tls.Config{
Certificates: []tls.Certificate{cert},
InsecureSkipVerify: true,
}
cert will be populated with this
cert, err := tls.LoadX509KeyPair(*certFile, *keyFile)
Logs
[sarama]2017/03/31 08:48:18 Initializing new client
[sarama]2017/03/31 08:48:18 ClientID is the default of 'sarama', you should consider setting it to something application-specific.
[sarama]2017/03/31 08:48:18 ClientID is the default of 'sarama', you should consider setting it to something application-specific.
[sarama]2017/03/31 08:48:18 client/metadata fetching metadata for all topics from broker datapipeline-perf-01-us-east-1-kafka-03.sse.com:9093
[sarama]2017/03/31 08:48:18 Failed to connect to broker datapipeline-perf-01-us-east-1-kafka-03.sse.com:9093: tls: first record does not look like a TLS handshake
[sarama]2017/03/31 08:48:18 client/metadata got error from broker while fetching metadata: tls: first record does not look like a TLS handshake
[sarama]2017/03/31 08:48:18 client/metadata no available broker to send metadata request to
[sarama]2017/03/31 08:48:18 client/brokers resurrecting 1 dead seed brokers
[sarama]2017/03/31 08:48:18 client/metadata retrying after 250ms... (3 attempts remaining)
[sarama]2017/03/31 08:48:19 ClientID is the default of 'sarama', you should consider setting it to something application-specific.
[sarama]2017/03/31 08:48:19 client/metadata fetching metadata for all topics from broker datapipeline-perf-01-us-east-1-kafka-03.sse.com:9093
[sarama]2017/03/31 08:48:19 Failed to connect to broker datapipeline-perf-01-us-east-1-kafka-03.sse.com:9093: tls: first record does not look like a TLS handshake
[sarama]2017/03/31 08:48:19 client/metadata got error from broker while fetching metadata: tls: first record does not look like a TLS handshake
[sarama]2017/03/31 08:48:19 client/metadata no available broker to send metadata request to
[sarama]2017/03/31 08:48:19 client/brokers resurrecting 1 dead seed brokers
[sarama]2017/03/31 08:48:19 client/metadata retrying after 250ms... (2 attempts remaining)
[sarama]2017/03/31 08:48:19 ClientID is the default of 'sarama', you should consider setting it to something application-specific.
[sarama]2017/03/31 08:48:19 client/metadata fetching metadata for all topics from broker datapipeline-perf-01-us-east-1-kafka-03.sse.com:9093
[sarama]2017/03/31 08:48:19 Failed to connect to broker datapipeline-perf-01-us-east-1-kafka-03.sse.com:9093: tls: first record does not look like a TLS handshake
[sarama]2017/03/31 08:48:19 client/metadata got error from broker while fetching metadata: tls: first record does not look like a TLS handshake
[sarama]2017/03/31 08:48:19 client/metadata no available broker to send metadata request to
[sarama]2017/03/31 08:48:19 client/brokers resurrecting 1 dead seed brokers
[sarama]2017/03/31 08:48:19 client/metadata retrying after 250ms... (1 attempts remaining)
[sarama]2017/03/31 08:48:19 ClientID is the default of 'sarama', you should consider setting it to something application-specific.
[sarama]2017/03/31 08:48:19 client/metadata fetching metadata for all topics from broker datapipeline-perf-01-us-east-1-kafka-03.sse.com:9093
[sarama]2017/03/31 08:48:19 Failed to connect to broker datapipeline-perf-01-us-east-1-kafka-03.sse.com:9093: tls: first record does not look like a TLS handshake
[sarama]2017/03/31 08:48:19 client/metadata got error from broker while fetching metadata: tls: first record does not look like a TLS handshake
[sarama]2017/03/31 08:48:19 client/metadata no available broker to send metadata request to
[sarama]2017/03/31 08:48:19 client/brokers resurrecting 1 dead seed brokers
[sarama]2017/03/31 08:48:19 Closing Client
ERRO[0000] [ip-10-4-11-11][kafka.go:78 main:sendMessage] Failed to connect Sarama producer:%!(EXTRA *errors.errorString=kafka: client has run out of available brokers to talk to (Is your cluster reachable?))
kafka: client has run out of available brokers to talk to (Is your cluster reachable?)
Problem Description
When we enable ssl in kafka, communication is broken between sarama to kafka.
Logs are provided above
The text was updated successfully, but these errors were encountered: