use of com.alibaba.maxgraph.common.config.Configs in project GraphScope by alibaba.
the class MaxNode method main.
public static void main(String[] args) throws Exception {
String configFile = System.getProperty("config.file");
Configs conf = new Configs(configFile);
MaxNode maxNode = new MaxNode(conf);
NodeLauncher nodeLauncher = new NodeLauncher(maxNode);
nodeLauncher.start();
}
use of com.alibaba.maxgraph.common.config.Configs in project GraphScope by alibaba.
the class ExecutorService method start.
public void start() {
logger.info("Start to launch executor service");
int nodeCount = CommonConfig.STORE_NODE_COUNT.get(this.configs);
int workerPerProcess = ExecutorConfig.EXECUTOR_WORKER_PER_PROCESS.get(this.configs);
Configs executorConfig = Configs.newBuilder().put("node.idx", String.valueOf(CommonConfig.NODE_IDX.get(configs))).put("graph.name", CommonConfig.GRAPH_NAME.get(configs)).put("partition.count", String.valueOf(CommonConfig.PARTITION_COUNT.get(configs))).put("graph.port", String.valueOf(StoreConfig.EXECUTOR_GRAPH_PORT.get(configs))).put("query.port", String.valueOf(StoreConfig.EXECUTOR_QUERY_PORT.get(configs))).put("engine.port", String.valueOf(StoreConfig.EXECUTOR_ENGINE_PORT.get(configs))).put("worker.per.process", String.valueOf(workerPerProcess)).put("worker.num", String.valueOf(nodeCount)).build();
byte[] configBytes = executorConfig.toProto().toByteArray();
logger.info("Start to open executor server");
Pointer pointer = ExecutorLibrary.INSTANCE.openExecutorServer(configBytes, configBytes.length);
// Add graph store with partition id to executor
Map<Integer, GraphPartition> idToPartition = this.storeService.getIdToPartition();
logger.info("Get partition count " + idToPartition.size() + " for current store node");
for (Map.Entry<Integer, GraphPartition> partition : idToPartition.entrySet()) {
int partitionId = partition.getKey();
GraphPartition graphStore = partition.getValue();
if (graphStore instanceof JnaGraphStore) {
JnaGraphStore jnaGraphStore = (JnaGraphStore) graphStore;
ExecutorLibrary.INSTANCE.addGraphPartition(pointer, partitionId, jnaGraphStore.getPointer());
logger.info("Add partition " + partitionId);
}
}
// Assign partition id to each worker id
for (int i = 0; i < nodeCount; i++) {
List<Integer> partitionIdList = metaService.getPartitionsByStoreId(i);
logger.info("Get partition id list " + partitionIdList + " for store index " + i);
partitionIdList.sort(Integer::compareTo);
for (int k = 0; k < partitionIdList.size(); k++) {
int partitionId = partitionIdList.get(k);
int innnerIndex = k % workerPerProcess;
int workerId = (i * workerPerProcess) + innnerIndex;
logger.info("Add partition->worker mapping " + partitionId + "->" + workerId);
ExecutorLibrary.INSTANCE.addPartitionWorkerMapping(pointer, partitionId, workerId);
}
}
this.executorManager.initialExecutor(pointer, nodeCount);
this.executorManager.startEngineServer();
this.executorManager.startRpcServer();
this.executorManager.getDiscoveryManager().getEngineServerDiscovery().addListener(new EngineServerListener(this.executorManager));
while (!this.executorManager.checkEngineServersConnect()) {
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
logger.info("Wait all the engine server to build connection with each other");
}
logger.info("All engine server build connection with each success");
}
use of com.alibaba.maxgraph.common.config.Configs in project GraphScope by alibaba.
the class Ingestor method main.
public static void main(String[] args) throws IOException {
String configFile = System.getProperty("config.file");
Configs conf = new Configs(configFile);
Ingestor ingestor = new Ingestor(conf);
NodeLauncher nodeLauncher = new NodeLauncher(ingestor);
nodeLauncher.start();
}
use of com.alibaba.maxgraph.common.config.Configs in project GraphScope by alibaba.
the class MaxGraph method main.
public static void main(String[] args) throws IOException {
String configFile = System.getProperty("config.file");
Configs conf = new Configs(configFile);
NodeBase node;
if (args.length == 0) {
logger.warn("No role type, use MaxNode");
try {
node = new MaxNode(conf);
} catch (Exception e) {
throw new MaxGraphException(e);
}
} else {
String roleName = args[0];
if (roleName.equalsIgnoreCase("store-gaia") || roleName.equalsIgnoreCase("frontend-gaia")) {
conf = Configs.newBuilder(conf).put(CommonConfig.ENGINE_TYPE.getKey(), "gaia").build();
}
RoleType roleType = RoleType.fromName(roleName);
switch(roleType) {
case FRONTEND:
node = new Frontend(conf);
break;
case INGESTOR:
node = new Ingestor(conf);
break;
case STORE:
node = new Store(conf);
break;
case COORDINATOR:
node = new Coordinator(conf);
break;
default:
throw new IllegalArgumentException("invalid roleType [" + roleType + "]");
}
}
new NodeLauncher(node).start();
logger.info("node started. [" + node.getName() + "]");
}
use of com.alibaba.maxgraph.common.config.Configs in project GraphScope by alibaba.
the class ZkMetaStoreTest method testMetaStore.
@Test
void testMetaStore() 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_meta_store").build();
CuratorFramework curator = CuratorUtils.makeCurator(configs);
curator.start();
MetaStore metaStore = new ZkMetaStore(configs, curator);
String path = "test_path";
String data = "test_data";
assertFalse(metaStore.exists(path));
metaStore.write(path, data.getBytes());
assertTrue(metaStore.exists(path));
assertEquals(new String(metaStore.read(path)), data);
metaStore.delete(path);
assertFalse(metaStore.exists(path));
curator.close();
}
}
Aggregations