chungen0126 commented on code in PR #10757:
URL: https://github.com/apache/ozone/pull/10757#discussion_r3599859980
##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/local/LocalOzoneCluster.java:
##########
@@ -403,6 +473,74 @@ private void configureOmStorage(OzoneConfiguration conf)
throws IOException {
omMetadataDir.toString());
}
+ private List<OzoneConfiguration> configureDatanodes(OzoneConfiguration conf,
+ PersistedPortState persistedPorts, PortAllocator portAllocator)
+ throws IOException {
+ List<OzoneConfiguration> datanodeConfigurations =
+ new ArrayList<>(config.getDatanodes());
+ for (int index = 0; index < config.getDatanodes(); index++) {
+ datanodeConfigurations.add(
+ configureDatanode(conf, index, persistedPorts, portAllocator));
+ }
+ return datanodeConfigurations;
+ }
+
+ private OzoneConfiguration configureDatanode(OzoneConfiguration conf,
+ int index, PersistedPortState persistedPorts,
+ PortAllocator portAllocator) throws IOException {
+ OzoneConfiguration dnConf = new OzoneConfiguration(conf);
+ configureDatanodeStorage(dnConf, index);
+
+ dnConf.set(HDDS_DATANODE_HTTP_ADDRESS_KEY, address(config.getHost(),
+ reserveDatanodePort(portAllocator, persistedPorts, index,
+ DATANODE_HTTP_PORT_KEY_SUFFIX)));
+ dnConf.set(HDDS_DATANODE_HTTP_BIND_HOST_KEY, config.getBindHost());
+ dnConf.set(HDDS_DATANODE_CLIENT_ADDRESS_KEY, address(config.getHost(),
+ reserveDatanodePort(portAllocator, persistedPorts, index,
+ DATANODE_CLIENT_PORT_KEY_SUFFIX)));
+ dnConf.set(HDDS_DATANODE_CLIENT_BIND_HOST_KEY, config.getBindHost());
+ dnConf.setInt(HDDS_CONTAINER_IPC_PORT,
+ reserveDatanodePort(portAllocator, persistedPorts, index,
+ DATANODE_CONTAINER_IPC_PORT_KEY_SUFFIX));
+ dnConf.setInt(HDDS_CONTAINER_RATIS_IPC_PORT,
+ reserveDatanodePort(portAllocator, persistedPorts, index,
+ DATANODE_RATIS_IPC_PORT_KEY_SUFFIX));
+ dnConf.setInt(HDDS_CONTAINER_RATIS_ADMIN_PORT,
+ reserveDatanodePort(portAllocator, persistedPorts, index,
+ DATANODE_RATIS_ADMIN_PORT_KEY_SUFFIX));
+ dnConf.setInt(HDDS_CONTAINER_RATIS_SERVER_PORT,
+ reserveDatanodePort(portAllocator, persistedPorts, index,
+ DATANODE_RATIS_SERVER_PORT_KEY_SUFFIX));
+ dnConf.setInt(HDDS_CONTAINER_RATIS_DATASTREAM_PORT,
+ reserveDatanodePort(portAllocator, persistedPorts, index,
+ DATANODE_RATIS_DATASTREAM_PORT_KEY_SUFFIX));
Review Comment:
I think we should add an upper-bound limit on number of datanodes to prevent
accidental exhaustion. Since one datanode will reserve 8 ports on the local
machine.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]