config: Enable storage_port option

This commit is contained in:
Asias He
2015-10-28 13:50:31 +08:00
parent 97d2bdf663
commit 2c8867c348
7 changed files with 13 additions and 13 deletions

View File

@@ -430,7 +430,7 @@ public:
, "org.apache.cassandra.dht.ByteOrderedPartitioner" \
, "org.apache.cassandra.dht.OrderPreservingPartitioner" \
) \
val(storage_port, uint16_t, 7000, Unused, \
val(storage_port, uint16_t, 7000, Used, \
"The port for inter-node communication." \
) \
/* Advanced automatic backup setting */ \

View File

@@ -43,10 +43,10 @@ future<> init_storage_service(distributed<database>& db) {
});
}
future<> init_ms_fd_gossiper(sstring listen_address, db::seed_provider_type seed_provider, sstring cluster_name) {
future<> init_ms_fd_gossiper(sstring listen_address, uint16_t port, db::seed_provider_type seed_provider, sstring cluster_name) {
const gms::inet_address listen(listen_address);
// Init messaging_service
return net::get_messaging_service().start(listen).then([]{
return net::get_messaging_service().start(listen, std::ref(port)).then([]{
// #293 - do not stop anything
//engine().at_exit([] { return net::get_messaging_service().stop(); });
}).then([] {

View File

@@ -27,4 +27,4 @@
#include "database.hh"
future<> init_storage_service(distributed<database>& db);
future<> init_ms_fd_gossiper(sstring listen_address, db::seed_provider_type seed_provider, sstring cluster_name = "Test Cluster");
future<> init_ms_fd_gossiper(sstring listen_address, uint16_t storage_port, db::seed_provider_type seed_provider, sstring cluster_name = "Test Cluster");

View File

@@ -197,6 +197,7 @@ int main(int ac, char** av) {
dht::set_global_partitioner(cfg->partitioner());
auto start_thrift = cfg->start_rpc();
uint16_t api_port = cfg->api_port();
uint16_t storage_port = cfg->storage_port();
ctx.api_dir = cfg->api_ui_dir();
ctx.api_doc = cfg->api_doc_dir();
sstring cluster_name = cfg->cluster_name();
@@ -235,8 +236,8 @@ int main(int ac, char** av) {
});
});
});
}).then([listen_address, seed_provider, cluster_name] {
return init_ms_fd_gossiper(listen_address, seed_provider, cluster_name);
}).then([listen_address, storage_port, seed_provider, cluster_name] {
return init_ms_fd_gossiper(listen_address, storage_port, seed_provider, cluster_name);
}).then([&db] {
return streaming::stream_session::init_streaming_service(db);
}).then([&proxy, &db] {

View File

@@ -235,9 +235,9 @@ bool messaging_service::knows_version(const gms::inet_address& endpoint) const {
return true;
}
messaging_service::messaging_service(gms::inet_address ip)
messaging_service::messaging_service(gms::inet_address ip, uint16_t port)
: _listen_address(ip)
, _port(_default_port)
, _port(port)
, _rpc(new rpc_protocol_wrapper(serializer{}))
, _server(new rpc_protocol_server_wrapper(*_rpc, ipv4_addr{_listen_address.raw_addr(), _port})) {
}

View File

@@ -430,7 +430,6 @@ public:
bool knows_version(const gms::inet_address& endpoint) const;
private:
static constexpr uint16_t _default_port = 7000;
gms::inet_address _listen_address;
uint16_t _port;
// map: Node broadcast address -> Node internal IP for communication within the same data center
@@ -440,7 +439,7 @@ private:
std::array<clients_map, 2> _clients;
uint64_t _dropped_messages[static_cast<int32_t>(messaging_verb::LAST)] = {};
public:
messaging_service(gms::inet_address ip = gms::inet_address("0.0.0.0"));
messaging_service(gms::inet_address ip = gms::inet_address("0.0.0.0"), uint16_t port = 7000);
~messaging_service();
public:
uint16_t port();

View File

@@ -56,10 +56,10 @@ static future<> tst_init_storage_service(distributed<database>& db) {
});
}
static future<> tst_init_ms_fd_gossiper(sstring listen_address, db::seed_provider_type seed_provider, sstring cluster_name = "Test Cluster") {
static future<> tst_init_ms_fd_gossiper(sstring listen_address, uint16_t port, db::seed_provider_type seed_provider, sstring cluster_name = "Test Cluster") {
const gms::inet_address listen(listen_address);
// Init messaging_service
return net::get_messaging_service().start(listen).then([]{
return net::get_messaging_service().start(listen, std::ref(port)).then([]{
engine().at_exit([] { return net::get_messaging_service().stop(); });
}).then([] {
// Init failure_detector
@@ -98,7 +98,7 @@ future<> init_once(shared_ptr<distributed<database>> db) {
// FIXME: we leak db, since we're initializing the global storage_service with it.
new shared_ptr<distributed<database>>(db);
return tst_init_storage_service(*db).then([] {
return tst_init_ms_fd_gossiper("127.0.0.1", db::config::seed_provider_type());
return tst_init_ms_fd_gossiper("127.0.0.1", 7000, db::config::seed_provider_type());
}).then([] {
return db::system_keyspace::init_local_cache();
});