温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

如何理解dqlite

发布时间:2021-11-22 19:10:40 来源:亿速云 阅读:520 作者:柒染 栏目:云计算

这篇文章给大家介绍如何理解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
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

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

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI