To start a Redis server, you can use the “redis-server” command in the command line. This command starts the Redis server and listens for connections on the default port (6379).
You can run the command in the command line by typing:
$ redis-server
You can also specify a configuration file using the redis-server
command, the path of the configuration file must be provided after the command:
$ redis-server /path/to/redis.conf
To stop a Redis server, you can use the “redis-cli” command with the “shutdown” command. This command stops the Redis server and terminates all connections.
You can run the command in the command line by typing:
$ redis-cli shutdown
Note: Depending on your Redis installation, you may need to use “sudo” in front of the command to run as an administrator.
Also if you started the Redis server as a background process, you could use the pkill
command or kill
command to stop it, for example:
$ pkill redis-server
$ kill -9 <redis-server-pid>