# Neo4j安装以及DWS服务配置
请自行下载安装 Neo4j4.4+ 版本
参考链接: Neo4j下载
# neo4j.conf 模板示例
# Transaction state location. It is recommended to use ON_HEAP.
dbms.tx_state.memory_allocation=ON_HEAP
# Bolt connector
dbms.connector.bolt.enabled=true
#dbms.connector.bolt.tls_level=DISABLED
#dbms.connector.bolt.listen_address=:7687
#dbms.connector.bolt.advertised_address=:7687
# HTTP Connector. There can be zero or one HTTP connectors.
dbms.connector.http.enabled=true
#dbms.connector.http.listen_address=:7474
#dbms.connector.http.advertised_address=:7474
# HTTPS Connector. There can be zero or one HTTPS connectors.
dbms.connector.https.enabled=false
# APOC 插件白名单
dbms.security.procedures.allowlist=apoc.periodic.*,apoc.create.*,apoc.merge.*,apoc.load.*,gds.i*,apoc.cypher.*,apoc.path.*,apoc.coll.*,apoc.map.*,apoc.algo.*,apoc.text.*
dbms.security.procedures.denylist=*
#********************************************************************
# JVM Parameters
#********************************************************************
# G1GC generally strikes a good balance between throughput and tail
# latency, without too much tuning.
dbms.jvm.additional=-XX:+UseG1GC
# Have common exceptions keep producing stack traces, so they can be
# debugged regardless of how often logs are rotated.
dbms.jvm.additional=-XX:-OmitStackTraceInFastThrow
# Make sure that `initmemory` is not only allocated, but committed to
# the process, before starting the database. This reduces memory
# fragmentation, increasing the effectiveness of transparent huge
# pages. It also reduces the possibility of seeing performance drop
# due to heap-growing GC events, where a decrease in available page
# cache leads to an increase in mean IO response time.
# Try reducing the heap memory, if this flag degrades performance.
dbms.jvm.additional=-XX:+AlwaysPreTouch
# Trust that non-static final fields are really final.
# This allows more optimizations and improves overall performance.
# NOTE: Disable this if you use embedded mode, or have extensions or dependencies that may use reflection or
# serialization to change the value of final fields!
dbms.jvm.additional=-XX:+UnlockExperimentalVMOptions
dbms.jvm.additional=-XX:+TrustFinalNonStaticFields
# Disable explicit garbage collection, which is occasionally invoked by the JDK itself.
dbms.jvm.additional=-XX:+DisableExplicitGC
#Increase maximum number of nested calls that can be inlined from 9 (default) to 15
dbms.jvm.additional=-XX:MaxInlineLevel=15
# Disable biased locking
dbms.jvm.additional=-XX:-UseBiasedLocking
# Restrict size of cached JDK buffers to 256 KB
dbms.jvm.additional=-Djdk.nio.maxCachedBufferSize=262144
# More efficient buffer allocation in Netty by allowing direct no cleaner buffers.
dbms.jvm.additional=-Dio.netty.tryReflectionSetAccessible=true
# Exits JVM on the first occurrence of an out-of-memory error. Its preferable to restart VM in case of out of memory errors.
# dbms.jvm.additional=-XX:+ExitOnOutOfMemoryError
# Expand Diffie Hellman (DH) key size from default 1024 to 2048 for DH-RSA cipher suites used in server TLS handshakes.
# This is to protect the server from any potential passive eavesdropping.
dbms.jvm.additional=-Djdk.tls.ephemeralDHKeySize=2048
# This mitigates a DDoS vector.
dbms.jvm.additional=-Djdk.tls.rejectClientInitiatedRenegotiation=true
# Enable remote debugging
#dbms.jvm.additional=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
# This filter prevents deserialization of arbitrary objects via java object serialization, addressing potential vulnerabilities.
# By default this filter whitelists all neo4j classes, as well as classes from the hazelcast library and the java standard library.
# These defaults should only be modified by expert users!
# For more details (including filter syntax) see: https://openjdk.java.net/jeps/290
#dbms.jvm.additional=-Djdk.serialFilter=java.**;org.neo4j.**;com.neo4j.**;com.hazelcast.**;net.sf.ehcache.Element;com.sun.proxy.*;org.openjdk.jmh.**;!*
# Increase the default flight recorder stack sampling depth from 64 to 256, to avoid truncating frames when profiling.
dbms.jvm.additional=-XX:FlightRecorderOptions=stackdepth=256
# Allow profilers to sample between safepoints. Without this, sampling profilers may produce less accurate results.
dbms.jvm.additional=-XX:+UnlockDiagnosticVMOptions
dbms.jvm.additional=-XX:+DebugNonSafepoints
# Disable logging JMX endpoint.
dbms.jvm.additional=-Dlog4j2.disable.jmx=true
# Limit JVM metaspace and code cache to allow garbage collection. Used by cypher for code generation and may grow indefinitely unless constrained.
# Useful for memory constrained environments
#dbms.jvm.additional=-XX:MaxMetaspaceSize=1024m
#dbms.jvm.additional=-XX:ReservedCodeCacheSize=512m
#********************************************************************
# Wrapper Windows NT/2000/XP Service Properties
#********************************************************************
# WARNING - Do not modify any of these properties when an application
# using this configuration file has been installed as a service.
# Please uninstall the service before modifying this section. The
# service can then be reinstalled.
# Name of the service
dbms.windows_service_name=neo4j
#********************************************************************
# Other Neo4j system properties
#********************************************************************
# 内存优化
dbms.memory.heap.initial_size=4G
dbms.memory.heap.max_size=8G
dbms.memory.pagecache.size=4G
dbms.default_listen_address=0.0.0.0
dbms.directories.logs=/logs
# 安装APOC插件
APOC插件提供了高性能的写入和读取能力,请自行下载安装 APOC插件下载 (opens new window)
将下载好的插件apoc-4.4.0.1-core.jar放置与plugins目录即可
# 修改DWS服务配置
# Support query and manage data lineage, false: menus and functions related will disable
# 支持查看和管理数据血缘相关功能,配置为false则相关菜单和功能将禁用
dws.lineage.enable=true
# Whether current server handle lineage task. When deploy multi servers config only one node enable for now.
# 当前服务器是否处理血缘任务,部署多台服务器时,配置一台启用即可
dws.lineage.analyser-enable=true
# Number of analysis tasks per acquisition
# 每次获取分析任务的数量
dws.lineage.task.fetch-size=8
# Adjusted the size of the waiting queue to control how many analysis tasks can be load in advance into queue.
# 可以通过调整此值来控制等待队列的大小,用来提前装载分析任务
dws.lineage.task.waiting-queue-size=4
# Fetch interval time ms
# 获取分析任务间隔时间,单位毫秒
dws.lineage.task.fetch-interval=1000
# Number of analysis to handle task (Thread number)
# 每次处理分析任务的数量(线程数量)
dws.lineage.task.analyser-size=4
# DWS task's lineage analyse result will cache in mem and wait flush, be careful of memory usage.
# 缓存任务的分析结果数量,合理控制避免内存溢出,如果flush数据较慢,会暂停消费新的分析任务
dws.lineage.task.result-cache-size=20
# Flush interval time ms
# 周期性的flush缓存数据到图库中,单位毫秒
dws.lineage.task.result-flush-interval=10000
# apoc的写入批大小,同时也是全量分析时节点、边的缓存队列大小的配置值 ${result-flush-batch-size} * 1.5
dws.lineage.task.result-flush-batch-size=1000
# Neo4j connection info
# Neo4j 连接信息
spring.neo4j.uri=bolt://localhost:7690
spring.neo4j.authentication.username=neo4j
spring.neo4j.authentication.password=primeton
logging.level.org.springframework.data.neo4j=INFO
management.health.neo4j.enabled=false
建议按照推荐配置信息配置,经测试在当前配置情况下,内存的最大的占用情况在1G左右,请根据服务器配置自行配置
# 提供一个docker快速安装的配置示例
docker run -d --name neo4j -p 7474:7474 -p 7687:7687 \
-v /mnt/data/docker-data/neo4j4/data:/data \
-v /mnt/data/docker-data/neo4j4/logs:/logs \
-v /mnt/data/docker-data/neo4j4/conf:/var/lib/neo4j/conf \
-v /mnt/data/docker-data/neo4j4/plugins:/var/lib/neo4j/plugins \
--env NEO4J_AUTH=neo4j/primeton neo4j:4.4.42
将上述提到的配置文件放于/mnt/data/docker-data/neo4j4/conf,apoc插件jar放于/mnt/data/docker-data/neo4j4/plugins 即可