abstractdog commented on code in PR #4385:
URL: https://github.com/apache/hive/pull/4385#discussion_r1221234901
##########
kafka-handler/src/test/org/apache/hadoop/hive/kafka/KafkaBrokerResource.java:
##########
@@ -64,7 +81,25 @@ class KafkaBrokerResource extends ExternalResource {
brokerProps.setProperty("zookeeper.connect", zkConnect);
brokerProps.setProperty("broker.id", "0");
brokerProps.setProperty("log.dir", tmpLogDir.toString());
- brokerProps.setProperty("listeners", "PLAINTEXT://" + BROKER_IP_PORT);
+ Map<String, BrokerListener> listeners = new HashMap<>();
+ listeners.put("L1", new BrokerListener(BROKER_IP_PORT, "PLAINTEXT"));
+ if (principal != null) {
+ listeners.put("L2", new BrokerListener(BROKER_SASL_PORT,
"SASL_PLAINTEXT"));
+ }
+ String listenersURLs = listeners.entrySet().stream().map((e) -> e.getKey()
+ "://" + e.getValue().url)
+ .collect(Collectors.joining(","));
+ brokerProps.setProperty("listeners", listenersURLs);
+ String listenersProtocols = listeners.entrySet().stream().map((e) ->
e.getKey() + ":" + e.getValue().protocol)
+ .collect(Collectors.joining(","));
+ brokerProps.setProperty("listener.security.protocol.map",
listenersProtocols);
+ brokerProps.setProperty("inter.broker.listener.name", "L1");
+ if (principal != null) {
+ String jaasConfig = String.format("%s %s %s %s serviceName=\"%s\"
keyTab=\"%s\" principal=\"%s\";",
+ "com.sun.security.auth.module.Krb5LoginModule required",
"debug=true", "useKeyTab=true", "storeKey=true",
+ principal, keytab, principal + "/localhost");
+ brokerProps.setProperty("listener.name.l2.gssapi.sasl.jaas.config",
jaasConfig);
Review Comment:
what is this prop used for? is a test-only thing or should be used in
production too?
just asking, I cannot remember we've ever used it
##########
kafka-handler/src/test/org/apache/hadoop/hive/kafka/KafkaBrokerResource.java:
##########
@@ -64,7 +81,25 @@ class KafkaBrokerResource extends ExternalResource {
brokerProps.setProperty("zookeeper.connect", zkConnect);
brokerProps.setProperty("broker.id", "0");
brokerProps.setProperty("log.dir", tmpLogDir.toString());
- brokerProps.setProperty("listeners", "PLAINTEXT://" + BROKER_IP_PORT);
+ Map<String, BrokerListener> listeners = new HashMap<>();
+ listeners.put("L1", new BrokerListener(BROKER_IP_PORT, "PLAINTEXT"));
+ if (principal != null) {
+ listeners.put("L2", new BrokerListener(BROKER_SASL_PORT,
"SASL_PLAINTEXT"));
+ }
+ String listenersURLs = listeners.entrySet().stream().map((e) -> e.getKey()
+ "://" + e.getValue().url)
+ .collect(Collectors.joining(","));
+ brokerProps.setProperty("listeners", listenersURLs);
+ String listenersProtocols = listeners.entrySet().stream().map((e) ->
e.getKey() + ":" + e.getValue().protocol)
+ .collect(Collectors.joining(","));
+ brokerProps.setProperty("listener.security.protocol.map",
listenersProtocols);
+ brokerProps.setProperty("inter.broker.listener.name", "L1");
+ if (principal != null) {
+ String jaasConfig = String.format("%s %s %s %s serviceName=\"%s\"
keyTab=\"%s\" principal=\"%s\";",
+ "com.sun.security.auth.module.Krb5LoginModule required",
"debug=true", "useKeyTab=true", "storeKey=true",
+ principal, keytab, principal + "/localhost");
+ brokerProps.setProperty("listener.name.l2.gssapi.sasl.jaas.config",
jaasConfig);
Review Comment:
what is this prop used for? is it a test-only thing or should be used in
production too?
just asking, I cannot remember we've ever used it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]