1

I have a:

  • single instance of Apache Kafka (2.9.2-0.8.1.1) installed from the source, using the default configuration (server.properties etc.),
  • Zookeeper (3.4.5+dfsg-2) stand-alone, installed from the package

..running on a Ubuntu 14.04 LTS host with a name hostname1.


I try to shutdown Kafka cleanly but I can't.


I tried 2 methods:

  • sending SIGINT - but Kafka simply ignores it (doesn't mention recieving the signal in any log, keeps running) [SIGTERM works but that's not the point]

  • using Controlled Shutdown tool - but it fails with the following..

..stacktrace:

[2015-02-03 12:55:49,461] ERROR Operation failed due to controller failure (kafka.admin.ShutdownBroker$) java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: hostname1; nested exception is: java.net.ConnectException: Connection refused] at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:369) at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:268) at kafka.admin.ShutdownBroker$.kafka$admin$ShutdownBroker$$invokeShutdown(ShutdownBroker.scala:56) at kafka.admin.ShutdownBroker$.main(ShutdownBroker.scala:109) at kafka.admin.ShutdownBroker.main(ShutdownBroker.scala) Caused by: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: hostname1; nested exception is: java.net.ConnectException: Connection refused] at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:118) at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:203) at javax.naming.InitialContext.lookup(InitialContext.java:411) at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1929) at javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1896) at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:286) ... 4 more Caused by: java.rmi.ConnectException: Connection refused to host: hostname1; nested exception is: java.net.ConnectException: Connection refused at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619) at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216) at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202) at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:341) at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source) at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:114) ... 9 more Caused by: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:579) at java.net.Socket.connect(Socket.java:528) at java.net.Socket.<init>(Socket.java:425) at java.net.Socket.<init>(Socket.java:208) at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40) at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:147) at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613) ... 14 more 

2 Answers 2

2

For 0.8.1.1 this tool:

  • does not work out of the box,
  • is no longer needed.

Quote from "Controlled shutdown tool doesn't seem to work out of the box" Kafka JIRA issue:

Do we even need this tool anymore? Currently controlled shutdown is enabled through a config and automatically kicks in during a kill -15 of a Kafka server. I almost think we can get rid of a tool to do controlled shutdown.


Here is what I ended up putting into my config/server.properties:

controlled.shutdown.enable=true controlled.shutdown.max.retries=3 controlled.shutdown.retry.backoff.ms=5000 
0

First thing is that I have used the wrong signal. I should have used SIGTERM (15) instead of SIGINT (2).


Second is that as @MaasSql have pointed out, you have to explicitely turn on controlled shutdown in Kafka 0.8.1.1.

(For 0.8.2+ you don't have do that - it is enabled by default.)

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.