如何理解dqlite

52次阅读
没有评论

共计 2450 个字符,预计需要花费 7 分钟才能阅读完成。

这篇文章给大家介绍如何理解 dqlite,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。

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
sudo make install
cd ..
git clone https://github.com/canonical/libco.git
cd libco
sudo make install
cd ..
git clone https://github.com/canonical/raft.git
cd raft
autoreconf -i
./configure
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
sudo make install

关于如何理解 dqlite 就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-08-25发表,共计2450字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)