在一台机器上同时运行多个Neo4j实例

Neo4j can be set up to run as several instances on one machine, providing for instance several databases for development. To configure, install two instances of the Neo4j Server in two different directories following the steps outlined below.

First instance

First, create a directory to hold both database instances, and unpack the development instance:

  1. cd $INSTANCE_ROOT
  2. mkdir -p neo4j
  3. cd neo4j
  4. tar -xvzf /path/to/neo4j-community.tar.gz
  5. mv neo4j-community dev

Next, configure the instance by changing the following values in dev/conf/neo4j-server.properties, see evenSection 25.1, “Securing access to the Neo4j Server”:

org.neo4j.server.webserver.port=7474
# Uncomment the following if the instance will be accessed from a host other than localhost.
org.neo4j.server.webserver.address=0.0.0.0

Before running the Windows install or startup, change in dev/conf/neo4j-wrapper.properties

# Name of the service for the first instance
wrapper.name=neo4j_1

Start the instance:

dev/bin/neo4j start

Check that instance is available by browsing to http://localhost:7474/webadmin/

Second instance (testing, development)

In many cases during application development, it is desirable to have one development database set up, and another against which to run unit tests. For the following example, we are assuming that both databases will run on the same host.

Now create the unit testing second instance:

  1. cd $INSTANCE_ROOT/neo4j
  2. tar -xvzf /path/to/neo4j-community.tar.gz
  3. mv neo4j-community test

Next, configure the instance by changing the following values in test/conf/neo4j-server.properties to

  • change the server port to 7475
# Note the different port number from the development instance
org.neo4j.server.webserver.port=7475
# Uncomment the following if the instance will be accessed from a host other than localhost
org.neo4j.server.webserver.address=0.0.0.0

Differentiate the instance from the development instance by modifying test/conf/neo4j-wrapper.properties.

wrapper.name=neo4j- test

On Windows, you even need to change the name of the service in bin\neo4j.bat to be able to run it together with the first instance.

set  serviceName=Neo4j-Server- test
set  serviceDisplayName=Neo4j-Server- test

Start the instance:

test/bin/neo4j start

Check that instance is available by browsing to http://localhost:7475/webadmin/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值