[ 
https://issues.apache.org/jira/browse/AMBARI-21275?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Axton Grams updated AMBARI-21275:
---------------------------------
    Fix Version/s: trunk
           Status: Patch Available  (was: Open)

diff --git 
a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/kafka.py
 b/ambari-server/src/main/resources/common-services/
index 680dd32..1327090 100644
--- 
a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/kafka.py
+++ 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/kafka.py
@@ -80,16 +80,21 @@ def kafka(upgrade_type=None):

        listeners = kafka_server_config['listeners'].replace("localhost", 
params.hostname)
        Logger.info(format("Kafka listeners: {listeners}"))
-       kafka_server_config['listeners'] = listeners

        if params.security_enabled and params.kafka_kerberos_enabled:
          Logger.info("Kafka kerberos security is enabled.")
+         if "SASL" not in listeners:
+           listeners = listeners.replace("PLAINTEXT", "PLAINTEXTSASL")
+
+         kafka_server_config['listeners'] = listeners
          kafka_server_config['advertised.listeners'] = listeners
          Logger.info(format("Kafka advertised listeners: {listeners}"))
-       elif 'advertised.listeners' in kafka_server_config:
-         advertised_listeners = 
kafka_server_config['advertised.listeners'].replace("localhost", 
params.hostname)
-         kafka_server_config['advertised.listeners'] = advertised_listeners
-         Logger.info(format("Kafka advertised listeners: 
{advertised_listeners}"))
+       else:
+         kafka_server_config['listeners'] = listeners
+         if 'advertised.listeners' in kafka_server_config:
+           advertised_listeners = 
kafka_server_config['advertised.listeners'].replace("localhost", 
params.hostname)
+           kafka_server_config['advertised.listeners'] = advertised_listeners
+           Logger.info(format("Kafka advertised listeners: 
{advertised_listeners}"))
     else:
       kafka_server_config['host.name'] = params.hostname

> Kafka advertised.listeners can't be configured when security is enabled
> -----------------------------------------------------------------------
>
>                 Key: AMBARI-21275
>                 URL: https://issues.apache.org/jira/browse/AMBARI-21275
>             Project: Ambari
>          Issue Type: Bug
>          Components: ambari-sever
>    Affects Versions: 2.4.2
>            Reporter: Axton Grams
>              Labels: kafka
>             Fix For: trunk
>
>         Attachments: kafka.py.patch
>
>
> When running Kafka Broker on a multi-homed, secure (kerberized) host, it is 
> necessary to set the following configuration parameters:
> advertised.listeners=PLAINTEXTSASL://host.domain.tld:6667
> listeners=PLAINTEXTSASL://0.0.0.0:6667
> This configuration is not achievable due to limitations of the Ambari Server 
> scripts that generate the Kafka Broker configuration file.
> The attached patch corrects this issue.  The patch does a few things:
> - maintains consistency in behavior in updating protocol in 
> advertised.listeners to match the behavior of existing parameter, 'listeners'
> - sets advertised.listeners to the listeners if it is not defined in Ambari
> - replaces the literal 'localhost' with the actual hostname; this is 
> consistent with the behavior of the existing parameter, 'listeners'



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to