Redis Tutorial (12): Summary of server management commands _redis

Source: Internet
Author: User
Tags redis redis server redis tutorial

First, overview:

Redis is defined at the beginning of the design as a long-running service process, so most system configuration parameters can take effect immediately without restarting the process. Even switching the current persistence mode from AOF to RDB does not require a reboot.
In Redis, a set of server-management-related commands is provided, including the Config Set/get command that contains and parameter settings.

Ii. List of related commands:

Command prototypes Complexity of Time Command description return value
CONFIG Get parameter Used primarily for reading server run-time parameters, but not all configuration parameters can be read by this command. The parameters of the command accept the Glob style pattern matching rule, so if the parameter contains a pattern metacharacters, then all matching parameters will be listed in Key/value mode. If the parameter is *, all parameters supported by the command will be listed. Finally, it should be noted that unlike redis.conf, the number abbreviation format cannot be used in a command, such as GB, KB, and so on, and only integer values representing the number of bytes are used.
CONFIG SETparameter value This command is used to reconfigure the run-time parameters of the Redis server and can take effect without rebooting after the setting is successful. However, not all parameters can be dynamically set through this command, and you can view the results of the config get * command if you need to know what parameters the command supports. If you want to set multiple parameters of the same type in one command, such as the save parameter in the redis.conf configuration file:save 900 1/save. In this command we can enclose multiple key/value in double quotes and separate them with spaces, such asconfig set save "900 1". OK indicates that the setting is successful, otherwise the associated error message is returned.
CONFIG Resetstat O (1) The statistics given by the Reset Info command. Always return OK.
Dbsize Returns the number of keys in the currently open database. The number of key.
Flushall Empties all keys in the database managed by the current server, not only to the currently open database.
Flushdb Clears all keys in the current database.
INFO Gets some of the column statistics associated with the server health.
SAVE Sets the save policy for the RDB persistence mode.
SHUTDOWN Stops all clients while executing memory data persistence in a blocking manner. If the AOF mode is enabled, the data in the cache is flush to the aof file. Quit the server.
slaveofHost Port This command modifies the replication settings for the slave server. If a Redis server is already in the slave state, theslaveof NO One command closes the replicated state of the current server, while the server is switched to 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 the slave of another master, and after the command is executed, the current server terminates the replication relationship with the previous master, and becomes the slave of the new master, and the data from 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 used primarily to read commands that have a longer execution time. The execution time is judged only by the execution time of the command itself, excluding network interaction time. There are two main configuration parameters associated with the command, the first is the threshold (in microseconds) between executions, in which the commands that exceed the execution time are stored in the Slowlog queue for the command to read. The second is the length of the Slowlog queue, and if the current command is already equal to the parameter in the queue before it 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 consumed by the queue remains at a relatively constant size. Because the Slowlog queue is not persisted to disk, Redis does not have a significant performance impact when it collects commands. Usually we can take the parameter "Slowlog-log-slower-than"Set to 0 to collect the execution time for all commands. The command also contains the following child commands:
1).Slowlog Get N: reads the command information from the Slowlog queue, N represents the most recent n command information.
2).Slowlog LEN: Gets the length of the Slowlog queue.
3).Slowlog RESET: Empty the contents of the Slowlog.
Finally, the 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 Redis is restarted.
2) (integer) 1330369320#Unix The command execution time represented in the timestamp format.
3) (integer) 13#命令执行所用的微秒数.
4) 1) "Slowlog"#以字符串数组的格式输出收集到的命令及其参数.
2) "Reset"

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.