First, the classification database
1, a relational database
Relational database, refers to the use of the relational model database to organize the data, which is stored as rows and columns of data in order to understand the user, the series of relational database rows and columns are called table, a set of tables the database. User to retrieve data by querying the database, and query execution code is used to define a certain area of the database. Relational model can be simply understood as a form of two-dimensional model, and a relational database is a data organization and the relationship between the two-dimensional tables. There are mainstream relational database Oracle, DB2, MySQL, SQL Server, etc.
2, non-relational database
Non-relational database, also known as NoSQL, refers to non-relational database. With the rise of the Internet web2.0 websites, traditional relational database processing web2.0 sites, particularly large scale and high concurrent SNS type of web2.0 pure dynamic site has appeared to be inadequate, there have been many problems difficult to overcome, rather than relational databases due to its own characteristics has been very rapid development. NoSQL database is generated in order to solve large-scale data collection of multiple data types of challenges brought about, especially in big data application problems. Common non-relational database by category are:
**键值(Key-Value)**: Redis、Memcached、Oracle BDB
** column store database **: Cassandra, HBase, Riak
** document database **: MongoDB, SequoiaDB
** Graphics Database **: Neo4J, JanusGraph, TigerGraph
Two, Neo4j
1. What is Neo4j
NOSQL Neo4j is a high performance graphics database, structured data will be stored on the network rather than the table. It is an embedded, disk-based, with full transactional Java persistence engine characteristics, but it will be structured data stored in the network (Figure mathematically is called), rather than on the table. Neo4j can also be viewed as a high performance FIG engine, which has all the characteristics of a mature database. In simple terms Neo4j is an open source Java-based development, running on the JVM.
Data structure 2, Neo4j of
It contains two basic types of data in one figure: ** Nodes **** (node) and ** ** Relationships **** (relationship) **. ** Nodes ** ** and Relationships ** comprising key / value attribute form. Nodes are connected together by Relationships defined relationship, relationship network structure is formed.
3, the difference between Community Edition and Enterprise Edition
· Community Edition limitations
Node: 32000000000
Relationship: 32000000000
Properties: 64000000000
· Enterprise Edition and Community Edition has a function
1 Property Graph Model (FIG attribute model)
2 Native Graph Processing & Storage (local graphics processing and storage)
3 ACID (transaction management)
4 Cypher - Graph Query Language (Figure Cypher support queries)
5 REST API (Restful style api)
6 High-Performance Native API (high performance native API)
7 HTTPS
· Enterprise's unique features
1 cluster (horizontal scaling / availability)
Community Edition does not support high availability cluster configuration, and only single.
22, users and roles based access control
Community Edition in safety management compared to the Enterprise Edition, the function is weak, only the user and password management, does not involve roles, access control and other essential enterprise security management functions.
3 Hot Backup
Community Edition does not support hot backups (neo4j-backup), only Enterprise Edition have this tool.
4 Logging
Community Edition is no security log feature, Neo4j provide security logs and query logs two types of query and the occurrence of security incidents database records, but supported only in Enterprise Edition.
5 Query Manager
You can set the transaction timeout, and lists running queries, you can selectively terminate one or more queries.
6 diagnostic and tuning tools
JMX logging and monitoring, include Graphite JMX client
Vertical scaling 7 (more than 4 nuclei)
Support for more than four CPU cores, for more than 4-core CPU parallel graph algorithms to provide highly optimized implementation process.
8 Lock Manager
For more than 4-core CPU system provides a more efficient mechanism to increase the write lock concurrent processing
9 Cypher query to track
Queries running track and manage the state (such as a forced end to run the query)
10 enterprise-level monitoring
A more comprehensive monitoring plug-ins and log output, the community version only http logs, Enterprise Edition includes GC, Security log.
11 world-class support
Money and consequently to say ......
· Enterprise Edition offer
Package (x server kernel) Price (million dollars / year)
3 x 8 = 19.9 (million dollars / year)
3 x 4 = 9.9 (million dollars / year)
2 x 4 = 6.8 (million dollars / year)
1 x 4 = 3.6 (million dollars / year)
It should be noted that companies offer neo4j not only related to the number of machines and is also linked to the number of CPU cores.
4, Neo4j use
(1) Environment
Java: jdk1.8
Neo4j: neo4j3.5.7
(2) Installation
> Information Package: https: //pan.baidu.com/s/1cA49NnqzQp0Z9QQdCX9GGw
· The JDK installation
```shell
1. Upload decompression
tar -zxvf jdk-8u221-linux-x64.tar.gz
2. Configure environment variables jdk
vim /etc/profile
JAVA_HOME=/usr/local/java/jdk1.8.0_221
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH
3. To validate the configuration
source /etc/profile
```
· Neo4j installation
> Download: https: //neo4j.com/download-center/#releases
```shell
1. Upload decompression
tar -zxvf neo4j-community-3.5.7-unix.tar.gz
2. modify the configuration files in the conf directory neo4j.conf allow remote access
dbms.connectors.default_listen_address=0.0.0.0
3. We prepared the database to extract the data / databases under the database name defaults to graph.db
tar xvf graph.tar
4. Perform the start scripts in the bin directory
./neo4j start
5. Browser Access
http://you ip:7474
```
(3) Simple to use
1 through the browser to access the library, the default account secret: neo4j / neo4j, you will be prompted to change your password
2 correct posture open
3 Gallery query and returns the number of restrictions
MATCH (n) RETURN n LIMIT 25
4 If you want to find the baby this time Zhang Liangping do something with it asked how things should be? We can see the relationship map there are n ways to achieve, then the pursuit of efficiency is certainly "seek the least thing most people do," this time we should use our shortest path algorithm, the gallery has been self-assured brought.
match p = shortestpath ((u1: User {name: 'Single baby'}) - [*] - (u2: User {name: 'HOU Ryohei'})) return p
5, Neo4j scenarios
(1) Financial Industry Application
Fraud is the financial industry has been a core application, you can do correlation analysis of different individuals, groups by drawing a database, from the behavior of the characters within the specified time, such as IP addresses have been to places, have used the MAC address (including mobile phones end, PC end, WIFI, etc.), the association of social network analysis, the same point in time ever appear near the same location, was there a historical transaction information between bank accounts.
(2) social networking profiles
In social networks, the company, employees, skills, information, these are the nodes, the relationship between friends and relations between them are side in this map database which can do some very complex relationship between the company's inquiry . For example, the company to employees, employees to other companies, which look similar companies, like companies, can be completed within this system.
(3) Corporate Relations map
Map database can be established for a variety of enterprise information map, including the most basic industrial and commercial information, including when registering, who registered, the registered capital, where the office, scope of business, executives architecture. Around business scope, companies continue to refine the query to exactly what the product or service, such as a query to companies from the media business by name, giving it more attention and understanding. It also includes related products and services for enterprise data to see if the company has no convincing intellectual property rights and relevant qualifications to support the business.
Enterprises in the daily operations with customers, partners, channels parties, investors will deal, which also determines the company in all areas of society have covered a wide, showing intricate surface, it can be queried by enterprise data maps, layers of excavation information. Enterprise Information inquiry-based map data can really understand all aspects of business, rather than the traditional single industrial and commercial information query.
6, thinking
These are just the basic installation neo4j map database, and simple to use application scenarios, so if we make good use of the map database, how to define your own graph model, written statements, and the gallery Gallery How our java code to operate up? Please pay attention to the next issue produced.