2012年7月18日水曜日

NoNode for /ledgers/cookies error by bookkeeper

If you encounter an error like below when you run "bin/bookkeeper bookie",

org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /ledgers/cookies
        at org.apache.zookeeper.KeeperException.create(KeeperException.java:111)
        at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)
        at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:778)
        at org.apache.bookkeeper.bookie.Cookie.writeToZooKeeper(Cookie.java:136)
        at org.apache.bookkeeper.bookie.Bookie.checkEnvironment(Bookie.java:312)
        at org.apache.bookkeeper.bookie.Bookie.<init>(Bookie.java:352)
        at org.apache.bookkeeper.proto.BookieServer.newBookie(BookieServer.java:82)
        at org.apache.bookkeeper.proto.BookieServer.<init>(BookieServer.java:75)
        at org.apache.bookkeeper.proto.BookieServer.main(BookieServer.java:300)

Try to type the following commands and run "bin/bookkeeper bookie" again.

$ bin/bookeeper org.apache.zookeeper.ZooKeeperMain \
    -server <server>:<port> create /ledgers 0
$ bin/bookeeper org.apache.zookeeper.ZooKeeperMain \
    -server <server>:<port> create /ledgers/available 0

Replace <server> and <port> with your ZooKeeper server and its port. myzookkeeper:2181, for example.

-----
「bin/bookkeeper bookie」を実行したときに下記のようなエラーが発生したら、

org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /ledgers/cookies
        at org.apache.zookeeper.KeeperException.create(KeeperException.java:111)
        at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)
        at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:778)
        at org.apache.bookkeeper.bookie.Cookie.writeToZooKeeper(Cookie.java:136)
        at org.apache.bookkeeper.bookie.Bookie.checkEnvironment(Bookie.java:312)
        at org.apache.bookkeeper.bookie.Bookie.<init>(Bookie.java:352)
        at org.apache.bookkeeper.proto.BookieServer.newBookie(BookieServer.java:82)
        at org.apache.bookkeeper.proto.BookieServer.<init>(BookieServer.java:75)
        at org.apache.bookkeeper.proto.BookieServer.main(BookieServer.java:300)

次のコマンドをタイプし、もう一度「bin/bookkeeper bookie」を実行してみてください。

$ bin/bookeeper org.apache.zookeeper.ZooKeeperMain \
    -server <server>:<port> create /ledgers 0
$ bin/bookeeper org.apache.zookeeper.ZooKeeperMain \
    -server <server>:<port> create /ledgers/available 0


<server><port> は、ZooKeeper サーバーとそのポートに置き換えてください。例えば、myzookeeper:2181 など。