Remote Dictionary Server, commonly known as REDIS is a free and open-source, in-memory data storage and caching system.
You will often hear developers referring to Redis as data structure server as it allows us to store, manipulate, and retrieve data structures from system memory.
Redis is designed to be a high-performance and low-latency data access system which makes it extremely suitable as a caching mechanism or environments where fast data retrieval is essential. An example would be real-time analytics, session management, queing systems, etc.
Before we proceed with this tutoria, ensure that you have Homebrew installed on your macOS system. You can verify by running the command:
If you have Homebrew installed, the command above should return the installed version as shown:
If the command above returns an error, you will need to install Homebrew before proceeding. You can check the tutorial below on how to set it up.
macOS Install Redis
Once you have Homebrew installed, open the terminal and run the command below to install Redis on your machine:
brew install redis
This will install Redis on your system.
Start and Stop the Redis sERVER
To test your Redis installation, you can run the
redis-server command to run the Redis server in the foreground.
To stop Redis, enter
Start and Stop Redis in the Background
To run Redis in the background, you can run the command:
brew services start redis
This will run the Redis serverin the background.
To view the information about the service, you can run the command as shown:
brew services info redis
redis (homebrew.mxcl.redis) Running: ✔ Loaded: ✔ User: csalem PID: 8723
To stop the Redis server, run the command:
brew services stop redis
You can connect to the Redis server with the command:
Once logged in, you can run the Redis commands.
In this tutorial, we quickly covered you can download and install the Redis server on macOS using the Homebrew package manager.