Search in sources :

Example 1 with HDFSPolicyProvider

use of org.apache.hadoop.hdfs.HDFSPolicyProvider in project hadoop by apache.

the class DataNode method initIpcServer.

private void initIpcServer() throws IOException {
    InetSocketAddress ipcAddr = NetUtils.createSocketAddr(getConf().getTrimmed(DFS_DATANODE_IPC_ADDRESS_KEY));
    // Add all the RPC protocols that the Datanode implements    
    RPC.setProtocolEngine(getConf(), ClientDatanodeProtocolPB.class, ProtobufRpcEngine.class);
    ClientDatanodeProtocolServerSideTranslatorPB clientDatanodeProtocolXlator = new ClientDatanodeProtocolServerSideTranslatorPB(this);
    BlockingService service = ClientDatanodeProtocolService.newReflectiveBlockingService(clientDatanodeProtocolXlator);
    ipcServer = new RPC.Builder(getConf()).setProtocol(ClientDatanodeProtocolPB.class).setInstance(service).setBindAddress(ipcAddr.getHostName()).setPort(ipcAddr.getPort()).setNumHandlers(getConf().getInt(DFS_DATANODE_HANDLER_COUNT_KEY, DFS_DATANODE_HANDLER_COUNT_DEFAULT)).setVerbose(false).setSecretManager(blockPoolTokenSecretManager).build();
    ReconfigurationProtocolServerSideTranslatorPB reconfigurationProtocolXlator = new ReconfigurationProtocolServerSideTranslatorPB(this);
    service = ReconfigurationProtocolService.newReflectiveBlockingService(reconfigurationProtocolXlator);
    DFSUtil.addPBProtocol(getConf(), ReconfigurationProtocolPB.class, service, ipcServer);
    InterDatanodeProtocolServerSideTranslatorPB interDatanodeProtocolXlator = new InterDatanodeProtocolServerSideTranslatorPB(this);
    service = InterDatanodeProtocolService.newReflectiveBlockingService(interDatanodeProtocolXlator);
    DFSUtil.addPBProtocol(getConf(), InterDatanodeProtocolPB.class, service, ipcServer);
    TraceAdminProtocolServerSideTranslatorPB traceAdminXlator = new TraceAdminProtocolServerSideTranslatorPB(this);
    BlockingService traceAdminService = TraceAdminService.newReflectiveBlockingService(traceAdminXlator);
    DFSUtil.addPBProtocol(getConf(), TraceAdminProtocolPB.class, traceAdminService, ipcServer);
    LOG.info("Opened IPC server at " + ipcServer.getListenerAddress());
    // set service-level authorization security policy
    if (getConf().getBoolean(CommonConfigurationKeys.HADOOP_SECURITY_AUTHORIZATION, false)) {
        ipcServer.refreshServiceAcl(getConf(), new HDFSPolicyProvider());
    }
}
Also used : ReconfigurationProtocolServerSideTranslatorPB(org.apache.hadoop.hdfs.protocolPB.ReconfigurationProtocolServerSideTranslatorPB) ClientDatanodeProtocolServerSideTranslatorPB(org.apache.hadoop.hdfs.protocolPB.ClientDatanodeProtocolServerSideTranslatorPB) RPC(org.apache.hadoop.ipc.RPC) InterDatanodeProtocolServerSideTranslatorPB(org.apache.hadoop.hdfs.protocolPB.InterDatanodeProtocolServerSideTranslatorPB) HDFSPolicyProvider(org.apache.hadoop.hdfs.HDFSPolicyProvider) InetSocketAddress(java.net.InetSocketAddress) TraceAdminProtocolServerSideTranslatorPB(org.apache.hadoop.tracing.TraceAdminProtocolServerSideTranslatorPB) BlockingService(com.google.protobuf.BlockingService)

Example 2 with HDFSPolicyProvider

use of org.apache.hadoop.hdfs.HDFSPolicyProvider in project hadoop by apache.

the class NameNodeRpcServer method refreshServiceAcl.

// RefreshAuthorizationPolicyProtocol
@Override
public void refreshServiceAcl() throws IOException {
    checkNNStartup();
    if (!serviceAuthEnabled) {
        throw new AuthorizationException("Service Level Authorization not enabled!");
    }
    this.clientRpcServer.refreshServiceAcl(new Configuration(), new HDFSPolicyProvider());
    if (this.serviceRpcServer != null) {
        this.serviceRpcServer.refreshServiceAcl(new Configuration(), new HDFSPolicyProvider());
    }
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) HDFSPolicyProvider(org.apache.hadoop.hdfs.HDFSPolicyProvider) AuthorizationException(org.apache.hadoop.security.authorize.AuthorizationException)

Aggregations

HDFSPolicyProvider (org.apache.hadoop.hdfs.HDFSPolicyProvider)2 BlockingService (com.google.protobuf.BlockingService)1 InetSocketAddress (java.net.InetSocketAddress)1 Configuration (org.apache.hadoop.conf.Configuration)1 ClientDatanodeProtocolServerSideTranslatorPB (org.apache.hadoop.hdfs.protocolPB.ClientDatanodeProtocolServerSideTranslatorPB)1 InterDatanodeProtocolServerSideTranslatorPB (org.apache.hadoop.hdfs.protocolPB.InterDatanodeProtocolServerSideTranslatorPB)1 ReconfigurationProtocolServerSideTranslatorPB (org.apache.hadoop.hdfs.protocolPB.ReconfigurationProtocolServerSideTranslatorPB)1 RPC (org.apache.hadoop.ipc.RPC)1 AuthorizationException (org.apache.hadoop.security.authorize.AuthorizationException)1 TraceAdminProtocolServerSideTranslatorPB (org.apache.hadoop.tracing.TraceAdminProtocolServerSideTranslatorPB)1