dqlite-分布式SQLite简介

瘦欲@ 提交于 2020-04-09 04:27:13

dqlite(https://github.com/canonical/dqlite)是一个 C library,实现了一个嵌入式的可复制SQL database engine,具有高可用和自动失效恢复的特性。

名称 "dqlite" 意味着 "distributed SQLite",是 dqlite 扩展了 SQLite 而来。SQLite主要单机使用,而dqlite添加了 network protocol可以将多个应用实例链接为一个高可用的集群,而且不需要依赖其他的外部数据库。

使用dqlite的Kubernetes分发版包括MicroK8s和K3s。

主要特性

能力:

  • 完全同步的 network 和 disk I/O
  • Comprehensive test suite for correctness
  • Benchmarked for memory footprint and network efficiency
  • 持久化存储用于transaction logs
  • 快速恢复,用于system restore
  • 稳定的 Golang 客户端,文档包含 wire protocol 用于其它语言的实现。
  • 支持 ARM, X86, POWER 和 IBM Z architectures

特性:

  • 超低时延,C-Raft 最小化交易延迟。

  • 移植性,C-Raft 和 dqlite 都用c语言编写,提供多平台支持。

  • 开源,采用Apache 2.0 许可,最大的兼容性。

  • 可用,Includes common CLI pattern for database initialization and voting member joins and departures.

  • 快速失效回复,Minimal, tunable delay for failover with automatic leader election.

  • 持续性,Disk-backed database with in-memory options and SQLite transactions.

  • 设计特性,Asynchronous single-threaded implementation using libuv as event loop.

  • 自定义的wire protocol,优化了SQLite primitives 和 data types.

  • 数据复制,基于 Raft algorithm 和高效的 C-raft 实现。

许可

The dqlite library is released under a slightly modified version of LGPLv3, that includes a copyright exception letting users to statically link the library code in their project and release the final work under their own terms. See the full license text.

试用

The simplest way to see dqlite in action is to use the demo program that comes with the Go dqlite bindings. Please see the relevant documentation in that project.

媒体

A talk about dqlite was given at FOSDEM 2020, you can watch it here.

协议-Wire protocol

If you wish to write a client, please refer to the wire protocol documentation.

快速安装

If you are on a Debian-based system, you can the latest stable release from dqlite's stable PPA:

sudo add-apt-repository ppa:dqlite/stable
sudo apt-get update
sudo apt-get install libdqlite-dev

源码构建

To build libdqlite from source you'll need:

  • A reasonably recent version of libuv (v1.8.0 or beyond).
  • A patched version of SQLite with support for WAL-based replication.
  • A build of the C-raft Raft library.
  • A build of the libco coroutine library.

Your distribution should already provide you a pre-built libuv shared library.

To build the other libraries:

git clone --depth 100 https://github.com/canonical/sqlite.git
cd sqlite
./configure --enable-replication
make
sudo make install
cd ..
git clone https://github.com/canonical/libco.git
cd libco
make
sudo make install
cd ..
git clone https://github.com/canonical/raft.git
cd raft
autoreconf -i
./configure
make
sudo make install
cd ..

Once all required libraries are installed, to in order to build the dqlite shared library itself you can run:

autoreconf -i
./configure
make
sudo make install

本文来自于:http://dqlite-分布式SQLite简介 

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!