Redis Tutorial (12): Summary of server Management commands

Source: Internet
Author: User
Tags redis tutorial
First, overview:

Redis was defined at the beginning of the design as a long uninterrupted service process, so most of the system configuration parameters can be effective without restarting the process. Even switching the current persistence mode from AOF to RDB does not require a reboot.
In Redis, a set of commands related to server administration, including the Config Set/get command related to parameter settings, is provided.

Ii. List of related commands:

Command prototypes Complexity of Time Command description return value
Configgetparameter
It is primarily used to read the runtime parameters of the server, but not all configuration parameters can be read by the command. The parameters of the command accept Glob-style pattern matching rules, so if the parameters contain pattern metacharacters, then all matching parameters will be listed in Key/value mode. If the parameter is *, then all parameters supported by the command will be listed. The last point to note is that, unlike redis.conf, you cannot use the quantity abbreviation format in a command, such as GB, KB, or only integer values that represent the number of bytes.
CONFIG Setparameter Value
This command is used to reconfigure the run-time parameters of the Redis server and can take effect without restarting after the setting is successful. However, not all parameters can be dynamically set by this command, and if you need to know what parameters the command supports, you can view the execution results of the config GET * command. If you want to set multiple parameters of the same type in a command, such as the save parameter in the redis.conf configuration file: Save 1/save 300 10. In this command we can enclose multiple key/value in double quotation marks, separated by whitespace, such as Config set save "900 1 300 10". OK indicates the setting is successful, otherwise the related error message is returned.
CONFIG Resetstat O (1) The Reset Info command gives the statistics. Always return OK.
Dbsize
Returns the number of keys in the currently open database. The number of keys.
Flushall
Clears all keys in the current server-managed database, not just the currently open database.
Flushdb
Clears all keys in the current database
INFO
Gets the number of column statistics related to the health of the server.
SAVE
Set save policy for RDB persistence mode
SHUTDOWN
Stops all clients while persisting memory data in a blocking manner. If the AOF mode is enabled, the data in the cache is flush to the aof file. Exit the server. Set save policy for RDB persistence mode
Slaveofhost Port
This command modifies the replication settings for the slave server. If a Redis server is already in the slave state, the slaveof NO one command shuts down the replicated state of the current server while switching the server to the master state. The parameters of this command specify the listening IP and port of the master server. In another case, the current server is already a slave of another master, after executing the command, the current server will terminate the replication relationship with the previous master, and will become the new master slave, before the data in master will be emptied, Change to the data in the new master. However, if the slaveof NO one command is executed on the current slave server, the server simply interrupts the replication relationship with the current master and upgrades to the standalone master, where the data is not emptied.
slowlogsubcommand [argument]
1). Slowlog GET N: Reads the command information from the Slowlog queue and N represents the information for the most recent n command.
2). Slowlog LEN: Gets the length of the Slowlog queue.
3). Slowlog RESET: Empties the contents of the Slowlog. The
finally gives an explanation of the return information of the Slowlog get command.
Redis 127.0.0.1:6379> Slowlog get
1) 1) (integer) 5 #唯一表示符, this value is guaranteed to be unique until Redis restarts.
2) (integer) 1330369320 the command execution time #Unix the timestamp format.
3) (integer) #命令执行所用的微秒数.
4) 1) "Slowlog" #以字符串数组的格式输出收集到的命令及其参数.
2) "Reset"

The above is the Redis tutorial (12): Server Management Command Summary of the content, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.