Search in sources :

Example 1 with ZKConnectionFailedException

use of io.pravega.cli.admin.utils.ZKConnectionFailedException in project pravega by pravega.

the class GetClusterNodesCommand method execute.

@Override
public void execute() {
    ensureArgCount(0);
    try {
        @Cleanup ZKHelper zkStoreHelper = ZKHelper.create(getServiceConfig().getZkURL(), getServiceConfig().getClusterName());
        prettyJSONOutput("cluster_name", getServiceConfig().getClusterName());
        prettyJSONOutput("controllers", zkStoreHelper.getControllers());
        prettyJSONOutput("segment_stores", zkStoreHelper.getSegmentStores());
        prettyJSONOutput("bookies", zkStoreHelper.getBookies());
    } catch (ZKConnectionFailedException e) {
        System.err.println("Exception accessing to Zookeeper cluster metadata.");
    }
}
Also used : ZKHelper(io.pravega.cli.admin.utils.ZKHelper) ZKConnectionFailedException(io.pravega.cli.admin.utils.ZKConnectionFailedException) Cleanup(lombok.Cleanup)

Example 2 with ZKConnectionFailedException

use of io.pravega.cli.admin.utils.ZKConnectionFailedException in project pravega by pravega.

the class GetSegmentStoreByContainerCommand method execute.

@Override
public void execute() {
    ensureArgCount(1);
    try {
        @Cleanup ZKHelper zkStoreHelper = ZKHelper.create(getServiceConfig().getZkURL(), getServiceConfig().getClusterName());
        Optional<Host> host = zkStoreHelper.getHostForContainer(getIntArg(0));
        prettyJSONOutput("owner_segment_store", host.get());
    } catch (ZKConnectionFailedException e) {
        System.err.println("Exception accessing to Zookeeper cluster metadata.");
    }
}
Also used : ZKHelper(io.pravega.cli.admin.utils.ZKHelper) ZKConnectionFailedException(io.pravega.cli.admin.utils.ZKConnectionFailedException) Host(io.pravega.common.cluster.Host) Cleanup(lombok.Cleanup)

Aggregations

ZKConnectionFailedException (io.pravega.cli.admin.utils.ZKConnectionFailedException)2 ZKHelper (io.pravega.cli.admin.utils.ZKHelper)2 Cleanup (lombok.Cleanup)2 Host (io.pravega.common.cluster.Host)1