Skip to content

Connecting to a Neo4j database

ao508 edited this page Sep 27, 2022 · 1 revision

From a data dump:

Unpack data dump in desired directory.

cd [desired directory]
tar -xzvf neo4j.tar.gz

Contents:

ls -l neo4j/*
  ./neo4j/conf
  ./neo4j/data
  ./neo4j/import
  ./neo4j/logs
  ./neo4j/plugins

Set environment variables

export NEO4J_USERNAME=neo4j
export NEO4J_PASSWORD=[password]
export NEO4J_DATA_HOME=[desired directory]/neo4j

In a separate directory (where you want have your workspace), create docker-compose.yaml and add contents:

touch docker-compose.yaml

Open file and add contents:

  neo4j:
    container_name: neo4j
    image: neo4j:4.4.9
    restart: unless-stopped
    ports:
      - 7474:7474
      - 7687:7687
    environment:
      - NEO4J_AUTH=${NEO4J_USERNAME}/${NEO4J_PASSWORD}
      - NEO4J_dbms_memory_pagecache_size=1G
      - NEO4J_dbms.memory.heap.initial_size=1G
      - NEO4J_dbms_memory_heap_max_size=5G
      - NEO4J_DATA_HOME=${NEO4J_DATA_HOME}
      - NEO4JLABS_PLUGINS=["apoc"]
      - NEO4J_dbms_allow__upgrade=true
    volumes:
      - type: bind
        source: ${NEO4J_DATA_HOME}/conf
        target: /conf
      - type: bind
        source: ${NEO4J_DATA_HOME}/data
        target: /data
      - type: bind
        source: ${NEO4J_DATA_HOME}/import
        target: /import
      - type: bind
        source: ${NEO4J_DATA_HOME}/logs
        target: /logs
      - type: bind
        source: ${NEO4J_DATA_HOME}/plugins
        target: /plugins
Clone this wiki locally