Add storage port options to sstableloader
patch by Eduard Tudenhoefner; reviewed by Alex Petrov for CASSANDRA-13844
diff --git a/CHANGES.txt b/CHANGES.txt
index 4f8f65f..848628b 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.1.19
+ * Add storage port options to sstableloader (CASSANDRA-13844)
* Remove stress-test target in CircleCI as it's not existing (CASSANDRA-13775)
* Clone HeartBeatState when building gossip messages. Make its generation/version volatile (CASSANDRA-13700)
diff --git a/src/java/org/apache/cassandra/tools/BulkLoader.java b/src/java/org/apache/cassandra/tools/BulkLoader.java
index 0b1a1d4..52f9467 100644
--- a/src/java/org/apache/cassandra/tools/BulkLoader.java
+++ b/src/java/org/apache/cassandra/tools/BulkLoader.java
@@ -56,6 +56,8 @@
private static final String IGNORE_NODES_OPTION = "ignore";
private static final String INITIAL_HOST_ADDRESS_OPTION = "nodes";
private static final String RPC_PORT_OPTION = "port";
+ private static final String STORAGE_PORT_OPTION = "storage-port";
+ private static final String SSL_STORAGE_PORT_OPTION = "ssl-storage-port";
private static final String USER_OPTION = "username";
private static final String PASSWD_OPTION = "password";
private static final String THROTTLE_MBITS = "throttle";
@@ -399,7 +401,7 @@
public boolean debug;
public boolean verbose;
public boolean noProgress;
- public int rpcPort = 9160;
+ public int rpcPort;
public String user;
public String passwd;
public int throttle = 0;
@@ -462,9 +464,6 @@
opts.verbose = cmd.hasOption(VERBOSE_OPTION);
opts.noProgress = cmd.hasOption(NOPROGRESS_OPTION);
- if (cmd.hasOption(RPC_PORT_OPTION))
- opts.rpcPort = Integer.parseInt(cmd.getOptionValue(RPC_PORT_OPTION));
-
if (cmd.hasOption(USER_OPTION))
opts.user = cmd.getOptionValue(USER_OPTION);
@@ -532,13 +531,38 @@
config.stream_throughput_outbound_megabits_per_sec = 0;
config.inter_dc_stream_throughput_outbound_megabits_per_sec = 0;
}
- opts.storagePort = config.storage_port;
- opts.sslStoragePort = config.ssl_storage_port;
opts.throttle = config.stream_throughput_outbound_megabits_per_sec;
opts.interDcThrottle = config.inter_dc_stream_throughput_outbound_megabits_per_sec;
opts.encOptions = config.client_encryption_options;
opts.serverEncOptions = config.server_encryption_options;
+ if (cmd.hasOption(RPC_PORT_OPTION))
+ {
+ opts.rpcPort = Integer.parseInt(cmd.getOptionValue(RPC_PORT_OPTION));
+ }
+ else
+ {
+ opts.rpcPort = config.rpc_port;
+ }
+
+ if (cmd.hasOption(STORAGE_PORT_OPTION))
+ {
+ opts.storagePort = Integer.parseInt(cmd.getOptionValue(STORAGE_PORT_OPTION));
+ }
+ else
+ {
+ opts.storagePort = config.storage_port;
+ }
+
+ if (cmd.hasOption(SSL_STORAGE_PORT_OPTION))
+ {
+ opts.sslStoragePort = Integer.parseInt(cmd.getOptionValue(SSL_STORAGE_PORT_OPTION));
+ }
+ else
+ {
+ opts.sslStoragePort = config.ssl_storage_port;
+ }
+
if (cmd.hasOption(THROTTLE_MBITS))
{
opts.throttle = Integer.parseInt(cmd.getOptionValue(THROTTLE_MBITS));
@@ -667,6 +691,8 @@
options.addOption("i", IGNORE_NODES_OPTION, "NODES", "don't stream to this (comma separated) list of nodes");
options.addOption("d", INITIAL_HOST_ADDRESS_OPTION, "initial hosts", "Required. try to connect to these hosts (comma separated) initially for ring information");
options.addOption("p", RPC_PORT_OPTION, "rpc port", "port used for rpc (default 9160)");
+ options.addOption("sp", STORAGE_PORT_OPTION, "storage port", "port used for internode communication (default 7000)");
+ options.addOption("ssp", SSL_STORAGE_PORT_OPTION, "ssl storage port", "port used for TLS internode communication (default 7001)");
options.addOption("t", THROTTLE_MBITS, "throttle", "throttle speed in Mbits (default unlimited)");
options.addOption("idct", INTER_DC_THROTTLE_MBITS, "inter-dc-throttle", "inter-datacenter throttle speed in Mbits (default unlimited)");
options.addOption("u", USER_OPTION, "username", "username for cassandra authentication");