Figure database: an introduction to dgraph (1)

Time:2019-11-7

Dgraph

Fast, Transactional, Distributed Graph Database.
Dgraph is a distributed, transaction supported, fast graphics database.

The goal of dgraph is to provide the scale and throughput of Google’s production level, with low latency enough to provide real-time user queries of more than a few terabytes of structured data. The dgraph component supports the query syntax of graphql, as well as response JSON and protocol buffer exceeding grpc and HTTP.

Community status

As of May 1, 2019, the dgraph version is 1. X. More than 500 companies already use their products.
github: https://github.com/dgraph-io/…

Choice

At present, I know the graphical database neo4j. But at present, it seems that neo4j only supports stand-alone version, and distributed version needs enterprise level and closed source.

Official comparison URL: https://docs.dgraph.io/dgraph

install

I use docker to install. Please check the official website for other installation methods.

docker

image:

docker pull dgraph/dgraph:latest

Because dpragh is born to support distributed books, it uses docker compose to manage containers.

docker-compose.yml

version: "3.2"
services:
  #Dgraph zero controls the dgraph cluster, assigns servers to groups, and rebalances data between server groups.
  zero:
    image: dgraph/dgraph:latest
    volumes:
      - type: volume
        source: dgraph
        target: /dgraph
        volume:
          nocopy: true
    ports:
      - 5080:5080
      - 6080:6080
    restart: on-failure
    command: dgraph zero --my=zero:5080

  #Dgraph alpha managed predicates and indexes.
  server:
    image: dgraph/dgraph:latest
    volumes:
      - type: volume
        source: dgraph
        target: /dgraph
        volume:
          nocopy: true
    ports:
      - 8080:8080
      - 9080:9080
    restart: on-failure
    command: dgraph alpha --my=server:7080 --lru_mb=2048 --zero=zero:5080
    
  #Dgraph ratel provides the UI with the ability to run queries, mutate and change architecture.
  ratel:
    image: dgraph/dgraph:latest
    volumes:
      - type: volume
        source: dgraph
        target: /dgraph
        volume:
          nocopy: true
    ports:
      - 8000:8000
    command: dgraph-ratel
Data volume 
volumes:
  dgraph:

Start & close

CD ${docker-compose.yml directory}
Docker compose up - D // start
Docker compose down // close

tips:

Visit http: / / localhost: 8000 to view the GUI