Redis Tutorial (12): Summary of server Management commands

Source: Internet
Author: User
Tags redis tutorial

Reproduced in: http://www.itxuexiwang.com/a/shujukujishu/redis/2016/0216/140.html

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, you provide a set of server-management-related

, which contains the Config Set/get command associated with the parameter setting.

Ii. List of related commands:

Command prototypes Complexity of Time Command description return value
CONFIG GETparameter 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 Sets the save policy for the 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.
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] This command is primarily used to read commands that have a longer execution time. The evaluation of the execution time is only the execution time of the command itself, and does not include the network interaction time. The configuration parameters associated with the command are mainly two, the first being the threshold between executions (in microseconds), where the execution time exceeds the value of the command will be stored in the Slowlog queue for the command to read. The second is the length of the Slowlog queue, and if the command in the queue already equals this parameter before the current command is deposited, the oldest command in the queue needs to be moved out of the queue before the command enters. This ensures that the total amount of memory occupied by the queue remains at a relatively constant size. Because slowlog queues are not persisted to disk, Redis does not have a significant impact on performance when collecting commands. Usually we can set the parameter "Slowlog-log-slower-than" to 0 to collect the execution time of all the commands. The command also contains the following sub-commands:
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.
Finally, an explanation of the return information of the Slowlog get command is given.
Redis 127.0.0.1:6379> Slowlog Get 10
1) 1) (integer) 5 #唯一表示符, this value is guaranteed to be unique until the Redis restart.
2) (integer) 1330369320 #Unix the command execution time in the timestamp format.
3) (integer) #命令执行所用的微秒数.
4) 1) "Slowlog" #以字符串数组的格式输出收集到的命令及其参数.
2) "Reset"


#p # pagination Title #e#

Redis Tutorial (12): Summary of server Management commands

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.