KStreams remove member tool

KIP-345 introduced static membership.

In future works section it’s discussed the convenience of adding a new tool to remove instances from the group. Static membership doesn’t remove a member from the group until session timeout expires (usually a long time).

It’s been a while since static membership is around but that tool never made it.

We miss it so many times that we set up a quick solution.

Help option will show you

This tool helps to quickly remove instances from a running Kafka Streams app.
Option (* = required)               Description                                
---------------------               -----------                                
* --application-id <String: id>     The Kafka Streams application ID           
                                      (application.id).                        
--bootstrap-servers <String: urls>  Comma-separated list of broker urls with   
                                      format: HOST1:PORT1,HOST2:PORT2 (default:
                                      localhost:9092)                          
--config-file <String: file name>   Property file containing configs to be     
                                      passed to admin clients and embedded     
                                      consumer.                                
--execute <Boolean: execute>        Set this flag to true to execute remove    
                                      command. Otherwise just will inform you  
                                      of the result. (default: false)          
--help                              Print usage information.                   
--instance-ids <String: list>       Comma-separated list of instance ids. The  
                                      tool will remove this instances from the 
                                      list of members of the consumer group.   
--prefix-keep <String: prefix>      Remove all instances whose id doesn't match
                                      this prefix                              
--version                           Print version information and exit.        

Unless you set execute parameter to true, it wouldn’t do anything.

Both instance-ids and prefix-keep let you set up the instances to remove.

Running the tool without setting up a set of instances to remove will show you current instances.