共計 2450 個字符,預(yù)計需要花費 7 分鐘才能閱讀完成。
這篇文章給大家介紹如何理解 dqlite,內(nèi)容非常詳細,感興趣的小伙伴們可以參考借鑒,希望對大家能有所幫助。
dqlite 是一個 C library,實現(xiàn)了一個嵌入式的可復(fù)制 SQL database engine,具有高可用和自動失效恢復(fù)的特性。
名稱 dqlite 意味著 distributed SQLite,是 dqlite 擴展了 SQLite 而來。SQLite 主要單機使用,而 dqlite 添加了 network protocol 可以將多個應(yīng)用實例鏈接為一個高可用的集群,而且不需要依賴其他的外部數(shù)據(jù)庫。
使用 dqlite 的 Kubernetes 分發(fā)版包括 MicroK8s 和 K3s。
主要特性
能力:
完全同步的 network 和 disk I/O
Comprehensive test suite for correctness
Benchmarked for memory footprint and network efficiency
持久化存儲用于 transaction logs
快速恢復(fù),用于 system restore
穩(wěn)定的 Golang 客戶端,文檔包含 wire protocol 用于其它語言的實現(xiàn)。
支持 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.
快速失效回復(fù),Minimal, tunable delay for failover with automatic leader election.
持續(xù)性,Disk-backed database with in-memory options and SQLite transactions.
設(shè)計特性,Asynchronous single-threaded implementation using libuv as event loop.
自定義的 wire protocol,優(yōu)化了 SQLite primitives 和 data types.
數(shù)據(jù)復(fù)制,基于 Raft algorithm 和高效的 C-raft 實現(xiàn)。
許可
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.
協(xié)議 -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
源碼構(gòu)建
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
關(guān)于如何理解 dqlite 就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,可以學(xué)到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。