RedisTimeSeries is a Redis Module adding a Time Series data structure to Redis.
Read more about the v1.0 GA features here.
- High volume inserts, low latency reads
- Query by start time and end-time
- Aggregated queries (Min, Max, Avg, Sum, Range, Count, First, Last) for any time bucket
- Configurable maximum retention period
- Downsampling/Compaction - automatically updated aggregated timeseries
- Secondary index - each time series has labels (field value pairs) which will allows to query by labels
In the RedisTimeSeries organization you can find projects that help you integrate RedisTimeSeries with other tools, including:
- Prometheus - read/write adapter to use RedisTimeSeries as backend db.
- Grafana - using a SimpleJson datasource.
- Telegraph
- StatsD, Graphite exports using graphite protocol.
A time series is a linked list of memory chunks. Each chunk has a predefined size of samples. Each sample is a tuple of the time and the value of 128 bits, 64 bits for the timestamp and 64 bits for the value.
You can either get RedisTimeSeries setup in a Docker container or on your own machine.
To quickly try out RedisTimeSeries, launch an instance using docker:
docker run -p 6379:6379 -it --rm redislabs/redistimeseries
You can also build and run RedisTimeSeries on your own machine.
- build-essential
- The RedisTimeSeries repository:
git clone https://github.com/RedisTimeSeries/RedisTimeSeries.git
cd RedisTimeSeries
git submodule init
git submodule update
cd src
make all
In your redis-server run: loadmodule redistimeseries.so
For more information about modules, go to the redis official documentation.
After you setup RedisTimeSeries, you can interact with it using redis-cli.
Here we'll create a time series representing sensor temperature measurements. After you create the time series, you can send temperature measurements. Then you can query the data for a time range on some aggregation rule.
$ redis-cli
127.0.0.1:6379> TS.CREATE temperature RETENTION 60 LABELS sensor_id 2 area_id 32
OK
127.0.0.1:6379> TS.ADD temperature:3:11 1548149181 30
OK
127.0.0.1:6379> TS.ADD temperature:3:11 1548149191 42
OK
127.0.0.1:6379> TS.RANGE temperature:3:11 1548149180 1548149210 AGGREGATION avg 5
1) 1) (integer) 1548149180
2) "30"
2) 1) (integer) 1548149190
2) "42"
Some languages have client libraries that provide support for RedisTimeSeries commands:
Project | Language | License | Author | URL |
---|---|---|---|---|
JRedisTimeSeries | Java | BSD-3 | RedisLabs | Github |
redistimeseries-go | Go | Apache-2 | RedisLabs | Github |
redistimeseries-py | Python | BSD-3 | RedisLabs | Github |
Tests are written in python using the rmtest library.
$ cd src
$ pip install -r tests/requirements.txt # optional, use virtualenv
$ make tests
Read the docs at http://redistimeseries.io
Got questions? Feel free to ask at the RedisTimeSeries mailing list.
Redis Source Available License Agreement, see LICENSE