当前位置:网站首页>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 !
边栏推荐
- Learn the garbage collector of JVM -- a brief introduction to Shenandoah collector
- Codeforces Round #804 (Div. 2)
- ZABBIX 5.0 - LNMP environment compilation and installation
- JS for循环 循环次数异常
- 互联网公司实习岗位选择与简易版职业发展规划
- ZABBIX agent2 installation
- 强化学习-学习笔记3 | 策略学习
- Intern position selection and simplified career development planning in Internet companies
- Master the new features of fluent 2.10
- Learn garbage collection 01 of JVM -- garbage collection for the first time and life and death judgment
猜你喜欢
A guide to threaded and asynchronous UI development in the "quick start fluent Development Series tutorials"
Uniapp + unicloud + Unipay realize wechat applet payment function
Third party payment interface design
Matlab superpixels function (2D super pixel over segmentation of image)
7月华清学习-1
Embedded software architecture design - message interaction
Hiengine: comparable to the local cloud native memory database engine
Average lookup length when hash table lookup fails
Redis highly available sentinel cluster
Flutter2 heavy release supports web and desktop applications
随机推荐
Get data from the database when using JMeter for database assertion
Four operations and derivative operations of MATLAB polynomials
byte2String、string2Byte
Third party payment interface design
Correct opening method of redis distributed lock
Want to ask, how to choose a securities firm? Is it safe to open an account online?
Two minutes will take you to quickly master the project structure, resources, dependencies and localization of flutter
Leetcode-1. Sum of two numbers (Application of hash table)
Understand kotlin from the perspective of an architect
Learn memory management of JVM 01 - first memory
How does MySQL execute an SQL statement?
Thoughts and suggestions on the construction of intelligent management and control system platform for safe production in petrochemical enterprises
Matlab label2idx function (convert the label matrix into a cell array with linear index)
Automated test lifecycle
MySQL constraints
Basic operations of MySQL data table, addition, deletion and modification & DML
Select drop-down box realizes three-level linkage of provinces and cities in China
Error modulenotfounderror: no module named 'cv2 aruco‘
mysql拆分字符串做条件查询
MySQL index - extended data