Redis Cli Tool

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/redis-cli-tool/
PINTEREST
PINTEREST
INSTAGRAM

Redis have two main usage types. One is using API provided by redis these API’s can be used by different programming languages like Python, Php C#, Java etc. Other way to interact with redis is using cli tool named redis cli. Redis cli provides simple command line interface to test, use, troubleshot redis service.

Specify IP Address

redis-cli will connect localhost or 127.0.0.1 IP address by default. We can also specify the IP address we want to connect explicitly with -h option. In this example we will connect IP address 192.168.122.11

Specify Port

redis-cli will connect TCP port 6379 by default. If the redis server is listening different than 6379 we can specify the port number explicitly with -p option. In this example we will connect to port number 7000 .

Specify Password

Redis server have some security measures to protect against attackers. Password is one of them . If we set a password for the redis we should provide it with -a option while connecting. In this example we will use sosecret as password.

Check with PING

redis-cli provides a health check functionality named PING . We can use PING like below. It will simply return PONG if everything is OK.

Check with PING

Check with PING

Interactive Mode

redis-cli provides interactive mode where we get a redis shell after connected to the redis server. This shell provides all commands batch mode have. We can write redis commands and get information with interactive mode in real time. In order to start interactive shell mode we will simply connect to the redis server and do not provide any command. But if needed we should provides options like host, port or password information.

LEARN MORE  Redis Tutorial

Interactive Mode

Interactive Mode

Batch Mode

Batch mode is alternative to the interactive mode. In batch mode we will provide the commands we want to run to the redis-cli directly. This commands output will be printed to the current operating system shell like bash, ms dos etc. We should provide the command we want to run after options. In this example we will list redis help in batch mode. We should also provide the hostname, port and password options if needed.

Batch Mode

Batch Mode

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/redis-cli-tool/
PINTEREST
PINTEREST
INSTAGRAM

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)