概述
neo4j是业内出现较早的图数据库,部署方式类似mysql,存在通用版本community和企业版edition
通用版不支持分布式集群部署,只支持高可用
部署
下载neo4j-enterprise-3.5.0-unix.tar.gz
解压后启动:
tar -zxvf neo4j-enterprise-3.5.0-unix.tar.gz -d /home/graph/service/neo4j-enterprise-3.5.0/
cd /home/graph/service/neo4j-enterprise-3.5.0/
./bin/neo4j start
jps
默认只会监听本地回环地址。修改配置文件填入IP即可
语法
增删改查
MATCH (a:Person),(b:Person) WHERE a.name = 'Alice' AND b.name = 'Andres' CREATE (a)-[r:Follow]->(b);
MATCH (a:Person),(b:Person) WHERE a.name = 'Andres' AND b.name = 'Charlie Sheen' CREATE (a)-[r:Follow]->(b);
MATCH (a:Person),(b:Person) WHERE a.name = 'Andres' AND b.name = 'Bob' CREATE (a)-[r:Follow]->(b);
MATCH (a:Person),(b:Person) WHERE a.name = 'Bob' AND b.name = 'Alice' CREATE (a)-[r:Follow]->(b);
MATCH (a:Person),(b:Person) WHERE a.name = 'Ada' AND b.name = 'Bob' CREATE (a)-[r:Follow]->(b);
MATCH (a:Person),(b:Person) WHERE a.name = 'Ada' AND b.name = 'Andres' CREATE (a)-[r:Test]->(b);
CRUD:
建表: