HDDS-2047. Datanodes fail to come up after 10 retries in a secure env… (#1379)
This commit is contained in:
parent
c929b383f8
commit
ec34cee5e3
@ -30,6 +30,7 @@
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.apache.hadoop.classification.InterfaceAudience;
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.classification.InterfaceStability;
|
import org.apache.hadoop.classification.InterfaceStability;
|
||||||
@ -43,6 +44,8 @@
|
|||||||
import org.apache.hadoop.hdds.protocol.SCMSecurityProtocol;
|
import org.apache.hadoop.hdds.protocol.SCMSecurityProtocol;
|
||||||
import org.apache.hadoop.hdds.scm.protocolPB.ScmBlockLocationProtocolPB;
|
import org.apache.hadoop.hdds.scm.protocolPB.ScmBlockLocationProtocolPB;
|
||||||
import org.apache.hadoop.hdfs.DFSConfigKeys;
|
import org.apache.hadoop.hdfs.DFSConfigKeys;
|
||||||
|
import org.apache.hadoop.io.retry.RetryPolicies;
|
||||||
|
import org.apache.hadoop.io.retry.RetryPolicy;
|
||||||
import org.apache.hadoop.ipc.Client;
|
import org.apache.hadoop.ipc.Client;
|
||||||
import org.apache.hadoop.ipc.ProtobufRpcEngine;
|
import org.apache.hadoop.ipc.ProtobufRpcEngine;
|
||||||
import org.apache.hadoop.ipc.RPC;
|
import org.apache.hadoop.ipc.RPC;
|
||||||
@ -177,23 +180,27 @@ public static InetSocketAddress getScmAddressForBlockClients(
|
|||||||
/**
|
/**
|
||||||
* Create a scm security client.
|
* Create a scm security client.
|
||||||
* @param conf - Ozone configuration.
|
* @param conf - Ozone configuration.
|
||||||
* @param address - inet socket address of scm.
|
|
||||||
*
|
*
|
||||||
* @return {@link SCMSecurityProtocol}
|
* @return {@link SCMSecurityProtocol}
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public static SCMSecurityProtocolClientSideTranslatorPB getScmSecurityClient(
|
public static SCMSecurityProtocolClientSideTranslatorPB getScmSecurityClient(
|
||||||
OzoneConfiguration conf, InetSocketAddress address) throws IOException {
|
OzoneConfiguration conf) throws IOException {
|
||||||
RPC.setProtocolEngine(conf, SCMSecurityProtocolPB.class,
|
RPC.setProtocolEngine(conf, SCMSecurityProtocolPB.class,
|
||||||
ProtobufRpcEngine.class);
|
ProtobufRpcEngine.class);
|
||||||
long scmVersion =
|
long scmVersion =
|
||||||
RPC.getProtocolVersion(ScmBlockLocationProtocolPB.class);
|
RPC.getProtocolVersion(ScmBlockLocationProtocolPB.class);
|
||||||
|
InetSocketAddress address =
|
||||||
|
getScmAddressForSecurityProtocol(conf);
|
||||||
|
RetryPolicy retryPolicy =
|
||||||
|
RetryPolicies.retryForeverWithFixedSleep(
|
||||||
|
1000, TimeUnit.MILLISECONDS);
|
||||||
SCMSecurityProtocolClientSideTranslatorPB scmSecurityClient =
|
SCMSecurityProtocolClientSideTranslatorPB scmSecurityClient =
|
||||||
new SCMSecurityProtocolClientSideTranslatorPB(
|
new SCMSecurityProtocolClientSideTranslatorPB(
|
||||||
RPC.getProxy(SCMSecurityProtocolPB.class, scmVersion,
|
RPC.getProtocolProxy(SCMSecurityProtocolPB.class, scmVersion,
|
||||||
address, UserGroupInformation.getCurrentUser(),
|
address, UserGroupInformation.getCurrentUser(),
|
||||||
conf, NetUtils.getDefaultSocketFactory(conf),
|
conf, NetUtils.getDefaultSocketFactory(conf),
|
||||||
Client.getRpcTimeout(conf)));
|
Client.getRpcTimeout(conf), retryPolicy).getProxy());
|
||||||
return scmSecurityClient;
|
return scmSecurityClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,8 +272,7 @@ private void getSCMSignedCert(OzoneConfiguration config) {
|
|||||||
PKCS10CertificationRequest csr = getCSR(config);
|
PKCS10CertificationRequest csr = getCSR(config);
|
||||||
// TODO: For SCM CA we should fetch certificate from multiple SCMs.
|
// TODO: For SCM CA we should fetch certificate from multiple SCMs.
|
||||||
SCMSecurityProtocolClientSideTranslatorPB secureScmClient =
|
SCMSecurityProtocolClientSideTranslatorPB secureScmClient =
|
||||||
HddsUtils.getScmSecurityClient(config,
|
HddsUtils.getScmSecurityClient(config);
|
||||||
HddsUtils.getScmAddressForSecurityProtocol(config));
|
|
||||||
SCMGetCertResponseProto response = secureScmClient.
|
SCMGetCertResponseProto response = secureScmClient.
|
||||||
getDataNodeCertificateChain(datanodeDetails.getProtoBufMessage(),
|
getDataNodeCertificateChain(datanodeDetails.getProtoBufMessage(),
|
||||||
getEncodedString(csr));
|
getEncodedString(csr));
|
||||||
|
@ -48,10 +48,8 @@
|
|||||||
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
|
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
|
||||||
import org.apache.hadoop.hdds.protocol.DatanodeDetails;
|
import org.apache.hadoop.hdds.protocol.DatanodeDetails;
|
||||||
import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
|
import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
|
||||||
import org.apache.hadoop.hdds.protocol.SCMSecurityProtocol;
|
|
||||||
import org.apache.hadoop.hdds.protocol.proto.SCMSecurityProtocolProtos.SCMGetCertResponseProto;
|
import org.apache.hadoop.hdds.protocol.proto.SCMSecurityProtocolProtos.SCMGetCertResponseProto;
|
||||||
import org.apache.hadoop.hdds.protocolPB.SCMSecurityProtocolClientSideTranslatorPB;
|
import org.apache.hadoop.hdds.protocolPB.SCMSecurityProtocolClientSideTranslatorPB;
|
||||||
import org.apache.hadoop.hdds.protocolPB.SCMSecurityProtocolPB;
|
|
||||||
import org.apache.hadoop.hdds.scm.ScmInfo;
|
import org.apache.hadoop.hdds.scm.ScmInfo;
|
||||||
import org.apache.hadoop.hdds.scm.container.common.helpers.ExcludeList;
|
import org.apache.hadoop.hdds.scm.container.common.helpers.ExcludeList;
|
||||||
import org.apache.hadoop.hdds.scm.protocol.ScmBlockLocationProtocol;
|
import org.apache.hadoop.hdds.scm.protocol.ScmBlockLocationProtocol;
|
||||||
@ -183,7 +181,6 @@
|
|||||||
import static org.apache.hadoop.hdds.HddsConfigKeys.HDDS_BLOCK_TOKEN_ENABLED_DEFAULT;
|
import static org.apache.hadoop.hdds.HddsConfigKeys.HDDS_BLOCK_TOKEN_ENABLED_DEFAULT;
|
||||||
import static org.apache.hadoop.hdds.HddsUtils.getScmAddressForBlockClients;
|
import static org.apache.hadoop.hdds.HddsUtils.getScmAddressForBlockClients;
|
||||||
import static org.apache.hadoop.hdds.HddsUtils.getScmAddressForClients;
|
import static org.apache.hadoop.hdds.HddsUtils.getScmAddressForClients;
|
||||||
import static org.apache.hadoop.hdds.HddsUtils.getScmAddressForSecurityProtocol;
|
|
||||||
import static org.apache.hadoop.hdds.protocol.proto.HddsProtos.NodeState.HEALTHY;
|
import static org.apache.hadoop.hdds.protocol.proto.HddsProtos.NodeState.HEALTHY;
|
||||||
import static org.apache.hadoop.hdds.security.x509.certificates.utils.CertificateSignRequest.getEncodedString;
|
import static org.apache.hadoop.hdds.security.x509.certificates.utils.CertificateSignRequest.getEncodedString;
|
||||||
import static org.apache.hadoop.hdds.server.ServerUtils.updateRPCListenAddress;
|
import static org.apache.hadoop.hdds.server.ServerUtils.updateRPCListenAddress;
|
||||||
@ -951,29 +948,6 @@ private static ScmBlockLocationProtocol getScmBlockClient(
|
|||||||
conf);
|
conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a scm security client, used to get SCM signed certificate.
|
|
||||||
*
|
|
||||||
* @return {@link SCMSecurityProtocol}
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
private static SCMSecurityProtocolClientSideTranslatorPB
|
|
||||||
getScmSecurityClient(OzoneConfiguration conf) throws IOException {
|
|
||||||
RPC.setProtocolEngine(conf, SCMSecurityProtocolPB.class,
|
|
||||||
ProtobufRpcEngine.class);
|
|
||||||
long scmVersion =
|
|
||||||
RPC.getProtocolVersion(ScmBlockLocationProtocolPB.class);
|
|
||||||
InetSocketAddress scmSecurityProtoAdd =
|
|
||||||
getScmAddressForSecurityProtocol(conf);
|
|
||||||
SCMSecurityProtocolClientSideTranslatorPB scmSecurityClient =
|
|
||||||
new SCMSecurityProtocolClientSideTranslatorPB(
|
|
||||||
RPC.getProxy(SCMSecurityProtocolPB.class, scmVersion,
|
|
||||||
scmSecurityProtoAdd, UserGroupInformation.getCurrentUser(),
|
|
||||||
conf, NetUtils.getDefaultSocketFactory(conf),
|
|
||||||
Client.getRpcTimeout(conf)));
|
|
||||||
return scmSecurityClient;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a scm container client.
|
* Returns a scm container client.
|
||||||
*
|
*
|
||||||
@ -1563,7 +1537,7 @@ private static void getSCMSignedCert(CertificateClient client,
|
|||||||
omDetailsProtoBuilder.build();
|
omDetailsProtoBuilder.build();
|
||||||
LOG.info("OzoneManager ports added:{}", omDetailsProto.getPortsList());
|
LOG.info("OzoneManager ports added:{}", omDetailsProto.getPortsList());
|
||||||
SCMSecurityProtocolClientSideTranslatorPB secureScmClient =
|
SCMSecurityProtocolClientSideTranslatorPB secureScmClient =
|
||||||
getScmSecurityClient(config);
|
HddsUtils.getScmSecurityClient(config);
|
||||||
|
|
||||||
SCMGetCertResponseProto response = secureScmClient.
|
SCMGetCertResponseProto response = secureScmClient.
|
||||||
getOMCertChain(omDetailsProto, getEncodedString(csr));
|
getOMCertChain(omDetailsProto, getEncodedString(csr));
|
||||||
|
Loading…
Reference in New Issue
Block a user