Neo4j分社区版(Community Edition)和企业版(Enterprise Edition),社区版本为免费版本。
下载:https://neo4j.com/download/other-releases/#releases
系统要求(System requirements)
Neo4j的安装对硬件、系统等有一些要求,例如CPU、Memory、Disk、Filesystem、Software等、
- CPU
关于CPU,最低要求是Itel Core i3 推荐使用Intel Core i7 或 IBM POWER 8 - Memory
关于Memory,最低要求是2GB, 推荐是16-32GB 或更多。 越大的内存允许处理越大的图,但必须正确配置,以免破垃圾收集坏性操作。 - Disk
除了Disk的容量,Disk的性能对Neoj4的影响非常大,Neo4j的工作负载倾向于随机读。选择平均寻址时间低的存储,例如SSD,最低要求 10GB SATA,推荐配置 SSD w/SATA - FileSystem
最低要求 ext4(或类似的)
推荐配置 ext4、ZFS - Software
Java
必须安装OpenJDK 8 或 Oracle Java 8 - Operation Sytem
Linux(Ubuntu, Debian) ,但是我的测试环境为Red Hat Enterprise Linux Server release 6.6,暂时还没有发现什么问题。 - Architectures
X86 或 OpenPower(POWER8)
安装
1.jdk
[root@biluos1 software]# java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
You have new mail in /var/spool/mail/root
[root@biluos1 software]#
3:创建一个用户neo4j,用来管理Neo4j 。当然这不是必须的。也可以是其它账号或root账号。
[root@biluos1 neo4j-community-3.2.10]# groupadd nosql
[root@biluos1 neo4j-community-3.2.10]# useradd -G nosql neo4j
解压
[neo4j@biluos1 ~]$ tar -zxvf /opt/software/neo4j-community-3.2.10-unix.tar.gz -C /opt/moudles/neo4j/
[root@biluos1 neo4j-community-3.2.10]# chown neo4j:nosql -R /opt/moudles/neo4j/
[root@biluos1 neo4j-community-3.2.10]# su - neo4j
修改环境变量
[root@biluos1 neo4j-community-3.2.10]# vim /etc/profile
export NEO4J_HOME=/opt/moudles/neo4j/neo4j-community-3.2.10
export PATH=$PATH:$NEO4J_HOME/bin
修改配置文件/etc/security/limits.conf
neo4j soft nofile 40000
neo4j hard nofile 40000
编辑/etc/pam.d/su 在配置文件里面增加选项。
session optional pam_xauth.so
验证
[root@biluos1 neo4j-community-3.2.10]# su neo4j
[neo4j@biluos1 ~]$ neo4j version
neo4j 3.2.10
[neo4j@biluos1 ~]$ neo4j
Usage: neo4j { console | start | stop | restart | status | version }
配置
创建数据库目录
[neo4j@biluos1 neo4j]$ mkdir /opt/moudles/neo4j/data
[neo4j@biluos1 neo4j]$ vim neo4j-community-3.2.10/conf/neo4j.conf
指定数据库目录位置
dbms.active_database=/opt/moudles/neo4j/data/graph.db
dbms.directories.import=import
dbms.memory.heap.initial_size=512m
dbms.memory.heap.max_size=512m
指定运行的主机
dbms.connectors.default_listen_address=192.168.10.174
dbms.connectors.default_advertised_address=192.168.10.174
dbms.connector.bolt.enabled=true
dbms.connector.bolt.tls_level=OPTIONAL
dbms.connector.bolt.listen_address=:7687
dbms.connector.http.enabled=true
dbms.connector.http.listen_address=:7474
dbms.connector.https.enabled=true
dbms.connector.https.listen_address=:7473
dbms.tx_log.rotation.retention_policy=1 days
dbms.jvm.additional=-XX:+UseG1GC
dbms.jvm.additional=-XX:-OmitStackTraceInFastThrow
dbms.jvm.additional=-XX:+AlwaysPreTouch
dbms.jvm.additional=-XX:+UnlockExperimentalVMOptions
dbms.jvm.additional=-XX:+TrustFinalNonStaticFields
dbms.jvm.additional=-XX:+DisableExplicitGC
dbms.jvm.additional=-Djdk.tls.ephemeralDHKeySize=2048
dbms.jvm.additional=-Djdk.tls.rejectClientInitiatedRenegotiation=true
dbms.windows_service_name=neo4j
dbms.jvm.additional=-Dunsupported.dbms.udc.source=tarball
启动
[neo4j@biluos1 neo4j]$ neo4j start
Active database: /opt/moudles/neo4j/data/graph.db
Directories in use:
home: /opt/moudles/neo4j/neo4j-community-3.2.10
config: /opt/moudles/neo4j/neo4j-community-3.2.10/conf
logs: /opt/moudles/neo4j/neo4j-community-3.2.10/logs
plugins: /opt/moudles/neo4j/neo4j-community-3.2.10/plugins
import: /opt/moudles/neo4j/neo4j-community-3.2.10/import
data: /opt/moudles/neo4j/neo4j-community-3.2.10/data
certificates: /opt/moudles/neo4j/neo4j-community-3.2.10/certificates
run: /opt/moudles/neo4j/neo4j-community-3.2.10/run
Starting Neo4j.
Started neo4j (pid 6793). It is available at http://192.168.10.174:7474/
There may be a short delay until the server is ready.
See /opt/moudles/neo4j/neo4j-community-3.2.10/logs/neo4j.log for current status.
访问:http://192.168.10.174:7474/
默认密码:neo4j
第一次登陆需要修改密码