本文根据Neo4j-3.5的官方教程编写。
因为企业版支持Prometheus,故添加了该配置,我的其他文章会介绍如何搭建Neo4j监控(Prometheus+Grafana)。
环境及介质:
操作系统:CentOS 6.8
文件系统:官方推荐EXT4/ZFS
安装环境:JDK8及以上
安装介质:neo4j-enterprise-3.5.7-unix.tar.gz
其它插件:neo4j-graph-algorithms-*.jar、apoc-*.jar
apoc与Neo4j的版本对应关系及下载:https://github.com/neo4j-contrib/neo4j-apoc-procedures(往下拉)
algo与Neo4j的版本对应关系及下载:https://github.com/neo4j-contrib/neo4j-graph-algorithms/blob/master/versions.json
开始安装
一、操作系统配置(将用户neo4j的打开文件描述符限制设置为40000)
vi /etc/security/limits.conf
添加下面两行
neo4j soft nofile 40000
neo4j hard nofile 40000
vi /etc/pam.d/su
添加下面一行
session required pam_limits.so
二、创建用户neo4j
groupadd neo4j
useradd neo4j -g neo4j -d /home/neo4j -s /bin/bash
三、准备安装介质
移动到/usr/local下解压
tar -zxvf /usr/local/neo4j-enterprise-3.5.7-unix.tar.gz
做软连接
ln -s neo4j-*.tar.gz neo4j
拷贝apoc、algo插件至plugins目录
cp apoc-*.jar /usr/local/neo4j/plugins
cp neo4j-graph-algorithms-*.jar /usr/local/neo4j/plugins
四、配置文件修改
# 修改自己成自己的数据库名
dbms.active_database=数据库名.db
# 取消注释,开启远程备份
dbms.backup.enabled=true
dbms.backup.address=0.0.0.0:6362
# 网络连接
# 取消该注释
dbms.connectors.default_listen_address=0.0.0.0
# 下面几个保持不动
dbms.connector.bolt.listen_address=:7687
dbms.connector.http.listen_address=:7474
dbms.connector.https.listen_address=:6474
# 添加algo和apoc插件
dbms.security.procedures.unrestricted=algo.*,apoc.*
apoc.export.file.enabled=true
apoc.import.file.enabled=true
# 添加Prometheus监控
#********************************************************************
# Prometheus
#********************************************************************
# Enable the Prometheus endpoint. Default is 'false'.
metrics.prometheus.enabled=true
# The default is localhost:2004.
metrics.prometheus.endpoint=本机IP地址:2004
五、权限配置
chown -R neo4j:neo4j /usr/local/neo4j
六、启动数据库
/usr/local/neo4j start
七、浏览器登录查看
地址为 IP地址:7474
检验apoc和algo插件
CALL algo.list()
CALL apoc.config.list()
至此,大功告成!
因为很久之前搭建的,有些细节可能会遗漏,有问题可以评论或私我,欢迎关注哦。