[ 
https://issues.apache.org/jira/browse/AMBARI-21275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16355658#comment-16355658
 ] 

Greg Senia commented on AMBARI-21275:
-------------------------------------

[~omkreddy] qq does the patch in AMBARI-20908 handle specifically keeping 
consistency in advertised.listeners vs listeners?

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'

Example of patch:

 

diff -Naur 
/var/lib/ambari-server/resources/common-services/KAFKA/0.8.1/package/scripts/kafka.py
 /tmp/kafka.py 

--- 
/var/lib/ambari-server/resources/common-services/KAFKA/0.8.1/package/scripts/kafka.py
 2018-01-04 17:57:42.000000000 -0500

+++ /tmp/kafka.py 2018-02-07 11:16:31.163448198 -0500

@@ -58,8 +58,15 @@

            listeners = listeners.replace("PLAINTEXT", "PLAINTEXTSASL")

 

          kafka_server_config['listeners'] = listeners

-         kafka_server_config['advertised.listeners'] = listeners

-         Logger.info(format("Kafka advertised listeners: \{listeners}"))

+         if 'advertised.listeners' in kafka_server_config:

+           advertised_listeners = 
kafka_server_config['advertised.listeners'].replace("localhost", 
params.hostname)

+           if "SASL" not in advertised_listeners:

*+             advertised_listeners = advertised_listeners.replace("PLAINTEXT", 
"PLAINTEXTSASL")*

+

+           kafka_server_config['advertised.listeners'] = advertised_listeners

+         else:

+           kafka_server_config['advertised.listeners'] = listeners

+         Logger.info(format("Kafka advertised listeners: 
\{advertised_listeners}"))

        else:

          kafka_server_config['listeners'] = listeners

          if 'advertised.listeners' in kafka_server_config:

> 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
>            Priority: Major
>              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
(v7.6.3#76005)

Reply via email to