当前位置:网站首页>Migrate data from Mysql to neo4j database
Migrate data from Mysql to neo4j database
2022-07-05 12:25:00 【Nat_ Jst】
Preface : I have read several other people's tutorials, and there are some mistakes , Record the method of ultimate success .
Reference tutorial :
transfer MySQL Data to Neo4j
neo4j install APOC plug-in unit
Method :
One : Download required jar package
apoc Download address
mysql-connector-java Download address
Put it in the directory below , Be careful : my Neo4j The version is 3.5.26, Corresponding apoc The version is also 3.5.*, Downloaded the version in the reference tutorial , When the service is started , Service failed to start .
Two 、 Modify the configuration file

① modify
# Whether requests to Neo4j are authenticated.
# To disable authentication, uncomment this line
#https://www.cnblogs.com/jpfss/p/11365342.html
dbms.security.auth_enabled=true
② add to
# Wen Chu
dbms.security.procedures.unrestricted=apoc.*
apoc.import.file.enabled=true
# At the end of the article
dbms.memory.pagecache.size=10g
dbms.memory.heap.initial_size=1g
dbms.memory.heap.max_size=4g
3、 ... and 、 Restart the service
cmd The command line enters the following path to execute :
neo4j restart

Four 、 see apoc Whether the installation was successfully opened
open http://localhost:7474/
return apoc.version()

The appearance of the version number indicates that the plug-in has been successfully installed !
5、 ... and 、 Migrating data
( Optional : Empty neo4j Database data )
There are two tables in my database , One stores node information , A storage side ( Relationship ) Information about .
5.1 Migrate nodes
Node table :

stay Neo4j Statement executed in :
CALL apoc.load.jdbc('jdbc:mysql://localhost:3306/ Database name ?user=root&password=root&useUnicode=true&characterEncoding=utf8&serverTimezone=UTC', 'SELECT * FROM `node Table name `') YIELD row CREATE (n:Node {id: row.id, name: row.name, classname: row.classname})
Node Represents the node name ( type ), Can be for other , Such as Person etc. .
attribute :{id: row.id, name: row.name, classname: row.classname}
5.2 Migration relationship
A relational table :
CALL apoc.load.jdbc('jdbc:mysql://localhost:3306/ Database name ?user=root&password=root&useUnicode=true&characterEncoding=utf8&serverTimezone=UTC', 'SELECT * FROM `link Table name `') YIELD row match (n:Node {id: row.from_node_id}),(m:Node{id:row.to_node_id}) create (n)-[r:from_to{id:row.id,classname:row.classname,kind:row.kind,from_node_id:row.from_node_id,to_node_id:row.to_node_id}]->(m)
Be accomplished !
边栏推荐
- 2022年国内云管平台厂商哪家好?为什么?
- JS for循环 循环次数异常
- 信息服务器怎么恢复,服务器数据恢复怎么弄[通俗易懂]
- Matlab boundarymask function (find the boundary of the divided area)
- Two minutes will take you to quickly master the project structure, resources, dependencies and localization of flutter
- MySQL splits strings for conditional queries
- SENT协议译码的深入探讨
- Complete activity switching according to sliding
- The solution of outputting 64 bits from printf format%lld of cross platform (32bit and 64bit)
- 7月华清学习-1
猜你喜欢

MySQL storage engine

Four operations and derivative operations of MATLAB polynomials
![[superhard core] is the core technology of redis](/img/5e/d6438f09031c2acbea17441c316a2b.jpg)
[superhard core] is the core technology of redis

How to clear floating?

Yum only downloads the RPM package of the software to the specified directory without installing it

Matlab boundarymask function (find the boundary of the divided area)

MySQL index (1)

16 channel water lamp experiment based on Proteus (assembly language)

Matlab struct function (structure array)

Tabbar configuration at the bottom of wechat applet
随机推荐
16 channel water lamp experiment based on Proteus (assembly language)
[hdu 2096] Xiaoming a+b
Get all stock data of big a
abap查表程序
Solve the problem of cache and database double write data consistency
Matlab label2idx function (convert the label matrix into a cell array with linear index)
mmclassification 训练自定义数据
Redis highly available slice cluster
Array cyclic shift problem
Leetcode-1. Sum of two numbers (Application of hash table)
Swift - add navigation bar
MySQL splits strings for conditional queries
1. Laravel creation project of PHP
Vscode shortcut key
Want to ask, how to choose a securities firm? Is it safe to open an account online?
Average lookup length when hash table lookup fails
MySQL regular expression
Experimental design - using stack to realize calculator
MVVM framework part I lifecycle
PXE startup configuration and principle