Redis – Server

  • Post author:
  • Post category:Redis
  • Post comments:0 Comments

Redis server commands are basically used to manage Redis server.

Example

Following example explains how we can get all statistics and information about the server

redis 127.0.0.1:6379> INFO  

# Server 
redis_version:2.8.13 
redis_git_sha1:00000000 
redis_git_dirty:0 
redis_build_id:c2238b38b1edb0e2 
redis_mode:standalone 
os:Linux 3.5.0-48-generic x86_64 
arch_bits:64 
multiplexing_api:epoll 
gcc_version:4.7.2 
process_id:3856 
run_id:0e61abd297771de3fe812a3c21027732ac9f41fe 
tcp_port:6379 
uptime_in_seconds:11554 
uptime_in_days:0 hz:10 
lru_clock:16651447 
config_file:  

# Clients 
connected_clients:1
client_longest_output_list:0 
client_biggest_input_buf:0 
blocked_clients:0  

# Memory 
used_memory:589016 
used_memory_human:575.21K 
used_memory_rss:2461696 
used_memory_peak:667312 
used_memory_peak_human:651.67K 
used_memory_lua:33792 
mem_fragmentation_ratio:4.18 
mem_allocator:jemalloc-3.6.0  

# Persistence 
loading:0 
rdb_changes_since_last_save:3 
rdb_bgsave_in_progress:0 
rdb_last_save_time:1409158561 
rdb_last_bgsave_status:ok 
rdb_last_bgsave_time_sec:0 
rdb_current_bgsave_time_sec:-1 
aof_enabled:0 
aof_rewrite_in_progress:0 
aof_rewrite_scheduled:0 
aof_last_rewrite_time_sec:-1 
aof_current_rewrite_time_sec:-1 
aof_last_bgrewrite_status:ok 
aof_last_write_status:ok  

# Stats 
total_connections_received:24 
total_commands_processed:294 
instantaneous_ops_per_sec:0 
rejected_connections:0 
sync_full:0 
sync_partial_ok:0 
sync_partial_err:0 
expired_keys:0 
evicted_keys:0 
keyspace_hits:41
keyspace_misses:82 
pubsub_channels:0 
pubsub_patterns:0 
latest_fork_usec:264  

# Replication 
role:master 
connected_slaves:0 
master_repl_offset:0 
repl_backlog_active:0 
repl_backlog_size:1048576 
repl_backlog_first_byte_offset:0 
repl_backlog_histlen:0  

# CPU 
used_cpu_sys:10.49 
used_cpu_user:4.96 
used_cpu_sys_children:0.00 
used_cpu_user_children:0.01  

# Keyspace 
db0:keys = 94,expires = 1,avg_ttl = 41638810 
db1:keys = 1,expires = 0,avg_ttl = 0 
db3:keys = 1,expires = 0,avg_ttl = 0 

Redis Server Commands

Following table lists some basic commands related to Redis server.

Sr.NoCommand & Description
1BGREWRITEAOFhttps://adglob.in/blog/redis-server-bgrewriteaof-command/
Asynchronously rewrites the append-only file
2BGSAVEhttps://adglob.in/blog/redis-server-bgsave-command/
Asynchronously saves the dataset to the disk
3CLIENT KILL https://adglob.in/blog/redis-server-client-kill-command/
Kills the connection of a client
4CLIENT LISThttps://adglob.in/blog/redis-server-client-list-command/
Gets the list of client connections to the server
5CLIENT GETNAMEhttps://adglob.in/blog/redis-server-client-getname-command/
Gets the name of the current connection
6CLIENT PAUSE https://adglob.in/blog/redis-server-client-pause-command/
Stops processing commands from the clients for a specified time
7CLIENT SETNAME https://adglob.in/blog/redis-server-client-setname-command/
Sets the current connection name
8CLUSTER SLOTShttps://adglob.in/blog/redis-server-cluster-slots-command/
Gets an array of Cluster slot to node mappings
9COMMANDhttps://adglob.in/blog/redis-server-command/
Gets an array of Redis command details
10COMMAND COUNThttps://adglob.in/blog/redis-server-command-count-command/
Gets total number of Redis commands
11COMMAND GETKEYSzhttps://adglob.in/blog/redis-server-command-getkeys-command/
Extracts the keys given a full Redis command
12BGSAVEhttps://adglob.in/blog/redis-server-bgsave-command-2/
Asynchronously saves the dataset to the disk
13COMMAND INFO https://adglob.in/blog/redis-server-command-info-command/
Gets an array of specific Redis command details
14CONFIG GET https://adglob.in/blog/redis-server-config-get-command/
Gets the value of a configuration parameter
15CONFIG REWRITEhttps://adglob.in/blog/redis-server-config-rewrite-command/
Rewrites the configuration file with the in-memory configuration
16CONFIG SEThttps://adglob.in/blog/redis-server-config-set-command/
Sets a configuration parameter to the given value
17CONFIG RESETSTAThttps://adglob.in/blog/redis-server-config-resetstat-command/
Resets the stats returned by INFO
18DBSIZEhttps://adglob.in/blog/redis-server-dbsize-command/
Returns the number of keys in the selected database
19DEBUG OBJECT keyhttps://adglob.in/blog/redis-server-debug-object-command/
Gets debugging information about a key
20DEBUG SEGFAULThttps://adglob.in/blog/redis-server-debug-segfault-command/
Makes the server crash
21FLUSHALLhttps://adglob.in/blog/redis-server-flushall-command/
Removes all the keys from all databases
22FLUSHDBhttps://adglob.in/blog/redis-server-flushdb-command/
Removes all the keys from the current database
23INFO https://adglob.in/blog/redis-server-info-command/
Gets information and statistics about the server
24LASTSAVEhttps://adglob.in/blog/redis-server-lastsave-command/
Gets the UNIX time stamp of the last successful save to the disk
25MONITORhttps://adglob.in/blog/redis-server-monitor-command/
Listens for all the requests received by the server in real time
26ROLEhttps://adglob.in/blog/redis-server-role-command/
Returns the role of the instance in the context of replication
27SAVEhttps://adglob.in/blog/redis-server-save-command/
Synchronously saves the dataset to the disk
28SHUTDOWNhttps://adglob.in/blog/redis-server-shutdown-command/
Synchronously saves the dataset to the disk and then shuts down the server
29SLAVEOF host porthttps://adglob.in/blog/redis-server-slaveof-command/
Makes the server a slave of another instance, or promotes it as a master
30SLOWLOG subcommand https://adglob.in/blog/redis-server-showlog-command/
Manages the Redis slow queries log
31SYNChttps://adglob.in/blog/redis-server-sync-command/
Command used for replication
32TIMEhttps://adglob.in/blog/redis-server-time-command/
Returns the current server time

Leave a Reply