2017-06-06 18:03:45 +08:00
## Installation
2017-06-16 17:47:13 +08:00
Memgraph is a 64-bit Linux compatible database management system. For the
purpose of Alpha testing Memgraph has been packed into a
[Docker ](https://www.docker.com ) image based on Ubuntu 16.04. Before
proceeding with the installation, please install the Docker engine on your
system. Instructions how to install Docker can be found on the
[official Docker website ](https://docs.docker.com/engine/installation ).
Memgraph Docker image was built with Docker version `1.12` and should be
compatible with all latter versions.
### Docker Import
After a successful download the Memgraph Docker image
can be imported into Docker:
2017-06-09 20:04:04 +08:00
```
2017-08-17 20:17:23 +08:00
docker load -i /path/to/memgraph_alpha_v0.7.0.tar.gz
2017-06-09 20:04:04 +08:00
```
2017-06-16 17:47:13 +08:00
### Image Configuration & Running Memgraph
Memgraph can be started by executing:
2017-06-09 20:04:04 +08:00
2017-06-06 18:03:45 +08:00
```
2017-08-17 20:17:23 +08:00
docker run -it -p 7687:7687 memgraph_alpha_v0.7.0
2017-06-13 23:40:18 +08:00
```
2017-06-16 17:47:13 +08:00
2017-06-13 23:40:18 +08:00
The `-it` option enables displaying Memgraph's logs inside the current shell.
2017-06-16 17:47:13 +08:00
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.
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.
It is also recommended to run the Docker container in the background. On a
Linux system all of that can be achieved with the following shell commands:
2017-06-13 23:40:18 +08:00
```
2017-06-16 17:47:13 +08:00
# Create the snapshots folder on the host.
2017-06-16 22:06:04 +08:00
mkdir -p memgraph
2017-06-16 17:47:13 +08:00
# Docker expects full path to the created folder.
2017-06-16 22:06:04 +08:00
FULL_OUTPUT_PATH=$PWD/memgraph
2017-06-16 17:47:13 +08:00
# Run Memgraph.
2017-08-17 20:17:23 +08:00
docker run -d -p 7687:7687 -v ${FULL_OUTPUT_PATH}:/var/lib/memgraph --name < memgraph_docker_container_name > memgraph_alpha_v0.7.0
2017-06-06 18:03:45 +08:00
```
2017-06-09 20:04:04 +08:00
2017-06-16 17:47:13 +08:00
In the commands above `-d` means that the container will be detached (run in
2017-06-16 22:06:04 +08:00
the background). `-v` mounts a host folder to a path inside the Docker
container. The output folder contains Memgraph's periodical snapshots and log
file. The log file should be uploaded to Memgraph's issue tracking system in
case of an error. With `--name` a custom name for the container can be set
(useful for easier container management). `<memgraph_docker_container_name>`
could be any convenient name e.g. `memgraph_alpha` .
2017-06-09 20:04:04 +08:00
2017-06-16 17:47:13 +08:00
### Memgraph Configuration Parameters
Memgraph can be configured with a number of command-line parameters. The
parameters should be appended to the end of the `docker run` command in the
`--param-name=param-value` format. Following is a list of available
parameters:
2017-06-09 20:04:04 +08:00
Name | Type | Default | Description
-------|------|:-------:|-------------
Flags cleanup and QueryEngine removal
Summary:
I started with cleaning flags up (removing unused ones, documenting undocumented ones). There were some flags to remove in `QueryEngine`. Seeing how we never use hardcoded queries (AFAIK last Mislav's testing also indicated they aren't faster then interpretation), when removing those unused flags the `QueryEngine` becomes obsolete. That means that a bunch of other stuff becomes obsolete, along with the hardcoded queries. So I removed it all (this has been discussed and approved on the daily).
Some flags that were previously undocumented in `docs/user_technical/installation` are now documented. The following flags are NOT documented and in my opinion should not be displayed when starting `./memgraph --help` (@mferencevic):
```
query_vertex_count_to_expand_existsing (from rule_based_planner.cpp)
query_max_plans (rule_based_planner.cpp)
```
If you think that another organization is needed w.r.t. flag visibility, comment.
@teon.banek: I had to remove some stuff from CMakeLists to make it buildable. Please review what I removed and clean up if necessary if/when this lands. If the needed changes are minor, you can also comment.
Reviewers: buda, mislav.bradac, teon.banek, mferencevic
Reviewed By: buda, mislav.bradac
Subscribers: pullbot, mferencevic, teon.banek
Differential Revision: https://phabricator.memgraph.io/D825
2017-09-22 22:17:09 +08:00
--interface | string | "0.0.0.0" | Communication port on which to listen.
2017-06-16 17:47:13 +08:00
--port | integer | 7687 | Communication port on which to listen.
--num-workers | integer | CPU count[^1] | Number of Memgraph worker threads.
Flags cleanup and QueryEngine removal
Summary:
I started with cleaning flags up (removing unused ones, documenting undocumented ones). There were some flags to remove in `QueryEngine`. Seeing how we never use hardcoded queries (AFAIK last Mislav's testing also indicated they aren't faster then interpretation), when removing those unused flags the `QueryEngine` becomes obsolete. That means that a bunch of other stuff becomes obsolete, along with the hardcoded queries. So I removed it all (this has been discussed and approved on the daily).
Some flags that were previously undocumented in `docs/user_technical/installation` are now documented. The following flags are NOT documented and in my opinion should not be displayed when starting `./memgraph --help` (@mferencevic):
```
query_vertex_count_to_expand_existsing (from rule_based_planner.cpp)
query_max_plans (rule_based_planner.cpp)
```
If you think that another organization is needed w.r.t. flag visibility, comment.
@teon.banek: I had to remove some stuff from CMakeLists to make it buildable. Please review what I removed and clean up if necessary if/when this lands. If the needed changes are minor, you can also comment.
Reviewers: buda, mislav.bradac, teon.banek, mferencevic
Reviewed By: buda, mislav.bradac
Subscribers: pullbot, mferencevic, teon.banek
Differential Revision: https://phabricator.memgraph.io/D825
2017-09-22 22:17:09 +08:00
--log-file | string | "memgraph.log" | Path to where the log should be stored.
2017-06-16 17:47:13 +08:00
--snapshot-cycle-sec | integer | 300 | Interval (seconds) between database snapshots.< br / > Value of -1 turns taking snapshots off.
2017-09-22 15:58:54 +08:00
--snapshot-max-retained | integer | 3 | Number of retained snapshots.< br / > 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< br / > stored snapshot.
2017-07-14 19:58:25 +08:00
--query-execution-time-sec | integer | 180 | Maximum allowed query execution time. < br / > Queries exceeding this limit will be aborted. Value of -1 means no limit.
2017-09-22 20:24:53 +08:00
--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.
Flags cleanup and QueryEngine removal
Summary:
I started with cleaning flags up (removing unused ones, documenting undocumented ones). There were some flags to remove in `QueryEngine`. Seeing how we never use hardcoded queries (AFAIK last Mislav's testing also indicated they aren't faster then interpretation), when removing those unused flags the `QueryEngine` becomes obsolete. That means that a bunch of other stuff becomes obsolete, along with the hardcoded queries. So I removed it all (this has been discussed and approved on the daily).
Some flags that were previously undocumented in `docs/user_technical/installation` are now documented. The following flags are NOT documented and in my opinion should not be displayed when starting `./memgraph --help` (@mferencevic):
```
query_vertex_count_to_expand_existsing (from rule_based_planner.cpp)
query_max_plans (rule_based_planner.cpp)
```
If you think that another organization is needed w.r.t. flag visibility, comment.
@teon.banek: I had to remove some stuff from CMakeLists to make it buildable. Please review what I removed and clean up if necessary if/when this lands. If the needed changes are minor, you can also comment.
Reviewers: buda, mislav.bradac, teon.banek, mferencevic
Reviewed By: buda, mislav.bradac
Subscribers: pullbot, mferencevic, teon.banek
Differential Revision: https://phabricator.memgraph.io/D825
2017-09-22 22:17:09 +08:00
--query-plan-cache | bool 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.
[^1]: Maximum number of concurrent executions on the current CPU.
2017-06-09 20:04:04 +08:00
2017-06-16 17:47:13 +08:00
To find more about how to execute queries on Memgraph please proceed to
[Quick Start ](quick-start.md ).
2017-06-06 18:03:45 +08:00
2017-06-09 20:04:04 +08:00
### Cleanup
2017-06-16 17:47:13 +08:00
Status and Memgraph's logging messages can be checked with:
2017-06-09 20:04:04 +08:00
```
docker ps -a
docker logs -f < memgraph_docker_container_name >
```
2017-06-16 17:47:13 +08:00
Memgraph and its Docker container can be stopped with:
2017-06-09 20:04:04 +08:00
```
docker stop < memgraph_docker_container_name >
```
2017-06-16 17:47:13 +08:00
After the container has stopped, it can be removed by
executing:
2017-06-09 20:04:04 +08:00
```
docker rm < memgraph_docker_container_name >
```
2017-06-16 17:47:13 +08:00