Sonatype Nexus:如何使用 Amazon S3 创建 Blob 存储?

Sonatype Nexus:如何使用 Amazon S3 创建 Blob 存储?

我尝试在 Sonatype Nexus 上创建一个 blob 存储,如下所示:

创建 Nexus Blob 存储步骤

然后,我收到此错误:

创建 Nexus Blob 存储错误

无法初始化 Blob 存储桶:s3jenkins-cache,原因:无法
执行 HTTP 请求:连接到
s3jenkins-cache.s3.ap-northeast-2.amazonaws.com:443
[s3jenkins-cache.s3.ap-northeast-2.amazonaws.com/52.219.56.35] 失败:
连接超时

  • 访问密钥工作正常。
  • Nexus 在 AWS EC2 上运行。
  • 访问密钥在 AWS S3 中拥有完全权限。
  • 关于网络,我可以手动将文件从 Nexus EC2 推送到 S3 存储库。

我想知道我错过了什么?有人已经做到了。非常感谢

访问密钥在 S3 中具有完全权限。

更多 Nexus 日志详细信息:

Caused by: com.amazonaws.SdkClientException: Unable to execute HTTP
> request: Connect to
> s3jenkins-cache.s3.ap-northeast-2.amazonaws.com:443
> [s3jenkins-cache.s3.ap-northeast-2.amazonaws.com/52.219.56.35] failed:
> connect timed out     at
> com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleRetryableException(AmazonHttpClient.java:1113)
>   at
> com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1063)
>   at
> com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:743)
>   at
> com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:717)
>   at
> com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:699)
>   at
> com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:667)
>   at
> com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:649)
>   at
> com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:513)
>   at
> com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4247)
>   at
> com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4194)
>   at
> com.amazonaws.services.s3.AmazonS3Client.headBucket(AmazonS3Client.java:1326)
>   at
> com.amazonaws.services.s3.AmazonS3Client.doesBucketExist(AmazonS3Client.java:1266)
>   at
> org.sonatype.nexus.blobstore.s3.internal.S3BlobStore.init(S3BlobStore.java:474)
>   ... 106 common frames omitted Caused by:
> org.apache.http.conn.ConnectTimeoutException: Connect to
> s3jenkins-cache.s3.ap-northeast-2.amazonaws.com:443
> [s3jenkins-cache.s3.ap-northeast-2.amazonaws.com/52.219.56.35] failed:
> connect timed out     at
> org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:151)
>   at
> org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:373)
>   at sun.reflect.GeneratedMethodAccessor754.invoke(Unknown Source)    at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)     at
> com.amazonaws.http.conn.ClientConnectionManagerFactory$Handler.invoke(ClientConnectionManagerFactory.java:76)
>   at com.amazonaws.http.conn.$Proxy244.connect(Unknown Source)    at
> org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:381)
>   at
> org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:237)
>   at
> org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
>   at
> org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
>   at
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
>   at
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
>   at
> com.amazonaws.http.apache.client.impl.SdkHttpClient.execute(SdkHttpClient.java:72)
>   at
> com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1235)
>   at
> com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1055)
>   ... 117 common frames omitted Caused by:
> java.net.SocketTimeoutException: connect timed out    at
> java.net.PlainSocketImpl.socketConnect(Native Method)     at
> java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
>   at
> java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
>   at
> java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
>   at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)   at
> java.net.Socket.connect(Socket.java:589)  at
> org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:339)
>   at
> com.amazonaws.http.conn.ssl.SdkTLSSocketFactory.connectSocket(SdkTLSSocketFactory.java:132)
>   at
> org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)

答案1

在最新版本的 Nexus (>3.12) 中,S3 集成已内置。您只需创建一个策略并在 AWS 中附加该策略,然后创建 S3 存储桶。然后在 Nexus 中添加您的 S3 存储桶详细信息。您也可以参考这个详细的指南

相关内容