您的位置:首页 > 其它

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

2013-09-26 14:47 656 查看
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:

cd $INSTANCE_ROOT


mkdir -p neo4j


cd neo4j


tar -xvzf /path/to/neo4j-community.tar.gz


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 ap
bca0
plication 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:

cd $INSTANCE_ROOT/neo4j


tar -xvzf /path/to/neo4j-community.tar.gz


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/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  neo4j database