您好,我刚刚开始使用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版本(稳定)