RedisMod has been deprecated and is no longer supported. Please refer to the Getting Started Tutorial for how to use Redis.
This simple container image bundles together the latest stable releases of Redis and select Redis modules. This image is based on the official image of Redis from Docker. By default, the container starts with Redis' default configuration and all included modules loaded.
Features included in the container
- Search: a full-featured search engine
- Time Series: a timeseries database
- JSON: a native JSON data type
- Probabilistic data: native Bloom and Cuckoo Filter data types
Step 1. Install Docker
To use RedisMod on a local Mac, the first step is to install Docker for your operating system. Run the docker version command in a terminal window to make sure that docker is installed correctly.
It should display Docker Engine Server and Client version successfully.
Step 2. Running Redismod Docker container
docker run -d -p 6379:6379 redislabs/redismod
Step 3. Connect to Redis database
Step 4. Verify if all the Redis modules are getting loaded
127.0.0.1:6379> info modules
Step 5. Testing Redis Search
Let us test drive Redis Search as discussed below in detail.
Insert data into Redis Search
We are now ready to insert some data. This example uses movies data stored as Redis Hashes, so let’s insert a couple of movies:
HSET movies:11002 title "Star Wars: Episode V - The Empire Strikes Back" plot "Luke Skywalker begins Jedi training with Yoda." release_year 1980 genre "Action"
rating 8.7 votes 1127635
HSET movies:11003 title "The Godfather" plot "The aging patriarch of an organized crime dynasty transfers control of his empire to his son." release_year 1972
genre "Drama" rating 9.2 votes 1563839
Your Redis database now contains two Hashes. It is simple to retrieve information using the HMGET command, if you know the key of the movies (movies:11002):
HMGET movies:11002 title rating
Create an index in Redis Search
To be able to query the hashes on the field for title, say, or genre, you must first create an index. To create an index, you must define a schema to list the fields and their types that are indexed, and that you can use in your queries.
Use the FT.CREATE command to create an index, as shown here:
FT.CREATE idx:movies ON hash PREFIX 1 "movies:" SCHEMA title TEXT SORTABLE release_year NUMERIC SORTABLE rating NUMERIC SORTABLE genre TAG SORTABLE
Search the movies in the Redis Search index
You can now use the FT.SEARCH to search your database, for example, to search all movies sorted by release year:
FT.SEARCH idx:movies * SORTBY release_year ASC RETURN 2 title release_year
To test drive rest of Redis modules, please visit the links mentioned under "References" section.