//2019.08.05
一、相关概念
1、Dgraph:大规模分布式图数据库,提供ACID,
Dgraph is a horizontally scalable and distributed graph database, providing ACID transactions, consistent replication and linearizable reads. It's built from ground up to perform for a rich set of queries. Being a native graph database, it tightly controls how the data is arranged on disk to optimize for query performance and throughput, reducing disk seeks and network calls in a cluster.
Dgraph's goal is to provide Google production level scale and throughput, with low enough latency to be serving real time user queries, over terabytes of structured data. Dgraph supports GraphQL-like query syntax, and responds in JSON and Protocol Buffers over GRPC and HTTP.
2、与其他数据库的比对
3、docker compose
(1)相关概念
*在使用docker时, 如果定义dockerfile文件,然后使用docker build 、docker run 等命令来操作容器,然而为服务器架构的应用系统一般包含若干个微服务,每个微服务会部署多个实例,如果每个都要手动启停,则效率太低。
*因而,docker compose 可以轻松、高效的管理容器,是一个用于定义和运行多容器docker的应用程序工具。
(2)相关操作
- 打包项目,获取jar包 mvn clean package
- 在jar包所在路径创建Dockerfile,添加内容
- 在jar包所在路径创建文件docker-compose.yml
- 在docker-compose.yml所在路径下执行该命令Compose就会自动构建镜像并使用镜像启动容器
docker-compose up(docker-compose up -d //后台启动并运行容器)
3、相关操作
(1)突变mutation:在Dgraph中添加或者删除数据
在这里有两种标准格式:RDF 和JSON,操作包含两个模式:Blank UID reference 或者 explicit UID reference
- ·Blank UID: _:michael and _:amit.
- Explicit UID: <0x4e030f> <somePredicate> "some new data" .
*只能引用存在的UIDs,如果对不存在的UID执行mutation,Dgraph将返回错误。使用blamk nodes创建新节点,Dgraph为新节点分配一个新的UID
(2)GraphQL+-的特性:
- 每个查询都有一个名字,返回结果也以该名字标记
- 检索条件 func:... 进行匹配