同一台机器上有多个版本的neo4j服务器 [英] multiple versions of neo4j server at the same machine

查看:51
本文介绍了同一台机器上有多个版本的neo4j服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Ubuntu 18.04 上下载了 2 个版本的 neo4j,分别是neo4j-community-3.5.12"和neo4j-community-3.5.8"

我使用默认设置运行 3.5.8,我可以从网上看到它.

为什么它没有运行?

我看到很多人推荐使用 docker.我也试过了.

我用命令设置了 docker 一个容器sudo docker run --name db1 -p7474:7474 -p7687:7687 -d -v/db1/data:/data -v/db1/logs:/logs -v/db1/conf:/conf --envNEO4J_AUTH=none neo4j

这里我有一个现有的 /d1/data/databases/graph.db 文件夹.当我转到 localhost:7474 时,它会显示我现有的数据库.

我使用命令设置了另一个 docker 容器sudo docker run --name db2 -p3001:7474 -p3002:7473 -p3003:7687 -d -v/db2/data:/data -v/db2/logs:/logs -v/db2/conf:/conf --env NEO4J_AUTH=none neo4j

在这里我希望看到一个 EMPTY 数据库,但我又看到了已经存在的数据库.当我转到 db2 中的数据文件夹时.我看到它在这里创建了一些文件.为什么我看到相同的数据库?

还要注意,当我去查看数据库时,网页的标题显示它们使用相同的螺栓端口?

我可以复制neo4j镜像并使用不同的镜像来生成容器吗?这有帮助吗?

我意识到多个数据库正在运行并且处于活动状态但不知何故我无法通过浏览器访问第二个.

解决方案

考虑 docker 命令-

cmd1: sudo docker run --name db1 -p7474:7474 -p7687:7687 -d -v/db1/data:/data -v/db1/logs:/logs -v/db1/conf:/conf --env NEO4J_AUTH=none neo4j

<小时>

cmd2: sudo docker run --name db2 -p3001:7474 -p3002:7473 -p3003:7687 -d -v/db2/data:/data -v/db2/logs:/logs -v/db2/conf:/conf --env NEO4J_AUTH=none neo4j

容器端口默认公开为 db1 实例的相同主机端口.而对于 db2 实例系列已使用 3xxx.

要浏览neo4j提供的UI,您可以使用7474或3001端口映射到7474容器端口.

<小时>

Neo4j 浏览器使用默认值(来自 neo4j.conf)连接到 neo4j 服务器.默认设置如下bolt://:7687,其中 db1 实例已经将容器端口暴露给 7687 主机端口.在 7687 端口上找到一个正在运行的实例,它为 db1db2 启动 WebSocket 连接.

<小时>

如何连接到合适的实例?

  1. 使用::server disconnect:server connect 与适当的 bolt://:port 连接字符串

  2. db1 实例 Bolt 容器端口映射到不同的主机端口(即 7687 以外的端口)由于没有默认值可用

  3. (首选),设置相同的主机端口:容器端口组合,例如

    cmd2: sudo docker run --name db2 -p3001:7474 -p3002:7473 -p3003:3003-d -v/db2/data:/data -v/db2/logs:/logs -v/db2/conf:/conf --env NEO4J_AUTH=none neo4j

    在这种情况下,必须映射一个 Volume 来为 neo4j.conf 提供更新的值作为 dbms.connector.bolt.listen_address=:3003

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 from the web. http://localhost:7474/

For 3.5.12 I changed conf/neo4j.conf file and set some other port numbers for not to conflict with the default ones.

3.5.8 version runs fine on :7474. When I start 3.5.12, the logs says it is running but when I check from browser it is not running. I tried 2 different port settings, none worked. Below is the log file.

Why it is not running?

I see that many people recommended using docker. I also tried that.

I set up docker a container with command sudo docker run --name db1 -p7474:7474 -p7687:7687 -d -v /db1/data:/data -v /db1/logs:/logs -v /db1/conf:/conf --env NEO4J_AUTH=none neo4j

here I have an existing /d1/data/databases/graph.db folder. When I go to localhost:7474 it is fine it shows me the existing database.

I set up another docker container with command sudo docker run --name db2 -p3001:7474 -p3002:7473 -p3003:7687 -d -v /db2/data:/data -v /db2/logs:/logs -v /db2/conf:/conf --env NEO4J_AUTH=none neo4j

here I expect to see an EMPTY database but I see the already existing database again. When I go to the data folder inside db2. I see that it created some files here. WHY do I see the same database?

Also note that when I go to see the databases, headers of the web pages showing they are using the same bolt port?

can I copy the neo4j image and use different images to generate containers? Does that help?

I recognized that multiple databases are running and active but somehow I'm not able to reach the second one through a browser.

解决方案

Considering the docker commands-

cmd1: sudo docker run --name db1 -p7474:7474 -p7687:7687 -d -v /db1/data:/data -v /db1/logs:/logs -v /db1/conf:/conf --env NEO4J_AUTH=none neo4j


cmd2: sudo docker run --name db2 -p3001:7474 -p3002:7473 -p3003:7687 -d -v /db2/data:/data -v /db2/logs:/logs -v /db2/conf:/conf --env NEO4J_AUTH=none neo4j

The container ports are defaults exposed as the same host port for db1 instance. Whereas for db2 instance series 3xxx has been used.

To browse the UI provided by neo4j, you can use either 7474 or 3001 port which is mapped to 7474 container port.


Neo4j browser uses defaults (from neo4j.conf) to connect to neo4j server. The default settings are as bolt://<machineip>:7687, where db1 instance has already exposed the container port to 7687 host port. A running instance is found on 7687 port which initiates a WebSocket connection for db1 and db2.


How to connect to an appropriate instance?

  1. Use: :server disconnect and :server connect with the appropriate bolt://<machineip>:port connection string

  2. Map db1 instance bolt container port to different host port (i.e. other than 7687) As no defaults will be available

  3. (Preferred), set the same hostport:containerport combination e.g.

    cmd2: sudo docker run --name db2 -p3001:7474 -p3002:7473 -p3003:3003-d -v /db2/data:/data -v /db2/logs:/logs -v /db2/conf:/conf --env NEO4J_AUTH=none neo4j

    in this case, a Volume has to be mapped to provide neo4j.conf with updated values as dbms.connector.bolt.listen_address=:3003

这篇关于同一台机器上有多个版本的neo4j服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆