Question

I'm finding that some Apache Curator recipes don't work with older versions of ZooKeeper. This isn't an issue except that I keep having developers in my company try to use some code I wrote and it fails without any errors or log messages due to them running an old version of their local machine. So I want to retrive the version of the ZooKeeper server to which I'm connected and die with an useful error message if the version is too old. However, I can't find any way to get the server's version number with either the Curator or ZooKeeper APIs. Anyone know how to do it?

Was it helpful?

Solution

The ZooKeeper "four letter words" can help. You can connect to the local ZK instance on port 2181 and execute a "srvr" four letter word. You'll get back lines of info one of which is the version.

Have a look at Exhibitor's FourLetterWord class for a sample of how to get this programmatically: https://github.com/Netflix/exhibitor/blob/40a02452dc3133fe37bf4ecf076bda99c29ab6ec/exhibitor-core/src/main/java/com/netflix/exhibitor/core/state/FourLetterWord.java

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top