multiple versions of neo4j server at the same machine

前端 未结 3 1404
青春惊慌失措
青春惊慌失措 2020-12-21 04:37

I downloaded 2 versions of neo4j on Ubuntu 18.04 which are \"neo4j-community-3.5.12\" and \"neo4j-community-3.5.8\"

I run 3.5.8 with default settings I can see it fr

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-21 05:11

    In case anybody still needs it: Here is how to run two neo4j databases neo4j_01 and neo4j_02 in two different docker containers, saving the data in different directories and accessing them on different ports.

    docker container 1: neo4j_01

    docker run \
        --name neo4j_01 \
        -p1474:7474 -p1687:7687 \
        -d \
        -v $HOME/neo4j_01/neo4j/data:/data \
        -v $HOME/neo4j_01/neo4j/logs:/logs \
        -v $HOME/neo4j_01/neo4j/import:/var/lib/neo4j/import \
        -v $HOME/neo4j_01/neo4j/plugins:/plugins \
        --env NEO4J_AUTH=username/enterpasswordhere \
        neo4j:latest
    

    docker container 2: neo4j_02

        docker run \
        --name neo4j_02 \
        -p2474:7474 -p2687:7687 \
        -d \
        -v $HOME/neo4j_02/neo4j/data:/data \
        -v $HOME/neo4j_02/neo4j/logs:/logs \
        -v $HOME/neo4j_02/neo4j/import:/var/lib/neo4j/import \
        -v $HOME/neo4j_02/neo4j/plugins:/plugins \
        --env NEO4J_AUTH=username/enterpasswordhere \
        neo4j:latest
    

    After executing the code above e.g. neo4j_01 can be reached on port 1474 (when logging in you need to change the bolt port to 1687 in the first line and then enter username and password in second and third line)

    You can stop a container with docker kill neo4j_01 and restart it with docker start neo4j_01. Data will still be there. It is saved in $HOME/neo4j_01/neo4j/data.

    Doing it like this, I did not encounter any problems with ports/ accessing the wrong database etc.

提交回复
热议问题