Time series data is a series of data stored in the time order (Example: Stock performance over time). Industries today are collecting and analyzing time-based data more than ever before. Traditional databases that rely on relational or document data models are designed neither for storing and indexing data based on time, nor for running time-bucketed aggregation queries. Time-series databases fill this void by providing a data model that optimizes data indexing and querying by time.
RedisTimeSeries is a Redis module that allows Redis to be used as a fast in-memory time series database designed to collect, manage, and deliver time series data at scale. The RedisTimeSeries module shares the performance and simplicity aspects of Redis. Under the hood, it uses efficient data structures such as Radix tree to index data by timestamp, which makes it extremely fast and efficient to run time-aggregate queries.
Python Client for RedisTimeSeries
As of redis-py 4.0.0, the redistimeseries-py library is deprecated. It's features have been merged into redis-py. Please either install it from pypy or the repo.
Follow the steps below to get started with RedisTimeSeries with Python:
Step 1. Create a free Cloud account
Create your free Redis Enterprise Cloud account. Once you click on “Get Started”, you will receive an email with a link to activate your account and complete your signup process.
For a limited time, use TIGER200 to get $200 credits on Redis Enterprise Cloud and try all the advanced capabilities!
Step 2. Create Your database
Choose your preferred cloud vendor. Select the region and then click "Let's start free" to create your free database automatically.
If you want to create a custom database with your preferred name and type of redis, click "Create a custom database" option shown in the image.
Step 3. Verify the database details
You will be provided with Public endpoint URL and "Redis Stack" as the type of database with the list of modules that comes by default.
$ pip install redis
Step 5. Create a script file
r = redis.Redis(host='redis-18386.c110.qa.us-east-1-1.ec2.qa-cloud.redislabs.com', port=<add port>, password=<add password>)
Save the above file with a name "ts.py".
Step 6. Executing the python script
Step 7. Monitor the Redis database
1648389303.557366 [0 22.214.171.124:59768] "TS.CREATE" "2"
- Getting Started with RedisTimeSeries
- Learn more about RedisTimeSeries in the Quickstart tutorial.
- Build Your Financial Application on RedisTimeSeries
- How to Manage Real-Time IoT Sensor Data in Redis
- Introduction to RedisTimeSeries - Video