Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove http2 #3713

Merged
merged 12 commits into from
Feb 14, 2022
2 changes: 0 additions & 2 deletions conf/nebula-graphd.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@
--ws_ip=0.0.0.0
# HTTP service port
--ws_http_port=19669
# HTTP2 service port
--ws_h2_port=19670
# storage client timeout
--storage_client_timeout_ms=60000
# Port to listen on Meta with HTTP protocol, it corresponds to ws_http_port in metad's configuration file
Expand Down
2 changes: 0 additions & 2 deletions conf/nebula-graphd.conf.production
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@
--ws_ip=0.0.0.0
# HTTP service port
--ws_http_port=19669
# HTTP2 service port
--ws_h2_port=19670
# storage client timeout
--storage_client_timeout_ms=60000
# Port to listen on Meta with HTTP protocol, it corresponds to ws_http_port in metad's configuration file
Expand Down
2 changes: 0 additions & 2 deletions conf/nebula-metad.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
--ws_ip=0.0.0.0
# HTTP service port
--ws_http_port=19559
# HTTP2 service port
--ws_h2_port=19560
# Port to listen on Storage with HTTP protocol, it corresponds to ws_http_port in storage's configuration file
--ws_storage_http_port=19779

Expand Down
2 changes: 0 additions & 2 deletions conf/nebula-metad.conf.production
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
--ws_ip=0.0.0.0
# HTTP service port
--ws_http_port=19559
# HTTP2 service port
--ws_h2_port=19560
# Port to listen on Storage with HTTP protocol, it corresponds to ws_http_port in storage's configuration file
--ws_storage_http_port=19779

Expand Down
4 changes: 0 additions & 4 deletions conf/nebula-standalone.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,12 @@
--ws_ip=0.0.0.0
# HTTP service port
--ws_http_port=19669
# HTTP2 service port
--ws_h2_port=19670
# storage client timeout
--storage_client_timeout_ms=60000
# Port to listen on Meta with HTTP protocol, it corresponds to ws_http_port in metad's configuration file
--ws_meta_http_port=19559
# HTTP service port
--ws_storage_http_port=19779
# HTTP2 service port
--ws_storage_h2_port=19780
# heartbeat with meta service
--heartbeat_interval_secs=10

Expand Down
2 changes: 0 additions & 2 deletions conf/nebula-storaged-listener.conf.production
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
--ws_ip=192.168.2.4
# HTTP service port
--ws_http_port=19789
# HTTP2 service port
--ws_h2_port=19790
# heartbeat with meta service
--heartbeat_interval_secs=10

Expand Down
2 changes: 0 additions & 2 deletions conf/nebula-storaged.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@
--ws_ip=0.0.0.0
# HTTP service port
--ws_http_port=19779
# HTTP2 service port
--ws_h2_port=19780
# heartbeat with meta service
--heartbeat_interval_secs=10

Expand Down
2 changes: 0 additions & 2 deletions conf/nebula-storaged.conf.production
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@
--ws_ip=0.0.0.0
# HTTP service port
--ws_http_port=19779
# HTTP2 service port
--ws_h2_port=19780
# heartbeat with meta service
--heartbeat_interval_secs=10

Expand Down
1 change: 0 additions & 1 deletion src/clients/meta/MetaClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "webservice/Common.h"

DECLARE_int32(ws_meta_http_port);
DECLARE_int32(ws_meta_h2_port);

DEFINE_uint32(expired_time_factor, 5, "The factor of expired time based on heart beat interval");
DEFINE_int32(heartbeat_interval_secs, 10, "Heartbeat interval in seconds");
Expand Down
1 change: 0 additions & 1 deletion src/common/http/test/HttpClientTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class HttpClientTestEnv : public ::testing::Environment {
void SetUp() override {
FLAGS_ws_ip = "127.0.0.1";
FLAGS_ws_http_port = 0;
FLAGS_ws_h2_port = 0;
LOG(INFO) << "Starting web service...";
webSvc_ = std::make_unique<WebService>();

Expand Down
3 changes: 1 addition & 2 deletions src/daemons/MetaDaemonInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ DEFINE_int32(meta_num_worker_threads, 32, "Number of workers");
DEFINE_string(meta_data_path, "", "Root data path");
DECLARE_string(meta_server_addrs); // use define from grap flags.
DECLARE_int32(ws_meta_http_port);
DECLARE_int32(ws_meta_h2_port);
#endif

using nebula::web::PathParams;
Expand Down Expand Up @@ -185,6 +184,6 @@ nebula::Status initWebService(nebula::WebService* svc,
#ifndef BUILD_STANDALONE
return svc->start();
#else
return svc->start(FLAGS_ws_meta_http_port, FLAGS_ws_meta_h2_port);
return svc->start(FLAGS_ws_meta_http_port);
#endif
}
2 changes: 1 addition & 1 deletion src/daemons/StandAloneDaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ int main(int argc, char *argv[]) {
nebula::HostAddr localhost{FLAGS_local_ip, FLAGS_port};
LOG(INFO) << "Starting Graph HTTP Service";
auto webSvc = std::make_unique<nebula::WebService>();
status = webSvc->start(FLAGS_ws_http_port, FLAGS_ws_h2_port);
status = webSvc->start(FLAGS_ws_http_port);
if (!status.ok()) {
LOG(WARNING) << "Failed to start graph HTTP service";
return;
Expand Down
1 change: 0 additions & 1 deletion src/meta/http/MetaHttpIngestHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "webservice/WebService.h"

DECLARE_int32(ws_storage_http_port);
DECLARE_int32(ws_storage_h2_port);

namespace nebula {
namespace meta {
Expand Down
1 change: 0 additions & 1 deletion src/meta/http/test/MetaHttpDownloadHandlerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class MetaHttpDownloadHandlerTestEnv : public ::testing::Environment {
void SetUp() override {
FLAGS_ws_ip = "127.0.0.1";
FLAGS_ws_http_port = 0;
FLAGS_ws_h2_port = 0;
VLOG(1) << "Starting web service...";

rootPath_ = std::make_unique<fs::TempDir>("/tmp/MetaHttpDownloadHandler.XXXXXX");
Expand Down
1 change: 0 additions & 1 deletion src/meta/http/test/MetaHttpIngestHandlerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class MetaHttpIngestHandlerTestEnv : public ::testing::Environment {
void SetUp() override {
FLAGS_ws_ip = "127.0.0.1";
FLAGS_ws_http_port = 0;
FLAGS_ws_h2_port = 0;
VLOG(1) << "Starting web service...";

rootPath_ = std::make_unique<fs::TempDir>("/tmp/MetaHttpIngestHandler.XXXXXX");
Expand Down
1 change: 0 additions & 1 deletion src/meta/http/test/MetaHttpReplaceHandlerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class MetaHttpReplaceHandlerTestEnv : public ::testing::Environment {
public:
void SetUp() override {
FLAGS_ws_http_port = 0;
FLAGS_ws_h2_port = 0;
LOG(INFO) << "Starting web service...";
rootPath_ = std::make_unique<fs::TempDir>("/tmp/MetaHttpReplaceHandler.XXXXXX");
kv_ = MockCluster::initMetaKV(rootPath_->path());
Expand Down
2 changes: 1 addition & 1 deletion src/storage/StorageServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ bool StorageServer::initWebService() {
#ifndef BUILD_STANDALONE
auto status = webSvc_->start();
#else
auto status = webSvc_->start(FLAGS_ws_storage_http_port, FLAGS_ws_storage_h2_port);
auto status = webSvc_->start(FLAGS_ws_storage_http_port);
#endif
return status.ok();
}
Expand Down
1 change: 0 additions & 1 deletion src/storage/test/StorageHttpAdminHandlerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class StorageHttpAdminHandlerTestEnv : public ::testing::Environment {
void SetUp() override {
FLAGS_ws_ip = "127.0.0.1";
FLAGS_ws_http_port = 0;
FLAGS_ws_h2_port = 0;
rootPath_ = std::make_unique<fs::TempDir>("/tmp/StorageHttpAdminHandler.XXXXXX");
cluster_ = std::make_unique<mock::MockCluster>();
cluster_->initStorageKV(rootPath_->path());
Expand Down
1 change: 0 additions & 1 deletion src/storage/test/StorageHttpDownloadHandlerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class StorageHttpDownloadHandlerTestEnv : public ::testing::Environment {
void SetUp() override {
FLAGS_ws_ip = "127.0.0.1";
FLAGS_ws_http_port = 0;
FLAGS_ws_h2_port = 0;

rootPath_ = std::make_unique<fs::TempDir>("/tmp/StorageHttpDownloadHandler.XXXXXX");
cluster_ = std::make_unique<mock::MockCluster>();
Expand Down
1 change: 0 additions & 1 deletion src/storage/test/StorageHttpIngestHandlerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class StorageHttpIngestHandlerTestEnv : public ::testing::Environment {
void SetUp() override {
FLAGS_ws_ip = "127.0.0.1";
FLAGS_ws_http_port = 0;
FLAGS_ws_h2_port = 0;
VLOG(1) << "Starting web service...";

rootPath_ = std::make_unique<fs::TempDir>("/tmp/StorageHttpIngestHandler.XXXXXX");
Expand Down
1 change: 0 additions & 1 deletion src/storage/test/StorageHttpPropertyHandlerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class StorageHttpStatsHandlerTestEnv : public ::testing::Environment {
void SetUp() override {
FLAGS_ws_ip = "127.0.0.1";
FLAGS_ws_http_port = 0;
FLAGS_ws_h2_port = 0;
FLAGS_enable_rocksdb_statistics = true;
rootPath_ = std::make_unique<fs::TempDir>("/tmp/StorageHttpPropertyHandler.XXXXXX");
cluster_ = std::make_unique<mock::MockCluster>();
Expand Down
1 change: 0 additions & 1 deletion src/storage/test/StorageHttpStatsHandlerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class StorageHttpStatsHandlerTestEnv : public ::testing::Environment {
void SetUp() override {
FLAGS_ws_ip = "127.0.0.1";
FLAGS_ws_http_port = 0;
FLAGS_ws_h2_port = 0;
FLAGS_enable_rocksdb_statistics = true;
rootPath_ = std::make_unique<fs::TempDir>("/tmp/StorageHttpStatsHandler.XXXXXX");
cluster_ = std::make_unique<mock::MockCluster>();
Expand Down
2 changes: 0 additions & 2 deletions src/webservice/Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
#include <gflags/gflags.h>

DEFINE_int32(ws_meta_http_port, 11000, "Port to listen on Meta with HTTP protocol");
DEFINE_int32(ws_meta_h2_port, 11002, "Port to listen on Meta with HTTP/2 protocol");
DEFINE_int32(ws_storage_http_port, 12000, "Port to listen on Storage with HTTP protocol");
DEFINE_int32(ws_storage_h2_port, 12002, "Port to listen on Storage with HTTP/2 protocol");

namespace nebula {

Expand Down
12 changes: 3 additions & 9 deletions src/webservice/WebService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "webservice/StatusHandler.h"

DEFINE_int32(ws_http_port, 11000, "Port to listen on with HTTP protocol");
DEFINE_int32(ws_h2_port, 11002, "Port to listen on with HTTP/2 protocol");
DEFINE_string(ws_ip, "0.0.0.0", "IP/Hostname to bind to");
DEFINE_int32(ws_threads, 4, "Number of threads for the web service.");

Expand Down Expand Up @@ -61,7 +60,7 @@ WebService::~WebService() {
wsThread_->join();
}

Status WebService::start(uint16_t httpPort, uint16_t h2Port) {
Status WebService::start(uint16_t httpPort) {
if (started_) {
LOG(INFO) << "Web service has been started.";
return Status::OK();
Expand Down Expand Up @@ -92,7 +91,6 @@ Status WebService::start(uint16_t httpPort, uint16_t h2Port) {

std::vector<HTTPServer::IPConfig> ips = {
{SocketAddress(FLAGS_ws_ip, httpPort, true), HTTPServer::Protocol::HTTP},
{SocketAddress(FLAGS_ws_ip, h2Port, true), HTTPServer::Protocol::HTTP2},
};

CHECK_GT(FLAGS_ws_threads, 0) << "The number of webservice threads must be greater than zero";
Expand All @@ -118,16 +116,12 @@ Status WebService::start(uint16_t httpPort, uint16_t h2Port) {
server_->start(
[&]() {
auto addresses = server_->addresses();
CHECK_EQ(addresses.size(), 2UL);
CHECK_EQ(addresses.size(), 1UL);
if (FLAGS_ws_http_port == 0) {
FLAGS_ws_http_port = addresses[0].address.getPort();
}
if (FLAGS_ws_h2_port == 0) {
FLAGS_ws_h2_port = addresses[1].address.getPort();
}
LOG(INFO) << "Web service started on "
<< "HTTP[" << FLAGS_ws_http_port << "], "
<< "HTTP2[" << FLAGS_ws_h2_port << "]";
<< "HTTP[" << FLAGS_ws_http_port << "]";
{
std::lock_guard<std::mutex> g(mut);
serverStartedDone = true;
Expand Down
9 changes: 3 additions & 6 deletions src/webservice/WebService.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@
#include "common/base/Status.h"

DECLARE_int32(ws_http_port);
DECLARE_int32(ws_h2_port);
DECLARE_string(ws_ip);
DECLARE_int32(ws_threads);

#ifdef BUILD_STANDALONE
DECLARE_int32(ws_storage_http_port);
DECLARE_int32(ws_storage_h2_port);
DECLARE_int32(ws_storage_threads);
#endif

Expand Down Expand Up @@ -44,11 +42,10 @@ class WebService final {
}

// To start the global web server.
// Two ports would be bound, one for HTTP, another one for HTTP2.
// If FLAGS_ws_http_port or FLAGS_ws_h2_port is zero, an ephemeral port
// Two ports would be bound, one for HTTP.
// If FLAGS_ws_http_port is zero, an ephemeral port
// would be assigned and set back to the gflag, respectively.
NG_MUST_USE_RESULT Status start(uint16_t httpPort = FLAGS_ws_http_port,
uint16_t h2Port = FLAGS_ws_h2_port);
NG_MUST_USE_RESULT Status start(uint16_t httpPort = FLAGS_ws_http_port);

// Check whether web service is started
bool started() const {
Expand Down
1 change: 0 additions & 1 deletion src/webservice/test/FlagsAccessTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class FlagsAccessTestEnv : public ::testing::Environment {
public:
void SetUp() override {
FLAGS_ws_http_port = 0;
FLAGS_ws_h2_port = 0;
VLOG(1) << "Starting web service...";
webSvc_ = std::make_unique<WebService>();
auto status = webSvc_->start();
Expand Down
1 change: 0 additions & 1 deletion src/webservice/test/StatsReaderTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class StatsReaderTestEnv : public ::testing::Environment {
public:
void SetUp() override {
FLAGS_ws_http_port = 0;
FLAGS_ws_h2_port = 0;
VLOG(1) << "Starting web service...";
webSvc_ = std::make_unique<WebService>();
auto status = webSvc_->start();
Expand Down
1 change: 0 additions & 1 deletion src/webservice/test/StatusHandlerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class StatusHandlerTestEnv : public ::testing::Environment {
public:
void SetUp() override {
FLAGS_ws_http_port = 0;
FLAGS_ws_h2_port = 0;
VLOG(1) << "Starting web service...";

webSvc_ = std::make_unique<WebService>();
Expand Down
4 changes: 0 additions & 4 deletions tests/common/nebula_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,17 @@ def _format_nebula_command(self):
'pid_file': 'pids{}/nebula-{}.pid'.format(self.suffix_index, self.name),
'port': self.tcp_port,
'ws_http_port': self.http_port,
'ws_h2_port': self.https_port,
}
else:
process_params = {
'log_dir': 'logs{}'.format(self.suffix_index),
'pid_file': 'pids{}/nebula-{}.pid'.format(self.suffix_index, self.name),
'port': self.tcp_port,
'ws_http_port': self.http_port,
'ws_h2_port': self.https_port,
'meta_port': self.meta_port,
'ws_meta_http_port': self.meta_http_port,
'ws_meta_h2_port': self.meta_https_port,
'storage_port': self.storage_port,
'ws_storage_http_port': self.storage_http_port,
'ws_storage_h2_port': self.storage_https_port,
}
# data path
if self.name.upper() != 'GRAPHD':
Expand Down