use of io.pravega.cli.admin.utils.ZKHelper in project pravega by pravega.
the class ControllerMetadataViewReaderInfoCommand method execute.
@Override
public void execute() throws Exception {
ensureArgCount(3);
final String hostId = getArg(0);
final String readerGroupName = getArg(1);
final String readerId = getArg(2);
try {
ZKHelper zkHelper = ZKHelper.create(getServiceConfig().getZkURL(), getServiceConfig().getClusterName());
output("reader-metadata: \n %s", zkHelper.getMetaDataForReader(getReaderPath(hostId, readerGroupName, readerId)));
} catch (Exception e) {
output("Exception accessing to reader metadata : " + e.getMessage());
}
}
use of io.pravega.cli.admin.utils.ZKHelper 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.");
}
}
use of io.pravega.cli.admin.utils.ZKHelper in project pravega by pravega.
the class AbstractControllerMetadataCommandsTest method testControllerMetadataViewReaderInfoCommandWithException.
@Test
public void testControllerMetadataViewReaderInfoCommandWithException() throws Exception {
final String process = UUID.randomUUID().toString();
final String readerGroup = UUID.randomUUID().toString();
final String reader = UUID.randomUUID().toString();
ZKHelper zkHelper = ZKHelper.create(SETUP_UTILS.getZkTestServer().getConnectString(), "pravega-cluster");
CheckpointStore checkpointStore = zkHelper.getCheckPointStore();
checkpointStore.addReaderGroup(process, readerGroup);
String commandResult = TestUtils.executeCommand("controller-metadata get-reader " + process + " " + readerGroup + " " + reader, STATE.get());
Assert.assertTrue(commandResult.contains("Exception accessing to reader metadata"));
}
use of io.pravega.cli.admin.utils.ZKHelper in project pravega by pravega.
the class AbstractControllerMetadataCommandsTest method testControllerMetadataViewReaderInfoCommand.
@Test
public void testControllerMetadataViewReaderInfoCommand() throws Exception {
final String process = UUID.randomUUID().toString();
final String readerGroup = UUID.randomUUID().toString();
final String reader = UUID.randomUUID().toString();
ZKHelper zkHelper = ZKHelper.create(SETUP_UTILS.getZkTestServer().getConnectString(), "pravega-cluster");
CheckpointStore checkpointStore = zkHelper.getCheckPointStore();
checkpointStore.addReaderGroup(process, readerGroup);
checkpointStore.addReader(process, readerGroup, reader);
Position position = new PositionImpl(ImmutableMap.of(new SegmentWithRange(Segment.fromScopedName("testScope/testStream/0"), 0, 0.5), 9999999L, new SegmentWithRange(Segment.fromScopedName("testScope/testStream/1"), 0.5, 1.0), -1L));
checkpointStore.setPosition(process, readerGroup, reader, position);
String commandResult = TestUtils.executeCommand("controller-metadata get-reader " + process + " " + readerGroup + " " + reader, STATE.get());
Assert.assertTrue(commandResult.contains("testScope/testStream"));
}
use of io.pravega.cli.admin.utils.ZKHelper in project pravega by pravega.
the class ListContainersCommand method execute.
@Override
public void execute() {
ensureArgCount(0);
try {
@Cleanup ZKHelper zkStoreHelper = ZKHelper.create(getServiceConfig().getZkURL(), getServiceConfig().getClusterName());
prettyJSONOutput("segment_store_container_map", zkStoreHelper.getCurrentHostMap());
} catch (Exception e) {
System.err.println("Exception accessing to Zookeeper cluster metadata: " + e.getMessage());
}
}
Aggregations