Redis is an in-memory database that persists on disk. The data model is key-value, but many different kinds of values are supported: Strings, Lists, Sets, Sorted Sets, Hashes, HyperLogLogs, Bitmaps.

 

Start redis with the related configuration file from SSH

redis-server /path/redis.conf

 

Open a redis prompt from SSH

redis-cli

 

Note:

Redis Log Location  –/var/log/

Redis Log File – redis.log or redis_portnumber.log

 

Check configuration loaded on redis-server

cat /var/log/redis_6379.log | grep Configuration

 

If you  you can check timings when you stared redis-server and see if logs have the “Configuration Loaded”. If configuration loaded

You can use nano to manually view full log.

nano /var/log/redis_6379.log

 

Below Commands Should be run inside redis-cli

 

1. Check Redis Server status

PING

 

The output should be ‘PONG’ if server status is active

 

2. Set value in the key

SET key value

 

3. Get value in the key

GET key

 

4. Get the length of the value stored in a key

STRLEN key

 

5. Increment value in the key

INCR key

 

6. Increment the integer value of a key by the given amount

INCRBY key increment

 

7. Decrement the integer value of the key by one

DECR key

 

8. Decrement the integer value of a key by the given number

DECRBY key decrement

 

9. Delete key

DEL key

 

10. List of all active configuration variables you can change

CONFIG GET *

 

11. Get the value of maxmemory configuration for Redis

CONFIG GET maxmemory

 

12. Get the value of dbfilename

CONFIG GET dbfilename

 

13. Change key by issuing a “CONFIG SET” command like

CONFIG SET timeout 500

500 is new value

 

14. Change the key value for maxmemory

CONFIG SET maxmemory 4157683648

4157683648 is new value

 

15. Check the number of keys in the database.

DBSIZE

 

16. Check if a key exists

EXISTS key

Output will be in 0 or 1

Here, 0 and: 1 mean false and true, respectively.

 

17. Purge all of the keys from the database

FLUSH DB

 

18. Close both Redis and our telnet session

SHUTDOWN

 

這篇文章有幫助嗎? 0 Users Found This Useful (0 Votes)