Tidis

Distributed transactional NoSQL database, Redis protocol compatible using tikv as backend
Alternatives To Tidis
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Redis63,45833 hours ago1February 27, 20182,505bsd-3-clauseC
Redis is an in-memory database that persists on disk. The data model is key-value, but many different kind of values are supported: Strings, Lists, Sets, Sorted Sets, Hashes, Streams, HyperLogLogs, Bitmaps.
Awesome Cheatsheets36,331
11 days ago104mitJavaScript
👩‍💻👨‍💻 Awesome cheatsheets for popular programming languages, frameworks and development tools. They include everything you should know in one single file.
Cs Books16,036
5 months ago11mit
🔥🔥超过1000本的计算机经典书籍、个人笔记资料以及本人在各平台发表文章中所涉及的资源等。书籍资源包括C/C++、Java、Python、Go语言、数据结构与算法、操作系统、后端架构、计算机系统知识、数据库、计算机网络、设计模式、前端、汇编以及校招社招各种面经~
Coolify10,804
3 hours ago66apache-2.0PHP
An open-source & self-hostable Heroku / Netlify / Vercel alternative.
Springcloud8,388
2 months ago57apache-2.0Java
基于SpringCloud2.1的微服务开发脚手架,整合了spring-security-oauth2、nacos、feign、sentinel、springcloud-gateway等。服务治理方面引入elasticsearch、skywalking、springboot-admin、zipkin等,让项目开发快速进入业务开发,而不需过多时间花费在架构搭建上。持续更新中
Technical Books5,519
a month agocc-by-sa-4.0HTML
😆 国内外互联网技术大牛们都写了哪些书籍:计算机基础、网络、前端、后端、数据库、架构、大数据、深度学习...
Octosql4,60035 months ago38May 30, 202341mpl-2.0Go
OctoSQL is a query tool that allows you to join, analyse and transform data from multiple databases and file formats using SQL.
Db Tutorial4,096
5 days ago7cc-by-sa-4.0Java
📚 db-tutorial 是一个数据库教程。
Olric2,9071921 days ago94February 04, 202323apache-2.0Go
Distributed in-memory object store. It can be used as an embedded Go library and a language-independent service.
Flask Base2,838
a year ago1mitPython
A simple Flask boilerplate app with SQLAlchemy, Redis, User Authentication, and more.
Alternatives To Tidis
Select To Compare


Alternative Project Comparisons
Readme

💔💔💔 This repo is archived and no longer maintained.

❤️❤️❤️ Please refer to the totally new version with more features maintained by PingCAP officially.

tidb-incubator/tidis

Build Status Go Report Card Project Status

What is Tidis?

Tidis is a Distributed NoSQL database, providing a Redis protocol API (string, list, hash, set, sorted set), written in Go.

Tidis is like TiDB layer, providing protocol transform and data structure compute, powered by TiKV backend distributed storage which use Raft for data replication and 2PC for distributed transaction.

Features

  • Redis protocol compatible
  • Linear scale-out ability
  • Storage and computation separation
  • Data safety, no data loss, Raft replication
  • Transaction support

Any pull requests are welcomed.

Architecture

Architechture of tidis

architecture

Architechture of tikv

  • Placement Driver (PD): PD is the brain of the TiKV system which manages the metadata about Nodes, Stores, Regions mapping, and makes decisions for data placement and load balancing. PD periodically checks replication constraints to balance load and data automatically.
  • Node: A physical node in the cluster. Within each node, there are one or more Stores. Within each Store, there are many Regions.
  • Store: There is a RocksDB within each Store and it stores data in local disks.
  • Region: Region is the basic unit of Key-Value data movement and corresponds to a data range in a Store. Each Region is replicated to multiple Nodes. These multiple replicas form a Raft group. A replica of a Region is called a Peer.

1. Run tidis with docker-compose in one command

git clone https://github.com/yongman/tidis-docker-compose.git
cd tidis-docker-compose/
docker-compose up -d

Or follow tidis-docker-compose guide to run with docker-compose

2. Build or Docker mannually

Build from source

git clone https://github.com/yongman/tidis.git
cd tidis && make

Pull from docker

docker pull yongman/tidis

Run TiKV cluster for test

Use docker run tikv for test, just follow PingCAP official guide, you just need to deploy PD and TiKV servers, Tidis will take the role of TiDB.

Run Tidis or docker

Run tidis from executable file

bin/tidis-server -conf config.toml

Run tidis from docker

docker run  -d --name tidis -p 5379:5379 -v {your_config_dir}:/data yongman/tidis -conf="/data/config.toml"

3. Client request

redis-cli -p 5379
127.0.0.1:5379> get a
"1"
127.0.0.1:5379> lrange l 0 -1
1) "6"
2) "5"
3) "4"
127.0.0.1:5379> zadd zzz 1 1 2 2 3 3 4 4
(integer) 4
127.0.0.1:5379> zcard zzz
(integer) 4
127.0.0.1:5379> zincrby zzz 10 1
(integer) 11
127.0.0.1:5379> zrange zzz 0 -1 withscores
1) "2"
2) "2"
3) "3"
4) "3"
5) "4"
6) "4"
7) "1"
8) "11"

Already supported commands

Keys

+-----------+-------------------------------------+
|  pexpire  | pexpire key int                     |
+-----------+-------------------------------------+
| pexpireat | pexpireat key timestamp(ms)         |
+-----------+-------------------------------------+
|   expire  | expire key int                      |
+-----------+-------------------------------------+
|  expireat | expireat key timestamp(s)           |
+-----------+-------------------------------------+
|    pttl   | pttl key                            |
+-----------+-------------------------------------+
|    ttl    | ttl key                             |
+-----------+-------------------------------------+
|    type   | type key                            |
+-----------+-------------------------------------+

String

+-----------+-------------------------------------+
|  command  |               format                |
+-----------+-------------------------------------+
|    get    | get key                             |
+-----------+-------------------------------------+
|    set    | set key value [EX sec|PX ms][NX|XX] | 
+-----------+-------------------------------------+
|   getbit  | getbit key offset                   |
+-----------+-------------------------------------+
|   setbit  | setbit key offset value             |
+-----------+-------------------------------------+
|    del    | del key1 key2 ...                   |
+-----------+-------------------------------------+
|    mget   | mget key1 key2 ...                  |
+-----------+-------------------------------------+
|    mset   | mset key1 value1 key2 value2 ...    |
+-----------+-------------------------------------+
|    incr   | incr key                            |
+-----------+-------------------------------------+
|   incrby  | incr key step                       |
+-----------+-------------------------------------+
|    decr   | decr key                            |
+-----------+-------------------------------------+
|   decrby  | decrby key step                     |
+-----------+-------------------------------------+
|   strlen  | strlen key                          |
+-----------+-------------------------------------+

Hash

+------------+------------------------------------------+
|  Commands  | Format                                   |
+------------+------------------------------------------+
|    hget    | hget key field                           |
+------------+------------------------------------------+
|   hstrlen  | hstrlen key                              |
+------------+------------------------------------------+
|   hexists  | hexists key                              |
+------------+------------------------------------------+
|    hlen    | hlen key                                 |
+------------+------------------------------------------+
|    hmget   | hmget key field1 field2 field3...        |
+------------+------------------------------------------+
|    hdel    | hdel key field1 field2 field3...         |
+------------+------------------------------------------+
|    hset    | hset key field value                     |
+------------+------------------------------------------+
|   hsetnx   | hsetnx key field value                   |
+------------+------------------------------------------+
|    hmset   | hmset key field1 value1 field2 value2... |
+------------+------------------------------------------+
|    hkeys   | hkeys key                                |
+------------+------------------------------------------+
|    hvals   | hvals key                                |
+------------+------------------------------------------+
|   hgetall  | hgetall key                              |
+------------+------------------------------------------+

List

+------------+-----------------------+
|  commands  |         format        |
+------------+-----------------------+
|    lpop    | lpop key              |
+------------+-----------------------+
|    rpush   | rpush key             |
+------------+-----------------------+
|    rpop    | rpop key              |
+------------+-----------------------+
|    llen    | llen key              |
+------------+-----------------------+
|   lindex   | lindex key index      |
+------------+-----------------------+
|   lrange   | lrange key start stop |
+------------+-----------------------+
|    lset    | lset key index value  |
+------------+-----------------------+
|    ltrim   | ltrim key start stop  |
+------------+-----------------------+

Set

+-------------+--------------------------------+
|   commands  |             format             |
+-------------+--------------------------------+
|     sadd    | sadd key member1 [member2 ...] |
+-------------+--------------------------------+
|    scard    | scard key                      |
+-------------+--------------------------------+
|  sismember  | sismember key member           |
+-------------+--------------------------------+
|   smembers  | smembers key                   |
+-------------+--------------------------------+
|     srem    | srem key member                |
+-------------+--------------------------------+
|    sdiff    | sdiff key1 key2                |
+-------------+--------------------------------+
|    sunion   | sunion key1 key2               |
+-------------+--------------------------------+
|    sinter   | sinter key1 key2               |
+-------------+--------------------------------+
|  sdiffstore | sdiffstore key1 key2 key3      |
+-------------+--------------------------------+
| sunionstore | sunionstore key1 key2 key3     |
+-------------+--------------------------------+
| sinterstore | sinterstore key1 key2 key3     |
+-------------+--------------------------------+

Sorted set

+------------------+---------------------------------------------------------------+
|     commands     |                             format                            |
+------------------+---------------------------------------------------------------+
|       zadd       | zadd key member1 score1 [member2 score2 ...]                  |
+------------------+---------------------------------------------------------------+
|       zcard      | zcard key                                                     |
+------------------+---------------------------------------------------------------+
|      zrange      | zrange key start stop [WITHSCORES]                            |
+------------------+---------------------------------------------------------------+
|     zrevrange    | zrevrange key start stop [WITHSCORES]                         |
+------------------+---------------------------------------------------------------+
|   zrangebyscore  | zrangebyscore key min max [WITHSCORES][LIMIT offset count]    |
+------------------+---------------------------------------------------------------+
| zrevrangebyscore | zrevrangebyscore key max min [WITHSCORES][LIMIT offset count] |
+------------------+---------------------------------------------------------------+
| zremrangebyscore | zremrangebyscore key min max                                  |
+------------------+---------------------------------------------------------------+
|    zrangebylex   | zrangebylex key min max [LIMIT offset count]                  |
+------------------+---------------------------------------------------------------+
|  zrevrangebylex  | zrevrangebylex key max min [LIMIT offset count]               |
+------------------+---------------------------------------------------------------+
|  zremrangebylex  | zremrangebylex key min max                                    |
+------------------+---------------------------------------------------------------+
|      zcount      | zcount key                                                    |
+------------------+---------------------------------------------------------------+
|     zlexcount    | zlexcount key                                                 |
+------------------+---------------------------------------------------------------+
|      zscore      | zscore key member                                             |
+------------------+---------------------------------------------------------------+
|       zrem       | zrem key member1 [member2 ...]                                |
+------------------+---------------------------------------------------------------+
|      zincrby     | zincrby key increment member                                  |
+------------------+---------------------------------------------------------------+

Transaction

+---------+---------+
| command | support |
+---------+---------+
|  multi  | Yes     |
+---------+---------+
|   exec  | Yes     |
+---------+---------+

Server & Connections

+-----------+---------------+
| command  	| format     	|
+-----------+---------------+
| flushdb  	| flushdb id 	|
+-----------+---------------+
| flushall 	| flush      	|
+-----------+---------------+
| select   	| select id  	|
+-----------+---------------+

Benchmark

base benchmark

License

Tidis is under the MIT license. See the LICENSE file for details.

Acknowledgment

  • Thanks PingCAP for providing tikv and pd powerful components.
  • Thanks RocksDB for their powerful storage engines.
Popular Redis Projects
Popular Database Projects
Popular Data Storage Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Go
Docker
Database
Redis
Transaction
Replication
Nosql
Raft
Rocksdb
Tidb