You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Peter Horvath (JIRA)" <ji...@apache.org> on 2018/05/02 14:07:00 UTC

[jira] [Created] (KAFKA-6851) Kafka CLI commands should support specifying the servers in environment variables

Peter Horvath created KAFKA-6851:
------------------------------------

             Summary: Kafka CLI commands should support specifying the servers in environment variables
                 Key: KAFKA-6851
                 URL: https://issues.apache.org/jira/browse/KAFKA-6851
             Project: Kafka
          Issue Type: New Feature
          Components: clients
    Affects Versions: 1.0.1, 1.1.0, 1.0.0
         Environment: ALL
            Reporter: Peter Horvath


Currently, different Kafka CLI commands require specifying different servers as argument (--broker-list, --bootstrap-server and --zookeeper).

 

This is kind of tedious as different CLI commands require specifying different servers, which is especially painful if the host names are *long*, and *only slightly different* (e.g. naming scheme for AWS: ec2-12-34-56-2.region-x.compute.amazonaws.com). 

 
I know I could simply export shell variables for each type of endpoint and refer that in the command, but that still only eases the pain:
export KAFKA_ZK=[ec2-12-34-56-2.region-x.compute.amazonaws.com|http://ec2-12-34-56-2.region-x.compute.amazonaws.com/]
bin/kafka-topics.sh --list --zookeeper ${KAFKA_ZK}
 
According to [some conversation on the Kafka mailing list|http://mail-archives.apache.org/mod_mbox/kafka-users/201804.mbox/%3CCA+UsspAG21mWufR146_hLVDYfTuzjM4ZfN1c5TnFjugJxagh7Q@mail.gmail.com%3E] (started by me), people usually resort to some kind of non-standardised work-arounds (see replies to thread _Using Kafka CLI without specifying the URLs every single time?_)
 
 
When dealing with Kafka client CLI, it would be huge relief / productivity boost if the CLI could pick up the servers from the user's environment variables.

For example, instead of using --broker-list, --bootstrap-server or --zookeeper, the Kafka client commands could check if there is an environment variable and use that in case the argument is missing. (allowing the environment-defined server to still be overridden with an *explicit* argument).

 

I propose introducing some kind of specific environment variables that would allow the user to omit the explicit specification of the --broker-list, --bootstrap-server and --zookeeper argument every single time a CLI command is called. This would make using Kafka CLI much easier. 

 
||CLI argument||Proposed environment variable name||
|--broker-list|KAFKA_CLIENT_BROKER_LIST|
|--bootstrap-server|KAFKA_CLIENT_BOOTSTRAP_SERVER|
|--zookeeper|KAFKA_CLIENT_ZOOKEEPER|

It should be possible to implement this solely at the wrapper shell script level, with some checks being done that test if the variable is defined or not.

 

 

 

 

 

 

 
 
 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)