Search in sources :

Example 1 with HAServiceProtocolServerSideTranslatorPB

use of org.apache.hadoop.ha.protocolPB.HAServiceProtocolServerSideTranslatorPB in project hadoop by apache.

the class DummyHAService method startAndGetRPCServerAddress.

private InetSocketAddress startAndGetRPCServerAddress(InetSocketAddress serverAddress) {
    Configuration conf = new Configuration();
    try {
        RPC.setProtocolEngine(conf, HAServiceProtocolPB.class, ProtobufRpcEngine.class);
        HAServiceProtocolServerSideTranslatorPB haServiceProtocolXlator = new HAServiceProtocolServerSideTranslatorPB(new MockHAProtocolImpl());
        BlockingService haPbService = HAServiceProtocolService.newReflectiveBlockingService(haServiceProtocolXlator);
        Server server = new RPC.Builder(conf).setProtocol(HAServiceProtocolPB.class).setInstance(haPbService).setBindAddress(serverAddress.getHostName()).setPort(serverAddress.getPort()).build();
        server.start();
        return NetUtils.getConnectAddress(server);
    } catch (IOException e) {
        return null;
    }
}
Also used : HAServiceProtocolServerSideTranslatorPB(org.apache.hadoop.ha.protocolPB.HAServiceProtocolServerSideTranslatorPB) Configuration(org.apache.hadoop.conf.Configuration) Server(org.apache.hadoop.ipc.Server) RPC(org.apache.hadoop.ipc.RPC) BlockingService(com.google.protobuf.BlockingService) IOException(java.io.IOException)

Example 2 with HAServiceProtocolServerSideTranslatorPB

use of org.apache.hadoop.ha.protocolPB.HAServiceProtocolServerSideTranslatorPB in project hadoop by apache.

the class AdminService method startServer.

protected void startServer() throws Exception {
    Configuration conf = getConfig();
    YarnRPC rpc = YarnRPC.create(conf);
    this.server = (Server) rpc.getServer(ResourceManagerAdministrationProtocol.class, this, masterServiceBindAddress, conf, null, conf.getInt(YarnConfiguration.RM_ADMIN_CLIENT_THREAD_COUNT, YarnConfiguration.DEFAULT_RM_ADMIN_CLIENT_THREAD_COUNT));
    // Enable service authorization?
    if (conf.getBoolean(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION, false)) {
        refreshServiceAcls(getConfiguration(conf, YarnConfiguration.HADOOP_POLICY_CONFIGURATION_FILE), RMPolicyProvider.getInstance());
    }
    if (rmContext.isHAEnabled()) {
        RPC.setProtocolEngine(conf, HAServiceProtocolPB.class, ProtobufRpcEngine.class);
        HAServiceProtocolServerSideTranslatorPB haServiceProtocolXlator = new HAServiceProtocolServerSideTranslatorPB(this);
        BlockingService haPbService = HAServiceProtocolProtos.HAServiceProtocolService.newReflectiveBlockingService(haServiceProtocolXlator);
        server.addProtocol(RPC.RpcKind.RPC_PROTOCOL_BUFFER, HAServiceProtocol.class, haPbService);
    }
    this.server.start();
    conf.updateConnectAddr(YarnConfiguration.RM_BIND_HOST, YarnConfiguration.RM_ADMIN_ADDRESS, YarnConfiguration.DEFAULT_RM_ADMIN_ADDRESS, server.getListenerAddress());
}
Also used : HAServiceProtocolServerSideTranslatorPB(org.apache.hadoop.ha.protocolPB.HAServiceProtocolServerSideTranslatorPB) Configuration(org.apache.hadoop.conf.Configuration) DynamicResourceConfiguration(org.apache.hadoop.yarn.server.resourcemanager.resource.DynamicResourceConfiguration) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) BlockingService(com.google.protobuf.BlockingService) YarnRPC(org.apache.hadoop.yarn.ipc.YarnRPC)

Aggregations

BlockingService (com.google.protobuf.BlockingService)2 Configuration (org.apache.hadoop.conf.Configuration)2 HAServiceProtocolServerSideTranslatorPB (org.apache.hadoop.ha.protocolPB.HAServiceProtocolServerSideTranslatorPB)2 IOException (java.io.IOException)1 RPC (org.apache.hadoop.ipc.RPC)1 Server (org.apache.hadoop.ipc.Server)1 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)1 YarnRPC (org.apache.hadoop.yarn.ipc.YarnRPC)1 DynamicResourceConfiguration (org.apache.hadoop.yarn.server.resourcemanager.resource.DynamicResourceConfiguration)1