[
https://issues.apache.org/jira/browse/KAFKA-1654?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14204442#comment-14204442
]
Jarek Jarcec Cecho commented on KAFKA-1654:
-------------------------------------------
Thank you for your additional feedback [~nehanarkhede]! Good pointer to
{{CommandLineUtils}} class -I've updated my patch to use this class and it's
{{printUsageAndDie}} and {{parseKeyValueArgs}} methods. Using the util class
has simplified the main code, but imposed a challenge on test side as those
methods are directly calling {{System.exit()}}. After some googling I've solved
that problem by introducing {{SecurityManager}} that will intercept the
{{System.exit}} call and thrown an unchecked exception that can be verified by
junit.
To answer your specific points:
{quote}
The usage command says "USAGE: java \[options\] %s \[kafka options\]
server.properties", but in order for the kafka options to take effect you also
need to use --set
{quote}
I've updated the message to explicitly state that I'm expecting list of
arguments ({{\[--override key-value\]*}}) rather then using the generic term
{{kafka options}}.
{quote}
If you leave set out, it doesn't error out saying that --set is required and
silently does not end up overriding the property value
{quote}
I've added unit tests to ensure that the only allowed input is to have (list
of) parameter {{--override}} followed by one property that should be overridden.
{quote}
Can you use CommandLineUtils.printUsageAndDie()?
{quote}
Done.
> Provide a way to override server configuration from command line
> ----------------------------------------------------------------
>
> Key: KAFKA-1654
> URL: https://issues.apache.org/jira/browse/KAFKA-1654
> Project: Kafka
> Issue Type: Improvement
> Components: core
> Affects Versions: 0.8.1.1
> Reporter: Jarek Jarcec Cecho
> Assignee: Jarek Jarcec Cecho
> Fix For: 0.8.3
>
> Attachments: KAFKA-1654.patch, KAFKA-1654.patch
>
>
> I've been recently playing with Kafka and I found the current way of server
> configuration quite inflexible. All the configuration options have to be
> inside a properties file and there is no way how they can be overridden for
> execution. In order to temporarily change one property I had to copy the
> config file and change the property there. Hence, I'm wondering if people
> would be open to provide a way how to specify and override the configs from
> the command line when starting Kafka?
> Something like:
> {code}
> ./bin/kafka-server-start.sh -Dmy.cool.property=X kafka.properties
> {code}
> or
> {code}
> ./bin/kafka-server-start.sh --set my.cool.property=X kafka.properties
> {code}
> I'm more than happy to take a stab at it, but I would like to see if there is
> an interest for such capability?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)