Decentralized,distributed,peer-to-peer database.

P2PDB

standard-readme compliant

中文 | English

注意:

本项目只作为新型数据库技术理论验证使用,当前不具备任何生产可用性。

简介

P2PDB(p2p数据库),一个去中心化、分布式、点对点数据库、P2PDB使用IPFS-libp2p构建分布式网络和IPFS-pubsub与对等节点同步数据。P2PDB期望打造一个去中心化的分布式数据库,使P2PDB 成为线下实体店离线应用程序,去中心化应用程序(dApps)、和边缘计算应用数据存储的绝佳选择, P2PDB基于白皮书实现

P2PDB包含以下功能:

  1. count 一个分布式计数器,用于验证项目可行性,使用CRDT协议,实现最终一致性(探索中,未有明确计划)

  2. kv 一个key=>value 的键值数据库,使用CRDT协议,实现最终一致性(探索中,未有明确计划)

  3. doc 一个专为配置文档、注册中心设计的文档数据库,使用CRDT协议,实现最终一致性(探索中,未有明确计划)

  4. sql 一个基于sqlite, 使用CRDT协议,实现最终一致性 (探索中,未有明确计划)

  5. pubsub 基于IPFS Pubsub实现 消息订阅、广播推送 (探索中,未有明确计划)

  6. p2pdb-log 基于merker-CRDT协议实现的不可篡改日志组件,(开发中)

所有数据库都在p2pdb-log之上实现,p2pdb-log是一种用于分布式系统的不可变的、基于操作的无冲突复制数据结构 (CRDT)与Merkle DAG(有向无环图)实现。如果所有 P2PDB 数据库类型都不符合您的需求和/或您需要特定于案例的功能,您可以轻松使用日志模块实现您想要的数据库。

内容列表

背景

P2PDB最早源于KK集团离线收银项目的研发,早期采用了Raft协议+Sqlite 实现一个轻量级的分布式数据库,随着对Raft协议的深入研究,发现Raft协议对于离线场景存在较大缺陷(故障节点数量大于50%,整个集群无法工作),随后开启了深入研究分布式数据库协议的道路,在一年后发现基于默克尔有向无环图+CRDT实现的逻辑时钟merker-CRDT可以实现最终一致性的去中心化、分布式、点对点数据库,并且针对离线场景做了充分的支持。

P2PDB 是一个点对点数据库,这意味着每个对等点都有自己的特定数据库实例。数据库在对等点之间自动复制,从而在任何对等点更新时生成数据库的最新视图。也就是说,数据库被拉到客户端。

这意味着每个应用程序都包含他们正在使用的完整数据库。与客户端-服务器模型相比,这反过来又改变了数据建模,客户端-服务器模型通常为所有数据使用一个大数据库:在 P2PDB 中,应该根据该数据的访问权限进行存储、“分区”或“分片”。例如,在类似微博的应用程序中,推文不会保存在数百万用户同时写入的全局“推文”数据库中,而是每个用户都有自己的微博数据库。要订阅别的用户推文,只需关注主题(topic)

—— 跟ipfs的关系

ipfs协议 用于构建分布式低延迟的消息传输网络,而P2PDB 项目是基于ipfs协议实现.。

目标

这个数据库的目标是:

  1. 一个Dapp应用数据存储方案
  2. 一个去中心化分布式数据库解决方案
  3. 一个边缘数据存储解决方案

使用场景

  • 1、文章阅读数、投票数、点赞数
  • 2、文章评论
  • 3、微服务的服务注册、发现
  • 4、配置中心
  • 5、分布式缓存
  • 6、多人实时协作
  • 7、更多.........

架构

架构设计图

avatar

目录分层设计

interface 接口层
----api
--------count
--------kv
--------doc
--------sql
-----http 对外暴露的http api 接口
-----rpc 对外暴露的rpc api接口
-----cli 命令行执行工具
domain 领域层, 核心逻辑
Infrastructure	基础设施层
----ipfs
--------ipfs-log
----sqlite
----Util  公共工具,如日志
--------log

文档

说明

p2pdb 采用了纯golang 语言实现, 如果你的技术栈以Javascript为主,可使用orbitdb-db 替代p2pdb

想了解我们建议的规范是如何被应用的,请参考 example-readmes

本数据库使用到的部分仓库

维护者

@Rock

如何贡献

非常欢迎你的加入!提一个 Issue 或者提交一个 Pull Request。

标准 Readme 遵循 Contributor Covenant 行为规范。

贡献者

© Rock Li

使用许可

Apache License Version 2.0 see http://www.apache.org/licenses/LICENSE-2.0.html

Owner
KK集团
国潮新零售生态集团,旗下拥有 KK馆、KKV、The Colorist 调色师、X11 等品牌
KK集团
Similar Resources

Owl is a db manager platform,committed to standardizing the data, index in the database and operations to the database, to avoid risks and failures.

Owl is a db manager platform,committed to standardizing the data, index in the database and operations to the database, to avoid risks and failures. capabilities which owl provides include Process approval、sql Audit、sql execute and execute as crontab、data backup and recover .

Nov 9, 2022

This is a simple graph database in SQLite, inspired by "SQLite as a document database".

About This is a simple graph database in SQLite, inspired by "SQLite as a document database". Structure The schema consists of just two structures: No

Jan 3, 2023

Hard Disk Database based on a former database

Hard Disk Database based on a former database

Nov 1, 2021

Simple key value database that use json files to store the database

KValDB Simple key value database that use json files to store the database, the key and the respective value. This simple database have two gRPC metho

Nov 13, 2021

Beerus-DB: a database operation framework, currently only supports Mysql, Use [go-sql-driver/mysql] to do database connection and basic operations

Beerus-DB · Beerus-DB is a database operation framework, currently only supports Mysql, Use [go-sql-driver/mysql] to do database connection and basic

Oct 29, 2022

Eventually consistent distributed in-memory cache Go library

bcache A Go Library to create distributed in-memory cache inside your app. Features LRU cache with configurable maximum keys Eventual Consistency sync

Dec 2, 2022

A distributed key-value store. On Disk. Able to grow or shrink without service interruption.

Vasto A distributed high-performance key-value store. On Disk. Eventual consistent. HA. Able to grow or shrink without service interruption. Vasto sca

Jan 6, 2023

A distributed Configuration Center server that manages config in a container. The container is composed of fields (abstract layer includes: KV, LIST, DICT type). The Field contains basic datatypes (int, float, bool, string, list, dict).

A distributed Configuration Center server that manages config in a container. The container is composed of fields (abstract layer includes: KV, LIST, DICT type). The Field contains basic datatypes (int, float, bool, string, list, dict).

cassem config assembler from key-value pairs' container which include basic datatypes, such as int, string, float, bool, list, dict Features HTTP Rest

Nov 1, 2022

A distributed MySQL binlog storage system built on Raft

A distributed MySQL binlog storage system built on Raft

What is kingbus? 中文 Kingbus is a distributed MySQL binlog store based on raft. Kingbus can act as a slave to the real master and as a master to the sl

Dec 31, 2022
Related tags
A decentralized, trusted, high performance, SQL database with blockchain features
A decentralized, trusted, high performance, SQL database with blockchain features

中文简介 CovenantSQL(CQL) is a Byzantine Fault Tolerant relational database built on SQLite: ServerLess: Free, High Availabile, Auto Sync Database Service

Jan 3, 2023
Distributed reliable key-value store for the most critical data of a distributed system

etcd Note: The master branch may be in an unstable or even broken state during development. Please use releases instead of the master branch in order

Jan 9, 2023
CockroachDB - the open source, cloud-native distributed SQL database.
CockroachDB - the open source, cloud-native distributed SQL database.

CockroachDB is a cloud-native SQL database for building global, scalable cloud services that survive disasters. What is CockroachDB? Docs Quickstart C

Jan 2, 2023
The lightweight, distributed relational database built on SQLite.
The lightweight, distributed relational database built on SQLite.

rqlite is a lightweight, distributed relational database, which uses SQLite as its storage engine. Forming a cluster is very straightforward, it grace

Jan 5, 2023
TiDB is an open source distributed HTAP database compatible with the MySQL protocol
TiDB is an open source distributed HTAP database compatible with the MySQL protocol

Slack Channel Twitter: @PingCAP Reddit Mailing list: lists.tidb.io For support, please contact PingCAP What is TiDB? TiDB ("Ti" stands for Titanium) i

Jan 9, 2023
LBADD: An experimental, distributed SQL database
LBADD: An experimental, distributed SQL database

LBADD Let's build a distributed database. LBADD is an experimental distributed SQL database, written in Go. The goal of this project is to build a dat

Nov 29, 2022
A course to build the SQL layer of a distributed database.

TinySQL TinySQL is a course designed to teach you how to implement a distributed relational database in Go. TinySQL is also the name of the simplifed

Jan 8, 2023
TalariaDB is a distributed, highly available, and low latency time-series database for Presto
TalariaDB is a distributed, highly available, and low latency time-series database for Presto

TalariaDB is a distributed, highly available, and low latency time-series database that stores real-time data. It's built on top of Badger DB.

Nov 16, 2022
Redwood is a highly-configurable, distributed, realtime database that manages a state tree shared among many peers

Redwood is a highly-configurable, distributed, realtime database that manages a state tree shared among many peers. Imagine something like a Redux store, but distributed across all users of an application, that offers offline editing and is resilient to poor connectivity.

Jan 8, 2023
Couchbase - distributed NoSQL cloud database

couchbase Couchbase is distributed NoSQL cloud database. create Scope CREATE SCO

Feb 16, 2022