zoukankan      html  css  js  c++  java
  • ceph rgw java sdk 使用域名访问服务时需要设置s3client的配置项 PathStyleAccess 为true, 负责将报域名异常


    Caused by: java.net.UnknownHostException: my-new-bucket.s3.yyclouds.com at java.net.InetAddress.getAllByName0(Unknown Source) at java.net.InetAddress.getAllByName(Unknown Source) at java.net.InetAddress.getAllByName(Unknown Source) at com.amazonaws.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:27) at com.amazonaws.http.DelegatingDnsResolver.resolve(DelegatingDnsResolver.java:38) at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:111) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353) ... 63 more 2017-01-23 17:43:19,479 DEBUG [com.amazonaws.request] - <Retrying Request: HEAD http://my-new-bucket.s3.yyclouds.com / Headers: (User-Agent: aws-sdk-java/1.11.69 Windows_8.1/6.3 Java_HotSpot(TM)_Client_VM/25.11-b03/1.8.0_11, amz-sdk-invocation-id: 5f381d32-1c29-95ba-007a-856a127d3362, Content-Type: application/octet-stream, ) > 2017-01-23 17:43:19,479 DEBUG [com.amazonaws.http.AmazonHttpClient] - <Retriable error detected, will retry in 59ms, attempt number: 2> 2017-01-23 17:43:19,538 DEBUG [com.amazonaws.auth.AWS4Signer] - <AWS4 Canonical Request: '"HEAD

     

    ceph rgw java sdk 使用域名访问服务时,如上默认情况下 bucket名会作为子域名,因为这个子域名未注册,所以无法访问。

    设置s3client的配置项 PathStyleAccess 为true 即可解决此问题

    代码 如下

    s3client.setEndpoint("http://s3.yyclouds.com");
    //使用域名时,需要如下设置
    s3client.setS3ClientOptions(S3ClientOptions.builder().setPathStyleAccess(true).build());
  • 相关阅读:
    Intellij IDEA 构建Spring Web项目 — 用户登录功能
    Intellij IDEA 快速创建Spring Web 项目
    Intellij Idea 创建Web项目入门(一)
    JavaScript for in的缺陷
    JavaScript判断对象是否含有某个属性
    【一小时入门】webpack 入门指南
    webpack实例与前端性能优化
    JavaScript splice() 方法
    JavaScript拆分字符串并将分割的数据放到数组中
    JavaScript中数组map()方法
  • 原文地址:https://www.cnblogs.com/bodhitree/p/6344640.html
Copyright © 2011-2022 走看看