Installing Redis on MacOs with or without using Homebrew
Homebrew is a package management system which saves time from searching version and configuration of latest software packages. If you have not install the homebrew run the command from the homebrew website.
Now to install redis using brew
> brew install redis
To start the redis
Redis run in same way as we run mysql
> brew services start redis
Redis by default will start at 6379 port. You can check if its running or not by running command redis-cli. If it is connected you can run further redis command else it will show not connected.
Configure the redis
You can configure the redis by making changes in configuration which can be found at
/usr/local/etc/redis.conf
To stop the Redis server
> brew stop services redis
Install using Redis binary
We can install redis directly by downloading from redis website.
We can also run following command
> wget https://download.redis.io/releases/redis-6.2.3.tar.gz
> tar xzf redis-6.2.3.tar.gz
Building the server
To make we can run make command with different option to keep it simple just run
> make
Installing globally
To install globally run the command
> make install
It will install the redis-server, redis-benchmark and redis-cli command globally. You can run these commands from anywhere. If you want to access the redis command line only from the downloaded folder skip this command.
Running the redis server
> src/redis-server
// or (if installed globally)
> redis-server
Running the redis command line
Open new terminal and run
> src/redis-cli
// or (if installed globally)
> redis-cli
Unistall
If installed using brew run command
> brew uninstall redis
If installed by downloading remove the downloaded folder, and if installed globally run command:
> rm -r /usr/local/bin/redis*
You are good to start with learning Redis now.