Windows10 下 Neo4j1.5.8 安装教程
前言
Neo4j 是一个高性能的、NOSQL 图形数据库,它将结构化数据存储在网络上而不是表中。基于磁盘的、具备完全的事务特性的 Java 持久化引擎,这里就不把他和常用关系型数据库做对比了。因为篇幅有限,我这里也是第一次使用,所以以下完全是保姆级的安装教程了。
安装步骤
打开 Neo4j 官网,找到 “Developers” 选择 “Download Center”。

其中有企业版,社区版和桌面版提供下载,这里我选择 “Neo4j Desktop”,如果是部署可以选择社区或企业。

选择 Windows 的 exe 进入,要求先填写信息后下载,弹出下载框后不要关闭网页,待会需要里面的激活码。

由于 Neo4j 是磁盘存储,打开后先设置数据的存储位置。

然后回到下载后的官网,复制激活码,粘贴到工具的 “Software key” 里。

使用方法
测试服务先看一下服务是否已经开启,打开默认的数据库,可以看到连接地址,各种协议的端口。

开始连接打开浏览器,输入 127.0.0.1:7474,账号密码都输入 neo4j 发现登陆失败,报错:Neo.ClientError.Security.Unauthorized: The client is unauthorized due to authentication failure

修改密码找到 neo4j 服务桌面端,找到默认的数据库,找到 “Reset DBMS Password”,然后再重新输入用户 “neo4j” 和新密码进行登陆。

客户端面板登陆成功后就可以看到 neo4j 的默认数据库 “Movide DBMS” 里的数据节点和内容了。

实操
1. 创建项目
在 Project 中 New 一个项目,然后添加一个 “Local DBMS”,再设置名称和密码,创建完毕后点击启动。

2. web 客户端登陆
根据创建后提供的地址和端口,在浏览器里访问,输入用户名和设置的密码后就会进入对应的图了。
3. 依赖安装
在 python 项目中添加 “py2neo” 包,然后再检测试一下连接,节点创建和关系边创建。

4. 测试创建节点和关系边
运行代码时如果出现 The following settings are not supported: {'http_port': 7474},是因为安装的 py2neo 版本过高,可以下降其版本再运行。
降低 py2neo 版本后运行后发现依旧报错,AttributeError: 'NoneType' object has no attribute 'pool',主要还是无法连接 Neo4j,排查后发现是之前的写法不对,而且安装最新版的 neo4j,同样的 py2neo 也要较新的。
我把 py2neo 包删掉后,没有指定版本安装的是 py2neo 2021.2.3,运行代码后再在浏览器查看,已经创建了节点 “Goods”,后面数据同步和关联边操作,要等完成了知识问答系统后再总结分享了。


版权声明: 本文为 InfoQ 作者【北桥苏】的原创文章。
原文链接:【http://xie.infoq.cn/article/fbeeb7cf4b9a34e9677a878f5】。文章转载请联系作者。
评论