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
This commit is contained in:
Teon Banek 2017-10-06 14:27:25 +02:00
parent da3e46c2d6
commit 8bf0a9cf92
4 changed files with 93 additions and 32 deletions

View File

@ -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)")

View File

@ -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

89
config/community.conf Normal file
View File

@ -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

View File

@ -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<fs::path> configs = {fs::path("/etc/memgraph/config")};
std::vector<fs::path> configs = {fs::path("/etc/memgraph/memgraph.conf")};
if (getenv("HOME") != nullptr)
configs.emplace_back(fs::path(getenv("HOME")) /
fs::path(".memgraph/config"));