Redis Cluster (2) Related command reference and slow query

Source: Internet
Author: User
Tags failover redis cluster redis server

Instance shutdown command

REDID-CLI shutdown Description: Forced bgsave on close so it takes some time note: At start, you need to load the data into memory before Redis listen the port after the data is loaded

Cluster-related commands

1. CLUSTER Info Print cluster Information 2, CLUSTER NODES lists all nodes that are currently known to the cluster (node), and information about those nodes. 3, CLUSTER FAILOVER manual failover, need to be performed on the slave node of the transferred master node

node -related commands

1, CLUSTER MEET <ip> <port> Add the node specified by IP and port to the cluster, making it a part of the cluster.  2. CLUSTER Forget <node_id> remove node_id specified node from the cluster.  3. CLUSTER REPLICATE <node_id> Sets the current node to node_id node from the specified node. 4. CLUSTER Saveconfig Save the configuration file of the node to the hard disk.

Slots (slot) Related commands

1. CLUSTER addslots <slot> [slots ...] assigns one or more slots (slots) (assign) to the current node.  2. CLUSTER delslots <slot> [slots ...] removes the assignment of one or more slots to the current node.  3. CLUSTER Flushslots removes all slots assigned to the current node, making the current node a node without any slots assigned.   4. CLUSTER setslot <slot> node <node_id> assigns the slot slot to the node specified by node_id, and if the slot is already assigned to another node, let the other node delete the slot before assigning it.   1), CLUSTER setslot <slot> migrating <node_id> Migrate the slot slots of this node to the nodes specified in the node_id.   2), CLUSTER setslot <slot> importing <node_id> import slot slots from node_id specified node to this node. 3), CLUSTER setslot <slot> STABLE Cancel the Import or migration (migrate) of the slot slots.

key Related commands

1, CLUSTER keyslot <key> calculate key should be placed on which slot.  2. CLUSTER Countkeysinslot <slot> Returns the number of key-value pairs currently contained in the slot slot. 3, CLUSTER Getkeysinslot <slot> <count> returns the key in count slots.

Unsupported commands:

1, does not support the Select command, the cluster uses only the database 0 2, does not support multiple key operations such as MSET, Suion, sinter and other commands (because keys cannot be hashed into the same slot)

REDIS-TRIB.RB Related Commands

1, redis-trib.rb Create [--replicas N] host:ip [Host:ip ...] Create cluster 2, REDIS-TRIB.RB add-node host:ip host:ip Add the preceding Host:ip to the cluster 3, redis-trib.rb check host:ip checking the status of the cluster 4, REDIS-TRIB.RB Reshard host:ip OR redis-trib.rb reshard--from host:port--to host:port--slots--yes cluster re-shard 5, REDIS-TRIB.RB Del-node host : IP ' node ID ' removes the node from the cluster

Redis Slow Query

The slow query log feature of Redis is used to record the execution time over a timed command request, which allows the user to monitor and optimize the query speed through the log generated by this feature.

The server configuration has two and slow query log related options:

The Slowlog-log-slower-than option specifies that command requests that have an execution time of more than microseconds (1 seconds equals 1,000,000 microseconds) are recorded on the log.
For example, if the value of this option is 100, then the command that executes longer than 100 microseconds is logged to the slow query log, and if the value of this option is 500, then the command that takes more than 500 microseconds is logged to the slow query log;

The Slowlog-max-len option specifies the maximum number of slow query logs that the server saves.
Servers use FIFO to save multiple slow query logs: When the number of slow query logs stored by the server equals the value of the Slowlog-max-len option, the server will first delete the oldest slow query log before adding a new slow query log.
For example, if the server slowlog-max-len a value of 100, and assuming that the server has stored 100 slow query logs, then if the server intends to add a new log, it must first delete the oldest saved log, and then add a new log.

Example: First use the Config_set command to set the value of the Slowlog-log-slower-than option to 0 microseconds so that any commands executed by the Redis server are logged to the slow query log, and then the value of the Slowlog-max-len option is set to 5, let the server save up to 5, and finally use the slowlog GET command to view the slow query log saved by the server


This article is from the "Worknote" blog, make sure to keep this source http://caiyuanji.blog.51cto.com/11462293/1892894

Redis Cluster (2) Related command reference and slow query

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.