You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2020/05/22 14:11:08 UTC

[GitHub] [bookkeeper] coolbeevip commented on issue #2345: Is it possible to automatically check zookeeper and create bookkeeper metadata when starting bookkeeper?

coolbeevip commented on issue #2345:
URL: https://github.com/apache/bookkeeper/issues/2345#issuecomment-632713378


   Why not use BookkeeperAdmin in ZKRegistrationManager to automatically initialize the cluster, Any explanation for that?
   
   ```
       @Override
       public String getClusterInstanceId() throws BookieException {
           String instanceId = null;
           try {
               if (zk.exists(ledgersRootPath, null) == null) {
                   try {
                       BookKeeperAdmin.initNewCluster(conf);
                   } catch (Exception e) {
                       log.error("BookKeeper metadata doesn't exist in zookeeper. "
                           + "Has the cluster been initialized? "
                           + "Try running bin/bookkeeper shell metaformat");
                       throw new KeeperException.NoNodeException("BookKeeper metadata");
                   }
               }
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org