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

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

问题描述

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

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

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

I run 3.5.8 with default settings I can see it from the web. http://localhost:7474/

对于3.5.12,我更改了 conf/neo4j.conf 文件,并设置了其他一些端口号,以免与默认端口冲突.

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版本可在:7474上正常运行.当我启动3.5.12时,日志显示它正在运行,但是当我从浏览器中检查时它没有运行.我尝试了2种不同的端口设置,但均无效果.下面是日志文件.

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.

为什么它不运行?

我看到很多人建议使用docker.我也尝试过.

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

我使用命令为docker设置了一个容器 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

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

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

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.

我使用命令设置了另一个 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

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

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

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?

我可以复制neo4j图像并使用其他图像生成容器吗?有帮助吗?

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.

推荐答案

考虑docker命令-

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

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

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

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

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

Neo4j浏览器使用默认值(来自neo4j.conf)连接到neo4j服务器.默认设置为 bolt://<machineip>:7687,其中db1实例已将容器端口暴露给7687主机端口. 在7687端口上发现正在运行的实例,该实例为db1db2启动了WebSocket连接.

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. 使用::server disconnect:server connect以及相应的bolt://<machineip>:port连接字符串

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

db1实例螺栓容器端口映射到其他主机端口(即7687以外的端口) 由于没有默认设置

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

(首选),设置相同的hostport:containerport组合,例如

(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

在这种情况下,必须映射卷以向neo4j.conf提供更新的值,如dbms.connector.bolt.listen_address=:3003

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天全站免登陆