Shivam Tomar
01/12/2025, 10:00 PMRunLLM
01/12/2025, 10:00 PMgetWritableBookies method from the BookKeeperAdmin class. This method retrieves the set of writable bookies in the cluster. The size of this set gives you the number of writable bookies.
Here's a concise code snippet to achieve this:
import org.apache.bookkeeper.client.BookKeeperAdmin;
import org.apache.bookkeeper.conf.ClientConfiguration;
ClientConfiguration clientConfiguration = new ClientConfiguration();
try (BookKeeperAdmin admin = new BookKeeperAdmin(clientConfiguration)) {
int writableBookiesCount = admin.getAvailableBookies().size();
System.out.println("Number of writable bookies: " + writableBookiesCount);
} catch (Exception e) {
e.printStackTrace();
}
Would you like more details on this process?
Sources:
- ClusterInfoCommand.java 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.Shivam Tomar
01/12/2025, 10:01 PMimport org.apache.bookkeeper.client.BookKeeperAdmin;
import org.apache.bookkeeper.conf.ClientConfiguration;
ClientConfiguration clientConfiguration = new ClientConfiguration();
try (BookKeeperAdmin admin = new BookKeeperAdmin(clientConfiguration)) {
int writableBookiesCount = admin.getAvailableBookies().size();
System.out.println("Number of writable bookies: " + writableBookiesCount);
} catch (Exception e) {
e.printStackTrace();
}RunLLM
01/12/2025, 10:01 PM