Search in sources :

Example 1 with StorageContainerDatanodeProtocolPB

use of org.apache.hadoop.ozone.protocolPB.StorageContainerDatanodeProtocolPB in project ozone by apache.

the class SCMConnectionManager method addSCMServer.

/**
 * adds a new SCM machine to the target set.
 *
 * @param address - Address of the SCM machine to send heartbeat to.
 * @throws IOException
 */
public void addSCMServer(InetSocketAddress address) throws IOException {
    writeLock();
    try {
        if (scmMachines.containsKey(address)) {
            LOG.warn("Trying to add an existing SCM Machine to Machines group. " + "Ignoring the request.");
            return;
        }
        Configuration hadoopConfig = LegacyHadoopConfigurationSource.asHadoopConfiguration(this.conf);
        RPC.setProtocolEngine(hadoopConfig, StorageContainerDatanodeProtocolPB.class, ProtobufRpcEngine.class);
        long version = RPC.getProtocolVersion(StorageContainerDatanodeProtocolPB.class);
        RetryPolicy retryPolicy = RetryPolicies.retryUpToMaximumCountWithFixedSleep(getScmRpcRetryCount(conf), getScmRpcRetryInterval(conf), TimeUnit.MILLISECONDS);
        StorageContainerDatanodeProtocolPB rpcProxy = RPC.getProtocolProxy(StorageContainerDatanodeProtocolPB.class, version, address, UserGroupInformation.getCurrentUser(), hadoopConfig, NetUtils.getDefaultSocketFactory(hadoopConfig), getRpcTimeout(), retryPolicy).getProxy();
        StorageContainerDatanodeProtocolClientSideTranslatorPB rpcClient = new StorageContainerDatanodeProtocolClientSideTranslatorPB(rpcProxy);
        EndpointStateMachine endPoint = new EndpointStateMachine(address, rpcClient, this.conf);
        endPoint.setPassive(false);
        scmMachines.put(address, endPoint);
    } finally {
        writeUnlock();
    }
}
Also used : StorageContainerDatanodeProtocolClientSideTranslatorPB(org.apache.hadoop.ozone.protocolPB.StorageContainerDatanodeProtocolClientSideTranslatorPB) Configuration(org.apache.hadoop.conf.Configuration) RetryPolicy(org.apache.hadoop.io.retry.RetryPolicy) StorageContainerDatanodeProtocolPB(org.apache.hadoop.ozone.protocolPB.StorageContainerDatanodeProtocolPB)

Example 2 with StorageContainerDatanodeProtocolPB

use of org.apache.hadoop.ozone.protocolPB.StorageContainerDatanodeProtocolPB in project ozone by apache.

the class ContainerTestUtils method createEndpoint.

/**
 * Creates an Endpoint class for testing purpose.
 *
 * @param conf - Conf
 * @param address - InetAddres
 * @param rpcTimeout - rpcTimeOut
 * @return EndPoint
 * @throws Exception
 */
public static EndpointStateMachine createEndpoint(Configuration conf, InetSocketAddress address, int rpcTimeout) throws Exception {
    RPC.setProtocolEngine(conf, StorageContainerDatanodeProtocolPB.class, ProtobufRpcEngine.class);
    long version = RPC.getProtocolVersion(StorageContainerDatanodeProtocolPB.class);
    StorageContainerDatanodeProtocolPB rpcProxy = RPC.getProtocolProxy(StorageContainerDatanodeProtocolPB.class, version, address, UserGroupInformation.getCurrentUser(), conf, NetUtils.getDefaultSocketFactory(conf), rpcTimeout, RetryPolicies.TRY_ONCE_THEN_FAIL).getProxy();
    StorageContainerDatanodeProtocolClientSideTranslatorPB rpcClient = new StorageContainerDatanodeProtocolClientSideTranslatorPB(rpcProxy);
    return new EndpointStateMachine(address, rpcClient, new LegacyHadoopConfigurationSource(conf));
}
Also used : EndpointStateMachine(org.apache.hadoop.ozone.container.common.statemachine.EndpointStateMachine) StorageContainerDatanodeProtocolClientSideTranslatorPB(org.apache.hadoop.ozone.protocolPB.StorageContainerDatanodeProtocolClientSideTranslatorPB) LegacyHadoopConfigurationSource(org.apache.hadoop.hdds.utils.LegacyHadoopConfigurationSource) StorageContainerDatanodeProtocolPB(org.apache.hadoop.ozone.protocolPB.StorageContainerDatanodeProtocolPB)

Example 3 with StorageContainerDatanodeProtocolPB

use of org.apache.hadoop.ozone.protocolPB.StorageContainerDatanodeProtocolPB in project ozone by apache.

the class SCMThroughputBenchmark method createDatanodeScmClient.

private StorageContainerDatanodeProtocol createDatanodeScmClient() throws IOException {
    int dnPort = conf.getInt(OZONE_SCM_DATANODE_PORT_KEY, OZONE_SCM_DATANODE_PORT_DEFAULT);
    InetSocketAddress scmAddress = NetUtils.createSocketAddr(scm, dnPort);
    Configuration hadoopConfig = LegacyHadoopConfigurationSource.asHadoopConfiguration(this.conf);
    RPC.setProtocolEngine(hadoopConfig, StorageContainerDatanodeProtocolPB.class, ProtobufRpcEngine.class);
    long version = RPC.getProtocolVersion(StorageContainerDatanodeProtocolPB.class);
    SCMClientConfig scmClientConfig = conf.getObject(SCMClientConfig.class);
    int rpcTimeout = (int) scmClientConfig.getRpcTimeOut();
    RetryPolicy retryPolicy = RetryPolicies.retryUpToMaximumCountWithFixedSleep(getScmRpcRetryCount(conf), getScmRpcRetryInterval(conf), TimeUnit.MILLISECONDS);
    StorageContainerDatanodeProtocolPB rpcProxy = RPC.getProtocolProxy(StorageContainerDatanodeProtocolPB.class, version, scmAddress, UserGroupInformation.getCurrentUser(), hadoopConfig, NetUtils.getDefaultSocketFactory(hadoopConfig), rpcTimeout, retryPolicy).getProxy();
    return new StorageContainerDatanodeProtocolClientSideTranslatorPB(rpcProxy);
}
Also used : StorageContainerDatanodeProtocolClientSideTranslatorPB(org.apache.hadoop.ozone.protocolPB.StorageContainerDatanodeProtocolClientSideTranslatorPB) SCMClientConfig(org.apache.hadoop.hdds.scm.proxy.SCMClientConfig) Configuration(org.apache.hadoop.conf.Configuration) OzoneConfiguration(org.apache.hadoop.hdds.conf.OzoneConfiguration) InetSocketAddress(java.net.InetSocketAddress) RetryPolicy(org.apache.hadoop.io.retry.RetryPolicy) StorageContainerDatanodeProtocolPB(org.apache.hadoop.ozone.protocolPB.StorageContainerDatanodeProtocolPB)

Aggregations

StorageContainerDatanodeProtocolClientSideTranslatorPB (org.apache.hadoop.ozone.protocolPB.StorageContainerDatanodeProtocolClientSideTranslatorPB)3 StorageContainerDatanodeProtocolPB (org.apache.hadoop.ozone.protocolPB.StorageContainerDatanodeProtocolPB)3 Configuration (org.apache.hadoop.conf.Configuration)2 RetryPolicy (org.apache.hadoop.io.retry.RetryPolicy)2 InetSocketAddress (java.net.InetSocketAddress)1 OzoneConfiguration (org.apache.hadoop.hdds.conf.OzoneConfiguration)1 SCMClientConfig (org.apache.hadoop.hdds.scm.proxy.SCMClientConfig)1 LegacyHadoopConfigurationSource (org.apache.hadoop.hdds.utils.LegacyHadoopConfigurationSource)1 EndpointStateMachine (org.apache.hadoop.ozone.container.common.statemachine.EndpointStateMachine)1