未加星标

SummitDB In-Memory NoSQL DB, ACID, Raft, Redis API, Geospatial

字体大小 | |
[数据库(综合) 所属分类 数据库(综合) | 发布者 店小二04 | 时间 2016 | 作者 红领巾 ] 0人收藏点击收藏

SummitDB   In-Memory NoSQL DB, ACID, Raft, Redis API, Geospatial

SummitDB is a NoSQL database built on a transactional and strongly-consistent key-value store. It using the Raft consensus algorithm, supports ACID transactions, aRedis-style API, custom indexes , JSON documents , geospatial data , user-defined scripting using javascript, and more.

Under the hood it utilizesFinn, Redcon , BuntDB ,GJSON, andOtto.

Features

The goal was to create a fast data store that provides:

In-memory NoSQL solution Simplified Redis-style APIs Strong-consistency and durability Ordered key space Indexing on values JSON documents Spatial indexing Getting started Building SummitDB

SummitDB can be compiled and used on linux, OSX, windows, FreeBSD, and probably others since the codebase is 100% Go. We support both 32 bit and 64 bit systems. Go must be installed on the build machine.

To build simply:

$ make

It's a good idea to install the redis-cli .

$ make redis-cli

To run tests:

$ make test Running

First start a single-member cluster:

$ ./summitdb-server

This will start the server listening on port 7481 for client and server-to-server communication.

Next, let's set a single key, and then retrieve it:

$ ./redis-cli -p 7481 SET mykey "my value" OK $ ./redis-cli -p 7481 GET mykey "my value"

Adding members:

$ ./summitdb-server -p 7482 -dir data2 -join :7481 $ ./summitdb-server -p 7483 -dir data3 -join :7481

That's it. Now if node1 goes down, node2 and node3 will continue to operate.

Difference between SummitDB and Redis

It may be worth noting that SummitDB is not a Redis clone. Redis has a lot of commands and data types that not available in SummitDB, such Sets, Hashes, Sorted Sets, and PubSub.

Ordered key space - SummitDB provides one key space that is a large B-tree. An ordered key space allows for stable paging through keys using theKEYS command. Redis uses an unordered dictionary structure and provides a specialized SCAN command for iterating through keys. Everything a string - SummitDB stores only strings which are exact binary representations of what the user stores. Redis has many internal data types , such as strings, hashes, floats, sets, etc. Raft clusters - SummitDB uses the Raft consensus algorithm to provide high-availablity. Redis provides Master/Slave replication . Javascript - SummitDB uses Javascript for user-defined scripts. Redis uses Lua. Indexes - SummitDB provides an API for indexing the key space. Indexes allow for quickly querying and iterating on values. Redis has specialized data types like Sorted Sets and Hashes which can provide secondary indexing . Spatial indexes - SummitDB provides the ability to create spatial indexes. A spatial index uses an R-tree under the hood, and each index can be up to 20 dimensions. This is useful for geospatial, statistical, time, and range data. Redis has the GEO API which allows for using storing and querying geospatial data using the Geohashes . JSON documents - SummitDB allows for storing JSON documents and indexing fields directly. Redis has Hashes and a JSON parser via Lua. JSON Indexes

Indexes can be created on individual fields inside JSON documents.

For example, let's say you have the following documents:

{"name":{"first":"Tom","last":"Johnson"},"age":38} {"name":{"first":"Janet","last":"Prichard"},"age":47} {"name":{"first":"Carol","last":"Anderson"},"age":52} {"name":{"first":"Alan","last":"Cooper"},"age":28}

Create an index:

> SETINDEX last_name user:* JSON name.last

Then add some JSON:

> SET user:1 '{"name":{"first":"Tom","last":"Johnson"},"age":38}' > SET user:2 '{"name":{"first":"Janet","last":"Prichard"},"age":47}' > SET user:3 '{"name":{"first":"Carol","last":"Anderson"},"age":52}' > SET user:4 '{"name":{"first":"Alan","last":"Cooper"},"age":28}'

Query with the ITER command:

> ITER last_name 1) "user:3" 2) "{\"name\":{\"first\":\"Carol\",\"last\":\"Anderson\"},\"age\":52}" 3) "user:4" 4) "{\"name\":{\"first\":\"Alan\",\"last\":\"Cooper\"},\"age\":28}" 5) "user:1" 6) "{\"name\":{\"first\":\"Tom\",\"last\":\"Johnson\"},\"age\":38}" 7) "user:2" 8) "{\"name\":{\"first\":\"Janet\",\"last\":\"Prichard\"},\"age\":47}"

Or perhaps you want to index on age:

> SETINDEX age user:* JSON age > ITER age 1) "user:4" 2) "{\"name\":{\"first\":\"Alan\",\"last\":\"Cooper\"},\"age\":28}" 3) "user:1" 4) "{\"name\":{\"first\":\"Tom\",\"last\":\"Johnson\"},\"age\":38}" 5) "user:2" 6) "{\"name\":{\"first\":\"Janet\",\"last\":\"Prichard\"},\"age\":47}" 7) "user:3" 8) "{\"name\":{\"first\":\"Carol\",\"last\":\"Anderson\"},\"age\":52}"

It's also possible to multi-index on two fields:

> SETINDEX last_name_age user:* JSON name.last JSON age

For full JSON indexing syntax check out theSETINDEX andITER commands.

Commands

Below is the complete list of commands and documentation for each.

Keys and values

APPEND , BITCOUNT , BITOP , BITPOS , DBSIZE , DECR , DECRBY , DEL , EXISTS , EXPIRE , EXPIREAT , FLUSHDB , GET , GETBIT , GETRANGE , GETSET , INCR , INCRBY , INCRBYFLOAT , KEYS , MGET , MSET , MSETNX , PDEL , PERSIST , PEXPIRE , PEXPIREAT , PTTL , RENAME , RENAMENX , SET , SETBIT , SETRANGE , STRLEN , TTL

Indexes and iteration

DELINDEX , INDEXES , ITER , RECT , SETINDEX

Transactions

MULTI , EXEC , DISCARD

Scripts

EVAL , EVALRO , EVALSHA , EVALSHARO , SCRIPT LOAD , SCRIPT FLUSH

Raft management

RAFTADDPEER , RAFTREMOVEPEER , RAFTLEADER , RAFTSNAPSHOT , RAFTSTATE , RAFTSTATS

Contact

Josh Baker @tidwall

License

SummitDB source code is available under the MITLicense.

本文数据库(综合)相关术语:系统安全软件

主题: RedisSQLJavaLuaLinuxWindowsTIPTTDDP
分页:12
转载请注明
本文标题:SummitDB In-Memory NoSQL DB, ACID, Raft, Redis API, Geospatial
本站链接:http://www.codesec.net/view/482145.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 数据库(综合) | 评论(0) | 阅读(53)