QQ交流群:64655993 希望能对您有所帮助!!!
一、基本信息
官网:https://neo4j.com/
下载地址:
https://neo4j.com/download-center/
中文社区:
http://neo4j.com.cn/
新手入门:
http://neo4j.com.cn/getstart
中文教程:
https://www.w3cschool.cn/neo4j/
http://neo4j.com.cn/public/cypher/default.html
开源代码:
https://github.com/neo4j
下载页面:
根据业务需要,选择适合自己系统的安装包,如下图:
二、安装、启动 (Centos7、Windows10)
1、Centos 系统环境安装:
1.1 系统介绍
系统版本:CentOS-7-x86_64-Minimal-1708
内存:2G
CPU:1核
1.2 下载
系统安装基本工具:
[root@localhost ~]# yum install -y vim wget lrzsz
[root@localhost ~]# mkdir /opt/noe4j
把压缩包neo4j-community-3.5.4-unix.tar.gz下载至本地
1.3 配置JDK环境(必须配置)
参考网址:https://blog.csdn.net/llwy1428/article/details/85232267
1.4 把从官网上下载下来的安装包上传至 /opt/noe4j 目录下
([root@localhost noe4j]# rz 回车,选择压缩包 neo4j-community-3.5.4-unix.tar.gz )
1.5 解压文件
[root@localhost noe4j]# tar zxvf neo4j-community-3.5.4-unix.tar.gz
1.6 关闭防火墙
关闭防火墙,并设置开机禁止启动
关闭防火墙: systemctl stop firewalld
查看状态 : systemctl status firewalld
开机禁用 : systemctl disable firewalld
1.7 修改文件最大打开数
参考地址:
https://blog.csdn.net/llwy1428/article/details/89389191
1.8 修改配置文件(其他节点访问本机,则本机必须配置)
对于3.1及以后的版本
在安装目录的 /conf/neo4j.conf 文件内,找到下面一行,将注释#号去掉就可以了 dbms.connectors.default_listen_address=0.0.0.0
1.9 启动服务
[root@localhost noe4j]# neo4j-community-3.5.4/bin/neo4j start
其他命令 { console | start | stop | restart | status }
访问http://IP地址:7474/, 出现下图即代表安装成功,顶部的$输入框用来执行下面的CQL语句。
至此,Centos 7 Neo4j 安装完毕!
2、Windows10 系统环境安装
2.1 在官网上下载压缩包:neo4j-community-3.5.4-windows.zip
解压缩 neo4j-community-3.5.4-windows.zip
2.2 进入bin文件夹可看到如下文件列表
2.3 Windows系统中配置JDK环境
参考:https://www.cnblogs.com/heqiyoujing/p/9502726.html
2.4 在空白位置 按下 “Shift” 键 同时 右击鼠标
在Windows PowerShell 窗口中输入 .\neo4j.bat console 后,回车
2.5 在浏览器 输入 http://localhost:7474
至此,Windows10系统中 Neo4j 安装完毕!
其余操作,参考下文。
3、简单使用
浏览器查看效果
默认用户名/密码是
neo4j / neo4j
设置新密码
Node Labels 表示存在的节点
Relationship Types表示存在的关系
Property Keys 表示节点或者关系的属性
接下来通过命令创建一个节点,节点的名字是Student,有三个属性name、age、remark。
CREATE (:Student{ name:'Tom',age:'29',remark:'Hello Neo4j !' });
再创建一个 Class 节点:
CREATE (:Class{ name:'数据库' });
有了 Student 节点和 Class 节点后,可以添加两个节点之间的关系了。
MATCH (s:Student),(c:Class)
WHERE s.name = 'Tom' AND c.name = '数据库'
CREATE (c)-[:Class_Student]->(s);
只删除两节点间的关系
match (c:Class),(s:Student)
where c.name="数据库" AND s.name="Tom"
optional match (c)-[r]-(s)
delete r
说明:
a、数据库文件默认存储地址:\neo4j-community-3.5.4\data\databases
b、如果迁移数据库,直接把 graph.db 复制 / 剪切 即可
c、如需更改其他配置信息,则需要修改 j\neo4j-community-3.5.4\conf 目录中的 neo4j.conf 配置文件
借鉴地址:
https://blog.csdn.net/hxg117/article/details/79929579
https://blog.csdn.net/enweitech/article/details/89173446