Search in sources :

Example 1 with Endpoint

use of com.alibaba.maxgraph.sdkcommon.client.Endpoint in project GraphScope by alibaba.

the class ZkNamingProxy method persistEndpointToZK.

private void persistEndpointToZK(String zkPath, String hostName, int port) throws Exception {
    Endpoint endpoint = new Endpoint(hostName, port);
    String serverInfo = JSON.toJson(endpoint);
    zkUtils.createOrUpdatePath(zkPath, serverInfo, CreateMode.EPHEMERAL);
    LOG.info("update coordinator endpoint in zk success:{}", endpoint);
}
Also used : Endpoint(com.alibaba.maxgraph.sdkcommon.client.Endpoint)

Example 2 with Endpoint

use of com.alibaba.maxgraph.sdkcommon.client.Endpoint in project GraphScope by alibaba.

the class DataStatus method fromProto.

public static DataStatus fromProto(ServerHBReq serverHBReq) {
    int serverId = serverHBReq.getId();
    Endpoint endpoint = Endpoint.fromProto(serverHBReq.getEndpoint());
    RuntimeHBReq runtimeHBReq = serverHBReq.getRuntimeReq();
    StoreStatus storeStatus = serverHBReq.getStatus();
    return new DataStatus(serverId, endpoint, storeStatus, runtimeHBReq);
}
Also used : Endpoint(com.alibaba.maxgraph.sdkcommon.client.Endpoint) Endpoint(com.alibaba.maxgraph.sdkcommon.client.Endpoint)

Example 3 with Endpoint

use of com.alibaba.maxgraph.sdkcommon.client.Endpoint in project GraphScope by alibaba.

the class ClientManager method startCoordinatorNodeCache.

private void startCoordinatorNodeCache() throws Exception {
    ExecutorService pool = Executors.newFixedThreadPool(1);
    final NodeCache nodeCache = new NodeCache(this.serverDataApiClient.getZkNamingProxy().getZkClient(), ZKPaths.getCoordinatorPath(instanceConfig.getGraphName()), false);
    nodeCache.start(true);
    nodeCache.getListenable().addListener(() -> {
        if (nodeCache.getCurrentData() == null || StringUtils.isEmpty(Arrays.toString(nodeCache.getCurrentData().getData()))) {
            LOG.info("coordinator node not exist in zk");
        } else {
            try {
                Endpoint newEndpoint = JSON.fromJson(new String(nodeCache.getCurrentData().getData()), Endpoint.class);
                LOG.info("current coordinator endpoint:{}", newEndpoint);
                startCoordinatorRelatedClient(newEndpoint);
            } catch (Exception e) {
                LOG.warn("{}", e);
            }
        }
    }, pool);
}
Also used : NodeCache(org.apache.curator.framework.recipes.cache.NodeCache) Endpoint(com.alibaba.maxgraph.sdkcommon.client.Endpoint) ExecutorService(java.util.concurrent.ExecutorService)

Example 4 with Endpoint

use of com.alibaba.maxgraph.sdkcommon.client.Endpoint in project GraphScope by alibaba.

the class ClientManager method updateGroupExecutors.

public void updateGroupExecutors() {
    int replicaCount = this.instanceConfig.getReplicaCount();
    List<List<Endpoint>> endpointGroups = new ArrayList<>(replicaCount);
    int executorCnt = this.instanceConfig.getResourceExecutorCount() / replicaCount;
    for (int r = 0; r < replicaCount; r++) {
        List<Endpoint> endpoints = new ArrayList<>();
        for (int i = 0; i < executorCnt; i++) {
            endpoints.add(executorEndpointMap.get(r * executorCnt + i + 1));
        }
        endpointGroups.add(endpoints);
    }
    this.endpointGroupsRef.set(endpointGroups);
}
Also used : Endpoint(com.alibaba.maxgraph.sdkcommon.client.Endpoint) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Endpoint(com.alibaba.maxgraph.sdkcommon.client.Endpoint)

Example 5 with Endpoint

use of com.alibaba.maxgraph.sdkcommon.client.Endpoint in project GraphScope by alibaba.

the class ExecutorAddressFetcher method getAddressList.

@Override
public List<RpcAddress> getAddressList() {
    List<RpcAddress> rpcAddressList = Lists.newArrayList();
    for (int i = 1; i <= clientManager.getExecutorCount(); i++) {
        Endpoint endpoint = clientManager.getExecutor(i);
        rpcAddressList.add(new RpcAddress(endpoint.getIp(), endpoint.getPort()));
    }
    return rpcAddressList;
}
Also used : RpcAddress(com.alibaba.maxgraph.common.rpc.RpcAddress) Endpoint(com.alibaba.maxgraph.sdkcommon.client.Endpoint) Endpoint(com.alibaba.maxgraph.sdkcommon.client.Endpoint)

Aggregations

Endpoint (com.alibaba.maxgraph.sdkcommon.client.Endpoint)21 WorkerInfo (com.alibaba.maxgraph.common.client.WorkerInfo)3 MaxGraphCtrlServiceBlockingStub (com.alibaba.maxgraph.rpc.MaxGraphCtrlServiceGrpc.MaxGraphCtrlServiceBlockingStub)3 ManagedChannel (io.grpc.ManagedChannel)3 InstanceInfo (com.alibaba.maxgraph.coordinator.manager.InstanceInfo)2 ArrayList (java.util.ArrayList)2 QueryFlowOuterClass (com.alibaba.maxgraph.QueryFlowOuterClass)1 InstanceStatus (com.alibaba.maxgraph.common.InstanceStatus)1 ServerAssignment (com.alibaba.maxgraph.common.ServerAssignment)1 InstanceConfig (com.alibaba.maxgraph.common.cluster.InstanceConfig)1 LockWrapper (com.alibaba.maxgraph.common.lock.LockWrapper)1 RpcAddress (com.alibaba.maxgraph.common.rpc.RpcAddress)1 GraphSchema (com.alibaba.maxgraph.compiler.api.schema.GraphSchema)1 SchemaFetcher (com.alibaba.maxgraph.compiler.api.schema.SchemaFetcher)1 ServerDataApiClient (com.alibaba.maxgraph.coordinator.client.ServerDataApiClient)1 IteratorList (com.alibaba.maxgraph.iterator.IteratorList)1 RoleType (com.alibaba.maxgraph.proto.RoleType)1 RoutingServerInfoResp (com.alibaba.maxgraph.proto.RoutingServerInfoResp)1 RuntimeEnvList (com.alibaba.maxgraph.proto.RuntimeEnvList)1 PropertyValueResult (com.alibaba.maxgraph.result.PropertyValueResult)1