我无法建立一个Neo4j集群

时间:2016-07-06 11:29:33

标签: neo4j

我有一台工作正常的Neo4j服务器但是,当我尝试设置群集时,我不能弄清楚它为什么不起作用。

为了使群集有效,我似乎只需要解开以下几行:

ha.server_id = 3
ha.initial_hosts =192.168.1.93:5001,192.168.1.91:5001
dbms.mode=HA

但是当我这样做时,我在日志文件中收到有关db load的错误。

这是我的neo4j.conf文件

#*****************************************************************
# Neo4j configuration
#*****************************************************************

# The name of the database to mount
dbms.active_database=graph.db

# Paths of directories in the installation.
dbms.directories.data=/var/lib/neo4j/data
dbms.directories.plugins=/var/lib/neo4j/plugins
#dbms.directories.certificates=certificates

# This setting constrains all `LOAD CSV` import files to be under the `import` directory. Remove or uncomment it to
# allow files to be loaded from anywhere in filesystem; this introduces possible security problems. See the `LOAD CSV`
# section of the manual for details.
dbms.directories.import=import

# Whether requests to Neo4j are authenticated.
# To disable authentication, uncomment this line
#dbms.security.auth_enabled=false

# Enable this to be able to upgrade a store from an older version.
#dbms.allow_format_migration=true

# The amount of memory to use for mapping the store files, in bytes (or
# kilobytes with the 'k' suffix, megabytes with 'm' and gigabytes with 'g').
# If Neo4j is running on a dedicated server, then it is generally recommended
# to leave about 2-4 gigabytes for the operating system, give the JVM enough
# heap to hold all your transaction state and query context, and then leave the
# rest for the page cache.
# The default page cache memory assumes the machine is dedicated to running
# Neo4j, and is heuristically set to 50% of RAM minus the max Java heap size.
#dbms.memory.pagecache.size=10g
# Enable online backups to be taken from this database.
#dbms.backup.enabled=true

# To allow remote backups, uncomment this line:
#dbms.backup.address=0.0.0.0:6362

#*****************************************************************
# Network connector configuration
#*****************************************************************

# Bolt connector
dbms.connector.bolt.type=BOLT
dbms.connector.bolt.enabled=true
dbms.connector.bolt.tls_level=OPTIONAL
# To have Bolt accept non-local connections, uncomment this line
# dbms.connector.bolt.address=0.0.0.0:7687

# HTTP Connector
dbms.connector.http.type=HTTP
dbms.connector.http.enabled=true
#dbms.connector.http.encryption=NONE
# To have HTTP accept non-local connections, uncomment this line
dbms.connector.http.address=0.0.0.0:7474

# HTTPS Connector
dbms.connector.https.type=HTTP
dbms.connector.https.enabled=true
dbms.connector.https.encryption=TLS
dbms.connector.https.address=localhost:7473

# Number of Neo4j worker threads.
#dbms.threads.worker_count=

#*****************************************************************
# HA configuration
#*****************************************************************

# Uncomment and specify these lines for running Neo4j in High Availability mode.
# See the High availability setup tutorial for more details on these settings
# http://neo4j.com/docs/operations-manual/current/#tutorials

# Database mode
# Allowed values:
# HA - High Availability
# SINGLE - Single mode, default.
# To run in High Availability mode uncomment this line:
#dbms.mode=HA

# ha.server_id is the number of each instance in the HA cluster. It should be
# an integer (e.g. 1), and should be unique for each cluster instance.
ha.server_id=5

# ha.initial_hosts is a comma-separated list (without spaces) of the host:port
# where the ha.host.coordination of all instances will be listening. Typically
# this will be the same for all cluster instances.
ha.initial_hosts=192.168.1.93:5001,192.168.1.91:5001

# IP and port for this instance to listen on, for communicating cluster status
# information iwth other instances (also see ha.initial_hosts). The IP
# must be the configured IP address for one of the local interfaces.
ha.host.coordination=127.0.0.1:5001

# IP and port for this instance to listen on, for communicating transaction
# data with other instances (also see ha.initial_hosts). The IP
# must be the configured IP address for one of the local interfaces.
ha.host.data=127.0.0.1:6001

ha.pull_interval=10

# Amount of slaves the master will try to push a transaction to upon commit
# (default is 1). The master will optimistically continue and not fail the
# transaction even if it fails to reach the push factor. Setting this to 0 will
# increase write performance when writing through master but could potentially
# lead to branched data (or loss of transaction) if the master goes down.
#ha.tx_push_factor=1

# Strategy the master will use when pushing data to slaves (if the push factor
# is greater than 0). There are three options available "fixed_ascending" (default),
# "fixed_descending" or "round_robin". Fixed strategies will start by pushing to
# slaves ordered by server id (accordingly with qualifier) and are useful when
# planning for a stable fail-over based on ids.
#ha.tx_push_strategy=fixed_ascending

# Policy for how to handle branched data.
#ha.branched_data_policy=keep_all

# How often heartbeat messages should be sent. Defaults to ha.default_timeout.
#ha.heartbeat_interval=5s

# Timeout for heartbeats between cluster members. Should be at least twice that of ha.heartbeat_interval.
#ha.heartbeat_timeout=11s

# If you are using a load-balancer that doesn't support HTTP Auth, you may need to turn off authentication for the
# HA HTTP status endpoint by uncommenting the following line.
#dbms.security.ha_status_auth_enabled=false

# Whether this instance should only participate as slave in cluster. If set to
# true, it will never be elected as master.
#ha.slave_only=false

谢谢

1 个答案:

答案 0 :(得分:1)

首先,如果你在启动时遇到错误,你可以做的最少就是在这里引用它,否则没有人能做到这一点。

关于您的配置,至少有一个错误:要使用IP地址(例如192.168.1.93和192.168.1.91)与其他主机一起参与群集,您需要设置此主机以便在同一个主机上进行通信网络,不在环回(即127.0.0.1),其他主机无法连接。

如果此主机有例如192.168.1.93,那就是你需要使用的东西:

ha.initial_hosts=192.168.1.93:5001,192.168.1.91:5001
ha.host.coordination=192.168.1.93:5001
ha.host.data=192.168.1.93:6001

但是,如果您的主机具有192.168.1.92,则需要将其添加到ha.initial_hosts(在所有主机上都是相同的,如注释中所述,不是其他主机的列表< / em>的):

ha.initial_hosts=192.168.1.93:5001,192.168.1.92:5001,192.168.1.91:5001
ha.host.coordination=192.168.1.92:5001
ha.host.data=192.168.1.92:6001