找不到hdfs fsck / command的可信证书

时间:2015-02-18 05:58:59

标签: java security hadoop ssl kerberos

我已经在windows中配置了使用kerberos保护的hadoop-2.6.0。一切正常。但是当我执行以下命令时

hdfs fsck / 

我遇到了异常。

异常

  

>   通过https://hostname:50470连接到namenode   线程“main”中的异常javax.net.ssl.SSLHandshakeException:sun.security.val   idator.ValidatorException:找不到可信证书           at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)           at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1884)           在sun.security.ssl.Handshaker.fatalSE(Handshaker.java:276)           在sun.security.ssl.Handshaker.fatalSE(Handshaker.java:270)           在sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker。   Java的:1341)           在sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.jav   一:153)           at sun.security.ssl.Handshaker.processLoop(Handshaker.java:868)           在sun.security.ssl.Handshaker.process_record(Handshaker.java:804)           at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1016)           在sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl。   的java:1312)           at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1339   )           at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1323   )           在sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:   563)           在sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect   (AbstractDelegateHttpsURLConnection.java:185)           at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLCon)   nectionImpl.java:153)           在org.apache.hadoop.security.authentication.client.KerberosAuthenticato   r.authenticate(KerberosAuthenticator.java:186)           在org.apache.hadoop.security.authentication.client.AuthenticatedURL.ope   nConnection(AuthenticatedURL.java:216)           在org.apache.hadoop.hdfs.web.URLConnectionFactory.openConnection(URLCon)   nectionFactory.java:164)           在org.apache.hadoop.hdfs.tools.DFSck.doWork(DFSck.java:303)           在org.apache.hadoop.hdfs.tools.DFSck.access $ 000(DFSck.java:72)           在org.apache.hadoop.hdfs.tools.DFSck $ 1.run(DFSck.java:145)           在org.apache.hadoop.hdfs.tools.DFSck $ 1.run(DFSck.java:142)           at java.security.AccessController.doPrivileged(Native Method)           在javax.security.auth.Subject.doAs(Subject.java:415)           在org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInforma   tion.java:1628)           在org.apache.hadoop.hdfs.tools.DFSck.run(DFSck.java:141)           在org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)           在org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:84)           在org.apache.hadoop.hdfs.tools.DFSck.main(DFSck.java:341)   引起:sun.security.validator.ValidatorException:没有可靠的证书   ND           在sun.security.validator.SimpleValidator.buildTrustedChain(SimpleValida   tor.java:384)           at sun.security.validator.SimpleValidator.engineValidate(SimpleValidator   的.java:134)           at sun.security.validator.Validator.validate(Validator.java:260)           at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.j   AVA:326)           at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerIm)   pl.java:231)           at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustMan)   agerImpl.java:107)           在org.apache.hadoop.security.ssl.ReloadingX509TrustManager.checkServerT   生锈(ReloadingX509TrustManager.java:129)           在sun.security.ssl.AbstractTrustManagerWrapper.checkServerTrusted(SSLCo   ntextImpl.java:813)           在sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker。   Java的:1323)           ......还有24个

我已从默认浏览器导出证书,并使用以下命令添加到密钥库中,但仍然面临同样的错误。

keytool -import -alias nncert -keystore c:\Java\jre\lib\security\cacerts -file nn.crt

帮我解决这个问题。

感谢。

1 个答案:

答案 0 :(得分:0)

我已按照this链接中的步骤解决了此问题。

导出证书后,应将其添加到java truststore%JAVA_HOME%\ jre \ lib \ security \ cacerts的默认位置,因为fsck命令使用ssl的默认位置。

希望这对某人有所帮助。