Figure introduction of database Neo4j and installation and deployment
Neo4j is the leader of today's market graph database. It has enterprise-level functions such as scalability and high availability, and is the best choice to meet our needs.
What kind of problems does the graph database solve?
Why choose Neo4j?
Relational databases can not handle relationships well.
NoSQL database does not handle relationships
Neo4j is a graphic database based on Java. To run Neo4j, you need to start the JVM process, so you must install JDK for JAVA SE.
# step 1: install jdk
Wget-c http://download.cashalo.com/schema/auto_jdk.shsource auto_jdk.sh
# step 2: execute the following automated installation script
#! / bin/bash#neo4j installation # 1) set hosts binding IP= `ifconfig | sed-n 2p | awk'{print $2}'| cut-d ":"-f2`echo "$IP neo4j" > > / etc/hosts#2) download and install neo4jcd / home/toolswget-c https://neo4j.com/artifact.php?name=neo4j-community-3.4.14-unix.tar.gztar zxvf artifact.php\? name\ = neo4j-community-3.4.14-unix.tar.gz-C / usr/local/ln-s / usr/local/neo4j-community-3.4.14 / usr/local/neo4j-community#3) configure the environment variable cat > / etc/profile.d/neo4j & 2 exit 3 ; esacEOF#6) set permissions chmod + x / etc/init.d/neo4j#7) launch neo4jservice neo4j start#8) configure boot self-boot chkconfig neo4j on
Enter the 7474 interface of the browser
Cypher language
Cypher is a descriptive Sql-like graph manipulation language. Equivalent to the Sql of a relational database, you can see its importance!
Its grammar is designed according to the characteristics of the graph, which is very convenient and flexible.
No Join, is a major feature!
Cypher is a declarative query language suitable for developers and point-to-point mode (ad-hoc) queries on databases.
Cypher is inspired to express queries through a series of different methods and practices based on certainty. Many keywords such as like and order by are inspired by SQL. The regular expression matching implementation mimics the Scala language.
Learning Cypher well is the key and core of learning Neo4j well.
Create syntax
Create (n:Person {id:'20140101',name:' Wang Wu', age:30,card:123456})
Equivalent to the relational Sql:
Create table Person (
Id varchar2
Name varchar2
Age number
Card number)
Insert into Person values ('20140101' Wang Wu', 30meme123456)
Neo4j field type
Match
Match query syntax
Match is equivalent to select.
MATCH (n:Person) RETURN n limit 25
Equivalent to:
Select * from Person limit 25