From 8bf0a9cf92fc948825bc1b1bee96b409a27a872b Mon Sep 17 00:00:00 2001 From: Teon Banek Date: Fri, 6 Oct 2017 14:27:25 +0200 Subject: [PATCH] Fill the alpha.conf with all settings and document them Summary: This should be the basis for default configuration that is to be shipped in release builds/packages. Reviewers: mislav.bradac, florijan, buda, mferencevic Reviewed By: florijan Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D851 --- CMakeLists.txt | 4 +- config/alpha.conf | 28 -------------- config/community.conf | 89 +++++++++++++++++++++++++++++++++++++++++++ src/memgraph_bolt.cpp | 4 +- 4 files changed, 93 insertions(+), 32 deletions(-) delete mode 100644 config/alpha.conf create mode 100644 config/community.conf diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b40283f6..db8a0b8e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -317,8 +317,8 @@ if (MEMGRAPH) install(PROGRAMS ${CMAKE_BINARY_DIR}/${MEMGRAPH_BUILD_NAME} DESTINATION bin RENAME memgraph) # Install the config file. - install(FILES ${CMAKE_SOURCE_DIR}/config/alpha.conf - DESTINATION /etc/memgraph RENAME config) + install(FILES ${CMAKE_SOURCE_DIR}/config/community.conf + DESTINATION /etc/memgraph RENAME memgraph.conf) # Create empty directories for default location of snapshots and logs. install(CODE "file(MAKE_DIRECTORY \$ENV{DESTDIR}/var/log/memgraph \$ENV{DESTDIR}/var/lib/memgraph/snapshots)") diff --git a/config/alpha.conf b/config/alpha.conf deleted file mode 100644 index 2ff871fe2..000000000 --- a/config/alpha.conf +++ /dev/null @@ -1,28 +0,0 @@ -# MEMGRAPH DEFAULT ALPHA CONFIG - -# NOTE: all paths are relative to the run folder -# (where the executable is run) - -# path to the folder with snapshots ---snapshot-directory=/var/lib/memgraph/snapshots - -# snapshot cycle interval -# if set to -1 the snapshooter will not run ---snapshot-cycle-sec=300 - -# create snapshot disabled on db exit ---snapshot-on-exit=true - -# max number of snapshots which will be kept on the disk at some point -# if set to -1 the max number of snapshots is unlimited ---snapshot-max-retained=3 - -# true if the database should recover the latest snapshot on startup ---snapshot-recover-on-startup=true - -# cleaning cycle interval -# if set to -1 the GC will not run ---gc-cycle-sec=30 - -# path to where the log should be stored ---log-file=/var/log/memgraph/memgraph.log diff --git a/config/community.conf b/config/community.conf new file mode 100644 index 000000000..43fdc49cf --- /dev/null +++ b/config/community.conf @@ -0,0 +1,89 @@ +# Default Memgraph Configuration +# +# This is the default configuration for memgraph. Settings from this file will +# be overridden by a configuration file in '$HOME/.memgraph/config', so you can +# keep this file intact. Additional configuration can be specified in a file +# pointed to by 'MEMGRAPH_CONFIG' environment variable or by passing arguments +# on the command line. +# +# Each configuration setting is of the form: '--setting-name=value'. + +## Database + +# IP address the server should listen on. +--interface=0.0.0.0 + +# Port the server should listen on. +--port=7687 + +# Number of workers used by the Memgraph server. By default, this will be the +# number of processing units available on the machine. +# --num-workers=8 + +# Interval, in seconds, when the garbage collection (GC) should run. GC is used +# for releasing memory that is no longer needed. For example, deleted graph +# elements which cannot be seen by any running or new transactions. If set to +# -1 the GC will never run (use with caution, memory will never get released). +--gc-cycle-sec=30 + +# If Memgraph detects there is less available RAM than the given number in MB, +# it will log a warning. +--memory-warning-threshold=1024 + +## Query +# +# Various settings related to openCypher query execution. + +# Maximum allowed query execution time, in seconds. Any queries exceeding this +# limit will be aborted. Setting to -1 removes the limit. +--query-execution-time-sec=30 + +# Cache generated query execution plans. This speeds up planning repeated +# queries which produce multiple complex execution plans. The downside is that +# some executions may use inferior plans if the database state changed. To +# disable caching, set to false. +#--query-plan-cache=false + +# Time to live for cached query plans, in seconds. This tries to minimize the +# downside of caching by evicting old plans after the given time. +#--query-plan-cache-ttl=60 + +## Snapshot +# +# Snapshots store the database state to persistent storage. Snapshots are +# taken in intervals and can be used to restore the database to a previous +# state. + +# Interval of taking snapshots, in seconds. If set to -1, snapshot feature +# will be turned off. +--snapshot-cycle-sec=300 + +# Create a snapshot when closing Memgraph. +--snapshot-on-exit=true + +# Path to the directory where snapshots will be stored. +--snapshot-directory=/var/lib/memgraph/snapshots + +# Maximum number of kept snapshots. Old snapshots will be deleted to make room +# for new ones. If set to -1, the number of kept snapshots is unlimited. +--snapshot-max-retained=3 + +# Recover the database from the latest snapshot on startup. +--snapshot-recover-on-startup=true + +## Logging + +# Path to where the log should be stored. +--log-file=/var/log/memgraph/memgraph.log + +# If true, log messages will go to stderr in addition to logfiles. +#--also-log-to-stderr=true + +## Additional Configuration Inclusion + +# Include additional configuration from this file. Settings with the same name +# will override previously read values. Note, that reading the configuration, +# which called '--flag-file' will continue after inclusion. Therefore, settings +# after '--flag-file' may override the included ones. +#--flag-file=another.conf + diff --git a/src/memgraph_bolt.cpp b/src/memgraph_bolt.cpp index ff0dd6b9d..eb28d6bab 100644 --- a/src/memgraph_bolt.cpp +++ b/src/memgraph_bolt.cpp @@ -47,13 +47,13 @@ DEFINE_uint64(memory_warning_threshold, 1024, "disable."); // Load flags in this order, the last one has the highest priority: -// 1) /etc/memgraph/config +// 1) /etc/memgraph/memgraph.conf // 2) ~/.memgraph/config // 3) env - MEMGRAPH_CONFIG // 4) command line flags void load_config(int &argc, char **&argv) { - std::vector configs = {fs::path("/etc/memgraph/config")}; + std::vector configs = {fs::path("/etc/memgraph/memgraph.conf")}; if (getenv("HOME") != nullptr) configs.emplace_back(fs::path(getenv("HOME")) / fs::path(".memgraph/config"));