Rename Bolt flags
Reviewers: teon.banek Reviewed By: teon.banek Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D2587
This commit is contained in:
parent
1aadebbb70
commit
eb38b4f373
@ -24,19 +24,25 @@
|
||||
#include "query/procedure/module.hpp"
|
||||
|
||||
// General purpose flags.
|
||||
DEFINE_string(interface, "0.0.0.0",
|
||||
"Communication interface on which to listen.");
|
||||
DEFINE_VALIDATED_int32(port, 7687, "Communication port on which to listen.",
|
||||
DEFINE_string(bolt_address, "0.0.0.0",
|
||||
"IP address on which the Bolt server should listen.");
|
||||
DEFINE_VALIDATED_int32(bolt_port, 7687,
|
||||
"Port on which the Bolt server should listen.",
|
||||
FLAG_IN_RANGE(0, std::numeric_limits<uint16_t>::max()));
|
||||
DEFINE_VALIDATED_int32(num_workers,
|
||||
std::max(std::thread::hardware_concurrency(), 1U),
|
||||
"Number of workers (Bolt)", FLAG_IN_RANGE(1, INT32_MAX));
|
||||
DEFINE_VALIDATED_int32(session_inactivity_timeout, 1800,
|
||||
"Time in seconds after which inactive sessions will be "
|
||||
"closed.",
|
||||
FLAG_IN_RANGE(1, INT32_MAX));
|
||||
DEFINE_string(cert_file, "", "Certificate file to use.");
|
||||
DEFINE_string(key_file, "", "Key file to use.");
|
||||
DEFINE_VALIDATED_int32(
|
||||
bolt_num_workers, std::max(std::thread::hardware_concurrency(), 1U),
|
||||
"Number of workers used by the Bolt server. By default, this will be the "
|
||||
"number of processing units available on the machine.",
|
||||
FLAG_IN_RANGE(1, INT32_MAX));
|
||||
DEFINE_VALIDATED_int32(
|
||||
bolt_session_inactivity_timeout, 1800,
|
||||
"Time in seconds after which inactive Bolt sessions will be "
|
||||
"closed.",
|
||||
FLAG_IN_RANGE(1, INT32_MAX));
|
||||
DEFINE_string(bolt_cert_file, "",
|
||||
"Certificate file which should be used for the Bolt server.");
|
||||
DEFINE_string(bolt_key_file, "",
|
||||
"Key file which should be used for the Bolt server.");
|
||||
|
||||
#ifdef MG_SINGLE_NODE_V2
|
||||
// General purpose flags.
|
||||
@ -202,14 +208,14 @@ void SingleNodeMain() {
|
||||
|
||||
ServerContext context;
|
||||
std::string service_name = "Bolt";
|
||||
if (FLAGS_key_file != "" && FLAGS_cert_file != "") {
|
||||
context = ServerContext(FLAGS_key_file, FLAGS_cert_file);
|
||||
if (!FLAGS_bolt_key_file.empty() && !FLAGS_bolt_cert_file.empty()) {
|
||||
context = ServerContext(FLAGS_bolt_key_file, FLAGS_bolt_cert_file);
|
||||
service_name = "BoltS";
|
||||
}
|
||||
|
||||
ServerT server({FLAGS_interface, static_cast<uint16_t>(FLAGS_port)},
|
||||
&session_data, &context, FLAGS_session_inactivity_timeout,
|
||||
service_name, FLAGS_num_workers);
|
||||
ServerT server({FLAGS_bolt_address, static_cast<uint16_t>(FLAGS_bolt_port)},
|
||||
&session_data, &context, FLAGS_bolt_session_inactivity_timeout,
|
||||
service_name, FLAGS_bolt_num_workers);
|
||||
|
||||
// Setup telemetry
|
||||
std::optional<telemetry::Telemetry> telemetry;
|
||||
|
@ -16,19 +16,25 @@
|
||||
#include "utils/flag_validation.hpp"
|
||||
|
||||
// General purpose flags.
|
||||
DEFINE_string(interface, "0.0.0.0",
|
||||
"Communication interface on which to listen.");
|
||||
DEFINE_VALIDATED_int32(port, 7687, "Communication port on which to listen.",
|
||||
DEFINE_string(bolt_address, "0.0.0.0",
|
||||
"IP address on which the Bolt server should listen.");
|
||||
DEFINE_VALIDATED_int32(bolt_port, 7687,
|
||||
"Port on which the Bolt server should listen.",
|
||||
FLAG_IN_RANGE(0, std::numeric_limits<uint16_t>::max()));
|
||||
DEFINE_VALIDATED_int32(num_workers,
|
||||
std::max(std::thread::hardware_concurrency(), 1U),
|
||||
"Number of workers (Bolt)", FLAG_IN_RANGE(1, INT32_MAX));
|
||||
DEFINE_VALIDATED_int32(session_inactivity_timeout, 1800,
|
||||
"Time in seconds after which inactive sessions will be "
|
||||
"closed.",
|
||||
FLAG_IN_RANGE(1, INT32_MAX));
|
||||
DEFINE_string(cert_file, "", "Certificate file to use (Bolt).");
|
||||
DEFINE_string(key_file, "", "Key file to use (Bolt).");
|
||||
DEFINE_VALIDATED_int32(
|
||||
bolt_num_workers, std::max(std::thread::hardware_concurrency(), 1U),
|
||||
"Number of workers used by the Bolt server. By default, this will be the "
|
||||
"number of processing units available on the machine.",
|
||||
FLAG_IN_RANGE(1, INT32_MAX));
|
||||
DEFINE_VALIDATED_int32(
|
||||
bolt_session_inactivity_timeout, 1800,
|
||||
"Time in seconds after which inactive Bolt sessions will be "
|
||||
"closed.",
|
||||
FLAG_IN_RANGE(1, INT32_MAX));
|
||||
DEFINE_string(bolt_cert_file, "",
|
||||
"Certificate file which should be used for the Bolt server.");
|
||||
DEFINE_string(bolt_key_file, "",
|
||||
"Key file which should be used for the Bolt server.");
|
||||
|
||||
using ServerT = communication::Server<BoltSession, SessionData>;
|
||||
using communication::ServerContext;
|
||||
@ -45,14 +51,14 @@ void SingleNodeHAMain() {
|
||||
|
||||
ServerContext context;
|
||||
std::string service_name = "Bolt";
|
||||
if (FLAGS_key_file != "" && FLAGS_cert_file != "") {
|
||||
context = ServerContext(FLAGS_key_file, FLAGS_cert_file);
|
||||
if (!FLAGS_bolt_key_file.empty() && !FLAGS_bolt_cert_file.empty()) {
|
||||
context = ServerContext(FLAGS_bolt_key_file, FLAGS_bolt_cert_file);
|
||||
service_name = "BoltS";
|
||||
}
|
||||
|
||||
ServerT server({FLAGS_interface, static_cast<uint16_t>(FLAGS_port)},
|
||||
&session_data, &context, FLAGS_session_inactivity_timeout,
|
||||
service_name, FLAGS_num_workers);
|
||||
ServerT server({FLAGS_bolt_address, static_cast<uint16_t>(FLAGS_bolt_port)},
|
||||
&session_data, &context, FLAGS_bolt_session_inactivity_timeout,
|
||||
service_name, FLAGS_bolt_num_workers);
|
||||
|
||||
// Handler for regular termination signals
|
||||
auto shutdown = [&db] { db.Shutdown(); };
|
||||
|
@ -31,7 +31,7 @@ fi
|
||||
$binary_dir/memgraph \
|
||||
--data-directory=$tmpdir \
|
||||
--query-execution-timeout-sec=5 \
|
||||
--session-inactivity-timeout=10 &
|
||||
--bolt-session-inactivity-timeout=10 &
|
||||
pid=$!
|
||||
wait_for_server 7687
|
||||
|
||||
|
@ -41,7 +41,7 @@ do
|
||||
$binary_dir/memgraph_ha --server_id $server_id \
|
||||
--coordination_config_file="coordination.json" \
|
||||
--raft_config_file="raft.json" \
|
||||
--port $((7686 + $server_id)) \
|
||||
--bolt-port $((7686 + $server_id)) \
|
||||
--db-recover-on-startup=false \
|
||||
--durability_directory=dur$server_id &
|
||||
HA_PIDS[$server_id]=$!
|
||||
|
@ -41,7 +41,7 @@ do
|
||||
$binary_dir/memgraph_ha --server_id $server_id \
|
||||
--coordination_config_file="coordination.json" \
|
||||
--raft_config_file="raft.json" \
|
||||
--port $((7686 + $server_id)) \
|
||||
--bolt-port $((7686 + $server_id)) \
|
||||
--db-recover-on-startup=false \
|
||||
--durability_directory=dur$server_id &
|
||||
HA_PIDS[$server_id]=$!
|
||||
|
@ -101,7 +101,7 @@ class HaTestBase:
|
||||
def _generate_args(self, worker_id):
|
||||
args = [self.memgraph_binary]
|
||||
args.extend(["--server_id", str(worker_id + 1)])
|
||||
args.extend(["--port", str(7687 + worker_id)])
|
||||
args.extend(["--bolt-port", str(7687 + worker_id)])
|
||||
args.extend(["--raft_config_file", self.raft_config_file])
|
||||
args.extend(["--coordination_config_file",
|
||||
self.coordination_config_file.name])
|
||||
|
@ -44,10 +44,10 @@ class Memgraph:
|
||||
|
||||
def start(self):
|
||||
self.log.info("start")
|
||||
database_args = ["--port", self.args.port,
|
||||
database_args = ["--bolt-port", self.args.port,
|
||||
"--query-execution-timeout-sec", "0"]
|
||||
if self.num_workers:
|
||||
database_args += ["--num_workers", str(self.num_workers)]
|
||||
database_args += ["--bolt-num-workers", str(self.num_workers)]
|
||||
if self.args.data_directory:
|
||||
database_args += ["--data-directory", self.args.data_directory]
|
||||
if self.args.storage_recover_on_startup:
|
||||
|
@ -40,11 +40,12 @@ class Memgraph:
|
||||
binary = os.path.join(BASE_DIR, "build_release", "memgraph")
|
||||
|
||||
# database args
|
||||
database_args = [binary, "--num-workers", self.num_workers,
|
||||
database_args = [binary,
|
||||
"--bolt-num-workers", self.num_workers,
|
||||
"--data-directory", os.path.join(self.dataset,
|
||||
"memgraph"),
|
||||
"--storage-recover-on-startup", "true",
|
||||
"--port", self.port]
|
||||
"--bolt-port", self.port]
|
||||
|
||||
# database env
|
||||
env = {"MEMGRAPH_CONFIG": os.path.join(SCRIPT_DIR, "config",
|
||||
|
@ -150,7 +150,7 @@ if args.use_ssl:
|
||||
|
||||
# start memgraph
|
||||
cwd = os.path.dirname(args.memgraph)
|
||||
cmd = [args.memgraph, "--num-workers=" + str(THREADS),
|
||||
cmd = [args.memgraph, "--bolt-num-workers=" + str(THREADS),
|
||||
"--storage-properties-on-edges=true",
|
||||
"--storage-snapshot-on-exit=true",
|
||||
"--storage-snapshot-interval-sec=600",
|
||||
@ -165,7 +165,7 @@ if args.log_file:
|
||||
if args.data_directory:
|
||||
cmd += ["--data-directory", args.data_directory]
|
||||
if args.use_ssl:
|
||||
cmd += ["--cert-file", CERT_FILE, "--key-file", KEY_FILE]
|
||||
cmd += ["--bolt-cert-file", CERT_FILE, "--bolt-key-file", KEY_FILE]
|
||||
proc_mg = subprocess.Popen(cmd, cwd = cwd)
|
||||
time.sleep(1.0)
|
||||
|
||||
|
@ -117,7 +117,7 @@ coordination_config_file = tempfile.NamedTemporaryFile(mode="w")
|
||||
def generate_cmd_args(worker_id):
|
||||
cmd = [args.memgraph]
|
||||
cmd.extend(["--server-id", str(worker_id + 1)])
|
||||
cmd.extend(["--port", str(PORT + worker_id)])
|
||||
cmd.extend(["--bolt-port", str(PORT + worker_id)])
|
||||
cmd.extend(["--raft-config-file", RAFT_CONFIG_FILE])
|
||||
cmd.extend(["--coordination-config-file", coordination_config_file.name])
|
||||
|
||||
|
@ -51,7 +51,7 @@ if not os.path.exists(args.memgraph):
|
||||
|
||||
# Memgraph run command construction
|
||||
cwd = os.path.dirname(args.memgraph)
|
||||
cmd = [args.memgraph, "--num-workers=" + str(DB_WORKERS),
|
||||
cmd = [args.memgraph, "--bolt-num-workers=" + str(DB_WORKERS),
|
||||
"--storage-properties-on-edges=true",
|
||||
"--storage-snapshot-on-exit=false",
|
||||
"--storage-snapshot-interval-sec=5",
|
||||
|
@ -72,7 +72,7 @@ fi
|
||||
|
||||
# Start the memgraph process and wait for it to start.
|
||||
echo_info "Starting memgraph"
|
||||
$memgraph_dir/memgraph --cert-file=$cert_file --key-file=$key_file &
|
||||
$memgraph_dir/memgraph --bolt-cert-file=$cert_file --bolt-key-file=$key_file &
|
||||
pid=$!
|
||||
wait_for_server 7687
|
||||
echo_success "Started memgraph"
|
||||
|
Loading…
Reference in New Issue
Block a user