xiaoyuyao commented on a change in pull request #333: HDDS-2279. Ozone S3 CLI
commands not working on HA cluster
URL: https://github.com/apache/hadoop-ozone/pull/333#discussion_r366016832
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/OzoneAddress.java
##########
@@ -124,6 +126,41 @@ public OzoneClient createClient(OzoneConfiguration conf)
return client;
}
+ /**
+ * Create OzoneClient for S3Commands.
+ * @param conf
+ * @param omServiceID
+ * @return OzoneClient
+ * @throws IOException
+ * @throws OzoneClientException
+ */
+ public OzoneClient createClientForS3Commands(OzoneConfiguration conf,
+ String omServiceID)
+ throws IOException, OzoneClientException {
+ if (omServiceID != null) {
+ // OM HA cluster
+ if (OmUtils.isOmHAServiceId(conf, omServiceID)) {
+ return OzoneClientFactory.getRpcClient(omServiceID, conf);
+ } else {
+ throw new OzoneClientException("Service ID specified does not match" +
+ " with " + OZONE_OM_SERVICE_IDS_KEY + " defined in the " +
+ "configuration. Configured " + OZONE_OM_SERVICE_IDS_KEY + " are" +
+ conf.getTrimmedStringCollection(OZONE_OM_SERVICE_IDS_KEY));
+ }
+ } else {
+ // If om service id is not specified, consider it as a non-HA cluster.
Review comment:
agree. Thanks for the context.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]