use of com.alibaba.graphscope.groot.discovery.ZkDiscovery in project GraphScope by alibaba.
the class ExecutorDiscoveryManagerTest method testExecutorServerStart.
@Test
void testExecutorServerStart() throws Exception {
try (TestingServer testingServer = new TestingServer(-1)) {
int zkPort = testingServer.getPort();
Configs configs = Configs.newBuilder().put(ZkConfig.ZK_CONNECT_STRING.getKey(), "localhost:" + zkPort).put(ZkConfig.ZK_BASE_PATH.getKey(), "test_discovery").build();
CuratorFramework curator = CuratorUtils.makeCurator(configs);
curator.start();
LocalNodeProvider engineServerProvider = new LocalNodeProvider(RoleType.EXECUTOR_ENGINE, configs);
NodeDiscovery engineServerDiscovery = new ZkDiscovery(configs, engineServerProvider, curator);
LocalNodeProvider storeQueryProvider = new LocalNodeProvider(RoleType.EXECUTOR_GRAPH, configs);
NodeDiscovery storeQueryDiscovery = new ZkDiscovery(configs, storeQueryProvider, curator);
LocalNodeProvider queryExecuteProvider = new LocalNodeProvider(RoleType.EXECUTOR_QUERY, configs);
NodeDiscovery queryExecuteDiscovery = new ZkDiscovery(configs, queryExecuteProvider, curator);
LocalNodeProvider queryManageProvider = new LocalNodeProvider(RoleType.EXECUTOR_MANAGE, configs);
NodeDiscovery queryManageDiscovery = new ZkDiscovery(configs, queryManageProvider, curator);
ExecutorDiscoveryManager executorDiscoveryManager = new ExecutorDiscoveryManager(engineServerProvider, engineServerDiscovery, storeQueryProvider, storeQueryDiscovery, queryExecuteProvider, queryExecuteDiscovery, queryManageProvider, queryManageDiscovery);
executorDiscoveryManager.getEngineServerProvider().apply(123);
executorDiscoveryManager.getEngineServerDiscovery().start();
executorDiscoveryManager.getQueryExecuteProvider().apply(1234);
executorDiscoveryManager.getQueryExecuteDiscovery().start();
}
}
use of com.alibaba.graphscope.groot.discovery.ZkDiscovery in project GraphScope by alibaba.
the class ZkDiscoveryTest method createNodeDiscovery.
private NodeDiscovery createNodeDiscovery(RoleType role, int idx, int port, Configs zkConfigs, CuratorFramework curator) {
Configs nodeConfigs = Configs.newBuilder().put(CommonConfig.ROLE_NAME.getKey(), role.getName()).put(CommonConfig.NODE_IDX.getKey(), String.valueOf(idx)).build();
LocalNodeProvider localNodeProvider = new LocalNodeProvider(nodeConfigs);
localNodeProvider.apply(port);
return new ZkDiscovery(zkConfigs, localNodeProvider, curator);
}
Aggregations