diff --git a/docs/user_technical/installation.md b/docs/user_technical/installation.md index e925b8289..59eb68dc0 100644 --- a/docs/user_technical/installation.md +++ b/docs/user_technical/installation.md @@ -30,31 +30,38 @@ The `-it` option enables displaying Memgraph's logs inside the current shell. The `-p` option is used to specify the port on which Memgraph will listen for requests. Memgraph uses the Bolt protocol for network communication, which uses port `7687` by default. The `` part are 3 numbers specifying the -version, e.g. `1.2.3`. +version, e.g. `1.2.3`. To always run the latest version, `:` part can +be omitted. + +``` +docker run -it -p 7687:7687 memgraph +``` It is recommended to perform some additional Docker configuration. Memgraph is currently an in-memory database management system, but it periodically stores all data to the hard drive. These storages are referred to as *snapshots* and are used for recovering data in case of a restart. -When starting Memgraph, a folder for snapshots needs to be created and mounted on the host file system. -This can be easily done using Docker's named volumes. For example: +When starting Memgraph, a folder for snapshots needs to be created and mounted +on the host file system. This can be easily done using Docker's named +volumes. For example: ``` # Run Memgraph. -docker run -p 7687:7687 -v mg_data:/var/lib/memgraph memgraph: +docker run -p 7687:7687 -v mg_data:/var/lib/memgraph memgraph ``` The `-v` option will make a named volume directory called `mg_data` and Memgraph will store snapshots there. Named volumes are usually found in -`/var/lib/docker/volumes`. +`/var/lib/docker/volumes`. This is the recommended way to create persistent +storage. The same can be achieved for logs and configuration. All supported volumes which can be mounted are: * `/var/lib/memgraph`, for storing snapshots; - * `/var/log/memgraph`, for storing logs and - * `/etc/memgraph`, for Memgraph configuration. + * `/var/log/memgraph`, for storing *full* logs and + * `/etc/memgraph`, for Memgraph configuration (in `memgraph.conf` file). Another way to expose the configuration and data is to use a full path to some directory on the system. In such a case, the directory first needs to be @@ -67,11 +74,14 @@ mkdir -m 777 mg_data # Docker expects full path to the created folder. FULL_OUTPUT_PATH=$PWD/mg_data # Run Memgraph. -docker run -p 7687:7687 -v ${FULL_OUTPUT_PATH}:/var/lib/memgraph memgraph: +docker run -p 7687:7687 -v ${FULL_OUTPUT_PATH}:/var/lib/memgraph memgraph ``` -In this example, `-v` mounts a host folder `$PWD/mg_data` to a path inside the Docker -container. +In this example, `-v` mounts a host folder `$PWD/mg_data` to a path inside the +Docker container. Note that full paths will not be initially populated with +files from the container. This means that if you expose the configuration +`/etc/memgraph` to a full path, the default configuration `memgraph.conf` will +be missing. To avoid confusion, using named volumes is preferred. Other than setting the configuration, it is also recommended to run the Docker container in the background. This is achieved with `-d` option. In such a @@ -80,7 +90,7 @@ easily found and shut down when needed. For example: ``` # Run Memgraph. -docker run -p 7687:7687 -d --name memgraph: +docker run -p 7687:7687 -d --name memgraph ``` ### Memgraph Configuration Parameters @@ -92,19 +102,24 @@ parameters: Name | Type | Default | Description -------|------|:-------:|------------- - --interface | string | "0.0.0.0" | Communication port on which to listen. + --interface | string | "0.0.0.0" | IP address on which to listen. --port | integer | 7687 | Communication port on which to listen. --num-workers | integer | CPU count[^1] | Number of Memgraph worker threads. - --log-file | string | "memgraph.log" | Path to where the log should be stored. - --snapshot-cycle-sec | integer | 300 | Interval (seconds) between database snapshots.
Value of -1 turns taking snapshots off. - --snapshot-max-retained | integer | 3 | Number of retained snapshots.
Value -1 means without limit. - --snapshot-on-exit | bool | false | Make a snapshot when closing Memgraph. - --snapshot-recover-on-startup | bool | false | Recover the database on startup using the last
stored snapshot. - --query-execution-time-sec | integer | 180 | Maximum allowed query execution time.
Queries exceeding this limit will be aborted. Value of -1 means no limit. + --gc-cycle-sec | integer | 30 | Interval, in seconds, when the garbage collection (GC) should run.
If set to -1 the GC will never run (use with caution, memory will never get released). --memory-warning-threshold | integer | 1024 | Memory warning threshold, in MB. If Memgraph detects there is less available RAM available it will log a warning. Set to 0 to disable. - --query-plan-cache | bool Cache generated query plans. + --query-execution-time-sec | integer | 30 | Maximum allowed query execution time, in seconds.
Queries exceeding this limit will be aborted. Value of -1 means no limit. + --query-plan-cache | bool | true | Cache generated query plans. --query-plan-cache-ttl | int | 60 | Time to live for cached query plans, in seconds. - --query-cost-planner | bool | true | Use the cost-estimating query planner. + --snapshot-cycle-sec | integer | 300 | Interval (seconds) between database snapshots.
Value of -1 turns taking snapshots off. + --snapshot-on-exit | bool | true | Make a snapshot when closing Memgraph. + --snapshot-directory | string | "/var/lib/memgraph/snapshots" | Path to the directory where snapshots will be stored. + --snapshot-max-retained | integer | 3 | Number of retained snapshots.
Value -1 means without limit. + --snapshot-recover-on-startup | bool | true | Recover the database on startup using the last
stored snapshot. + --log-file | string | "/var/log/memgraph/memgraph.log" | Path to where the log should be stored. + --also-log-to-stderr | bool | false | If `true`, log messages will go to stderr in addition to logfiles. + --flag-file | string | "" | Path to a file containing additional configuration settings. + +All of the parameters can also be found in `/etc/memgraph/memgraph.conf`. [^1]: Maximum number of concurrent executions on the current CPU. diff --git a/release/package_docker b/release/package_docker index 04a5be372..fb7551c96 100755 --- a/release/package_docker +++ b/release/package_docker @@ -3,15 +3,22 @@ # Build and Package (docker image) Memgraph function print_help () { - echo "Usage: $0 BINARY_PACKAGE.tar.gz" + echo "Usage: $0 [--latest] BINARY_PACKAGE.tar.gz" echo "Optional arguments:" echo -e " -h|--help Print help." + echo -e " --latest Tag image as latest version." } working_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" project_dir="${working_dir}/.." -if [[ $# -ne 1 || "$1" == "-h" || "$1" == "--help" ]]; then +latest_image="" +tag_latest="" +if [[ $# -eq 2 && "$1" == "--latest" ]]; then + latest_image="memgraph:latest" + tag_latest="-t memgraph:latest" + shift +elif [[ $# -ne 1 || "$1" == "-h" || "$1" == "--help" ]]; then print_help exit 1 fi @@ -32,8 +39,8 @@ tar xf ${tar_release} version=`echo ${package_name} | sed 's/.*-\(.*\)-.*/\1/'` image_name="memgraph:${version}" # Build docker image. -docker build -t ${image_name} -f ${working_dir}/community.dockerfile --build-arg build_name=${package_name} . -docker save ${image_name} > ${package_name}-docker.tar.gz +docker build -t ${image_name} ${tag_latest} -f ${working_dir}/community.dockerfile --build-arg build_name=${package_name} . +docker save ${image_name} ${latest_image} > ${package_name}-docker.tar.gz # Remove unpacked package. echo "Removing '${working_dir}/${package_name}'" rm -rf ${package_name}