diff --git a/locator/ec2_multi_region_snitch.cc b/locator/ec2_multi_region_snitch.cc index f0b399cc47..b01bc2373f 100644 --- a/locator/ec2_multi_region_snitch.cc +++ b/locator/ec2_multi_region_snitch.cc @@ -20,7 +20,8 @@ static constexpr const char* PRIVATE_MAC_QUERY = "/latest/meta-data/network/inte namespace locator { ec2_multi_region_snitch::ec2_multi_region_snitch(const snitch_config& cfg) - : ec2_snitch(cfg) {} + : ec2_snitch(cfg) + , _broadcast_rpc_address_specified_by_user(cfg.broadcast_rpc_address_specified_by_user) {} future<> ec2_multi_region_snitch::start() { _state = snitch_state::initializing; @@ -61,7 +62,9 @@ future<> ec2_multi_region_snitch::start() { // value to a public address in cassandra.yaml. // utils::fb_utilities::set_broadcast_address(local_public_address); - utils::fb_utilities::set_broadcast_rpc_address(local_public_address); + if (!_broadcast_rpc_address_specified_by_user) { + utils::fb_utilities::set_broadcast_rpc_address(local_public_address); + } if (!local_public_address.addr().is_ipv6()) { sstring priv_addr = aws_api_call(AWS_QUERY_SERVER_ADDR, AWS_QUERY_SERVER_PORT, PRIVATE_IP_QUERY_REQ).get0(); diff --git a/locator/ec2_multi_region_snitch.hh b/locator/ec2_multi_region_snitch.hh index 7e8db3b640..2fca3914e3 100644 --- a/locator/ec2_multi_region_snitch.hh +++ b/locator/ec2_multi_region_snitch.hh @@ -24,5 +24,6 @@ public: } private: sstring _local_private_address; + bool _broadcast_rpc_address_specified_by_user; }; } // namespace locator diff --git a/locator/snitch_base.hh b/locator/snitch_base.hh index e3bc9f5888..e37392c40a 100644 --- a/locator/snitch_base.hh +++ b/locator/snitch_base.hh @@ -45,6 +45,7 @@ struct snitch_config { sstring name = "SimpleSnitch"; sstring properties_file_name = ""; unsigned io_cpu_id = 0; + bool broadcast_rpc_address_specified_by_user = false; // GCE-specific sstring gce_meta_server_url = ""; diff --git a/main.cc b/main.cc index 9c49d61a5a..ac6d6e8347 100644 --- a/main.cc +++ b/main.cc @@ -870,6 +870,7 @@ To start the scylla server proper, simply invoke as: scylla server (or just scyl supervisor::notify("creating snitch"); snitch_config snitch_cfg; snitch_cfg.name = cfg->endpoint_snitch(); + snitch_cfg.broadcast_rpc_address_specified_by_user = !cfg->broadcast_rpc_address().empty(); sharded& snitch = i_endpoint_snitch::snitch_instance(); snitch.start(snitch_cfg, std::ref(gossiper)).get(); auto stop_snitch = defer_verbose_shutdown("snitch", [&snitch] {