你好,我刚开始使用ceph对象存储(例如radosgateway)弄脏我的手,为此目的,它衍生出了一个非常基本的单节点ceph / daemon docker容器,该容器对于s3cmd和java s3 API都非常适用(尽管在发出命令ceph mgr模块启用仪表板时容器已关闭,但mgr仪表板不起作用),但我似乎无法弄清楚的一件事是,如何为java s3客户端指定多个端点以连接到集群?与HTTP前端有关吗?请使用一些指针,否则示例示例将非常有用。以下是我的代码以连接到使用ceph / daemon映像的docker容器构建的单节点ceph集群。
String accessKey = "demoKey";
String secretKey = "demoKey";
try {
ClientConfiguration clientConfig = new ClientConfiguration();
clientConfig.setProtocol(Protocol.HTTP);
System.setProperty(SDKGlobalConfiguration.DISABLE_CERT_CHECKING_SYSTEM_PROPERTY,"true");
if (SDKGlobalConfiguration.isCertCheckingDisabled())
{
System.out.println("Cert checking is disabled");
}
AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey);
AmazonS3 conn = new AmazonS3Client(credentials);
conn.setEndpoint("http://ubuntu:8080"); //more than one endpoint ??
List<Bucket> buckets = conn.listBuckets();
for (Bucket bucket : buckets) {
System.out.println(bucket.getName() + "\t" +
StringUtils.fromDate(bucket.getCreationDate()));
}
}catch(Exception ex)
{
ex.printStackTrace();
}
最后是我的Ceph版本ceph版本14.2.4 nautilus(稳定)
我找到了一个不错的用例here。也许有帮助。看一下媒体存储体系结构。