📜  Redis服务器

📅  最后修改于: 2020-12-02 01:21:20             🧑  作者: Mango

Redis服务器

Redis Server命令用于管理Redis Server。有不同的服务器命令可用于获取服务器信息,统计信息和服务器的其他特征。

让我们来看一个示例,以了解如何获取有关服务器的所有统计信息和信息。

redis 127.0.0.1:6379> ping
PONG
redis 127.0.0.1:6379> AUTH "password"
(error) ERR Client sent AUTH, but no password is set
redis 127.0.0.1:6379> PING
PONG
redis 127.0.0.1:6379> ECHO "Welcome to Javatpoint"
"Welcome to Javatpoint"
redis 127.0.0.1:6379> INFO
redis_version:2.4.6
redis_git_sha1:26cdd13a
redis_git_dirty:0
arch_bits:64
multiplexing_api:winsock2
gcc_version:4.6.1
process_id:6360
uptime_in_seconds:4442
uptime_in_days:0
lru_clock:1716856
used_cpu_sys:1.80
used_cpu_user:0.42
used_cpu_sys_children:0.00
used_cpu_user_children:0.00
connected_clients:1
connected_slaves:0
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0
used_memory:1188152
used_memory_human:1.13M
used_memory_rss:1188152
used_memory_peak:1188112
used_memory_peak_human:1.13M
mem_fragmentation_ratio:1.00
mem_allocator:libc
loading:0
aof_enabled:0
changes_since_last_save:0
bgsave_in_progress:0
last_save_time:1506142039
bgrewriteaof_in_progress:0
total_connections_received:1
total_commands_processed:4
expired_keys:0
evicted_keys:0
keyspace_hits:0
keyspace_misses:0
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:0
vm_enabled:0
role:master

Redis服务器命令

以下是Redis数据库中使用的一些服务器命令的列表:

Index Command Description
1 BGREWRITEAOF This command is used to asynchronously rewrite the append-only file.
2 BGSAVE This command is used to asynchronously save the dataset to the disk.
3 CLIENT KILL [ip:port] [ID client-id] This command is used to kill the connection of a client.
4 CLIENT LIST This command is used to get the list of client connections to the server.
5 CLIENT GETNAME This command is used to get the name of the current connection.
6 CLIENT PAUSE timeout This command is used to stop processing commands from the clients for a specified time.
7 CLIENT SETNAME connection-name This command is used to set the current connection name.
8 CLUSTER SLOTS This command is used to get an array of Cluster slot to node mappings.
9 COMMAND This command is used to get an array of Redis command details.
10 COMMAND COUNT This command is used to get total number of Redis commands.
11 COMMAND GETKEYS This command is used to extract the keys given a full Redis command.
12 BGSAVE This command is used to asynchronously save the dataset to the disk.
13 COMMAND INFO command-name [command-name …] This command is used to get an array of specific Redis command details.
14 CONFIG GET parameter This command is used to get the value of a configuration parameter.
15 CONFIG REWRITE This command is used to rewrite the configuration file with the in-memory configuration.
16 CONFIG SET parameter value This command is used to get a configuration parameter to the given value.
17 CONFIG RESETSTAT This command is used to reset the stats returned by INFO.
18 DBSIZE This command is used to return the number of keys in the selected database.
19 DEBUG OBJECT key This command is used to get debugging information about a key.
20 DEBUG SEGFAULT This command is used to make the server crash.
21 FLUSHALL This command is used to remove all the keys from all databases.
22 FLUSHDB This command is used to remove all the keys from the current database.
23 INFO [section] This command is used to get information and statistics about the server.
24 LASTSAVE This command is used to retrieve the UNIX time stamp of the last successful save to the disk.
25 MONITOR This command is used to listen for all the requests received by the server in real time.
26 ROLE This command is used to return the role of the instance in the context of replication.
27 SAVE This command is used to synchronously saves the dataset to the disk.
28 SHUTDOWN [NOSAVE] [SAVE] This command is used to synchronously saves the dataset to the disk and then shuts down the server .
29 SLAVEOF host port This command is used to make the server a slave of another instance, or promotes it as a master .
30 SLOWLOG subcommand [argument] This command is used to manage the Redis slow queries log.
31 SYNC This command is used for replication.
32 TIME This command is used to return the current server time.