Linux下的neo4j搭建

下载安装包

Neo4j Community: https://neo4j.com/download-center/#community

或者直接下载

wget http://dist.neo4j.org/neo4j-community-4.2.3-unix.tar.gz

解压安装

tar -axvf neo4j-community-4.2.3-unix.tar.gz 

Neo4j基于Java环境运行,因此需要先安装Jre,不然启动时会报以下错误

ERROR: Unable to find Java executable. Make sure the java executable is on the PATH or define JAVA_HOME.
* Please use Oracle(R) Java(TM) 11, OpenJDK(TM) 11 to run Neo4j.
* Please see https://neo4j.com/docs/ for Neo4j installation instructions

参考neo4j文档:https://neo4j.com/docs/

# 查看系统内核
uname -r
5.4.0-66-generic

# ubuntu 中安装
sudo apt install default-jre            
sudo apt install openjdk-11-jre-headless
sudo apt install openjdk-8-jre-headless 

配置文件修改

# 设置JVM初始堆内存和JVM最大堆内存
# 生产环境给的JVM最大堆内存越大越好,但是要小于机器的物理内存

dbms.memory.heap.initial_size=1g
dbms.memory.heap.max_size=2G

# neo4j缓存,设置越大越好
dbms.memory.pagecache.size=2g

# 去掉下面配置前的#符号,开放通过ip远程连接neo4j数据库
dbms.default_listen_address=0.0.0.0

# 修改以下的端口信息, bolt, http, https
# Bolt connector 使用Bolt协议
 89 dbms.connector.bolt.enabled=true
 90 #dbms.connector.bolt.tls_level=DISABLED
 91 dbms.connector.bolt.listen_address=:7687
# 连接器配置通告的端口,通过设置它们独特的advertised_address
 92 #dbms.connector.bolt.advertised_address=:7687
 93 
 94 # HTTP Connector. There can be zero or one HTTP connectors.
 95 dbms.connector.http.enabled=true
 96 dbms.connector.http.listen_address=:7474
 97 #dbms.connector.http.advertised_address=:7474
 98 
 99 # HTTPS Connector. There can be zero or one HTTPS connectors.
100 dbms.connector.https.enabled=true
101 dbms.connector.https.listen_address=:7473
102 #dbms.connector.https.advertised_address=:7473

启用http日志

183 #*****************************************************************
184 # Logging configuration
185 #*****************************************************************
186 
187 # To enable HTTP logging, uncomment this line
188 dbms.logs.http.enabled=true
189 
190 # Number of HTTP logs to keep.
191 dbms.logs.http.rotation.keep_number=5
192 
193 # Size of each HTTP log that is kept.
194 dbms.logs.http.rotation.size=20m
195 
196 # To enable GC Logging, uncomment this line
197dbms.logs.gc.enabled=true

其他配置

# 允许远程url导入文件
dbms.security.allow_csv_import_from_file_urls=true

# 设置neo4j可读可写
dbms.read_only=false


# 安全验证,默认启用,可关闭
dbms.security.auth_enabled=false

启动服务,关闭服务

# 启动 
进入bin目录执行./neo4j start

# 停止
进入bin目录执行./neo4j stop

# 查看图数据库状态
进入bin目录执行./neo4j status


# 客户端访问

http://服务器ip地址:7474/browser/
 

 

默认的host是bolt://localhost:7687,默认的用户是neo4j,默认的密码是:neo4j,第一次成功connect到Neo4j服务器之后,需要重置密码。

References:

上一篇:jmeter获取cookie的方式


下一篇:windows本地启动tomcat端口占用