5.0 redis-cli cluster management test

Source: Internet
Author: User
Cluster Management Tool redis-trib.rb has been abandoned, so do not need to install Ruby what, at that time the redis-trib.rb function, now has been integrated into redis-CLI, can pass. /redis-cli -- cluster help to view the usage.

Environment

# Creating a cluster #

./Redis-cli -- cluster create 192.168.1.172: 6379 192.168.1.172: 6380 192.168.1.172: 6381

Check that all slots have been evenly allocated.

# Check the cluster #

./Redis-cli -- cluster check 192.168.1.172: 6379

View all cluster operations

# View Cluster key, slot, and slave distribution information #

./Redis-cli -- cluster info 192.168.1.172: 6379

# Online migration slot #

./Redis-cli -- cluster reshard 192.168.1.172: 6379
Select the ID of a target node
Select All for The Source

# Balancing the number of slots on each node #

./Redis-cli -- cluster rebalance -- cluster-threshold 1 192.168.1.172: 6379

Balanced

# Deleting a cluster node #

./Redis-cli -- cluster del-node 192.168.1.172: 6379 b97cde23f3c1a1b13e42728562180355b985831a
It must be a node without a slot, so you must remove the slot first. Otherwise, the following error is reported:

The node is deleted successfully and disabled after the slot is migrated through reshard.


After the deleted node is restarted, you still remember the other nodes in the cluster. You need to execute cluster forget nodeid to forget other nodes.

# Add a cluster node #

./Redis-cli -- cluster add-node 192.168.1.172: 6379 192.168.1.172: 6380

Rebalance the number of slots on each node

# Import data from external redis instances of the cluster to the cluster #

./Redis-cli -- cluster import 192.168.1.172: 6379 -- cluster-from 192.168.1.172: 6382 -- cluster-copy

Cluster-from is followed by the external redis IP address and port
If you only use cluster-copy, the key in the cluster to be imported cannot be in; otherwise, the following is returned:

If the same key already exists in the cluster, you can use cluster-copy and cluster-replace to replace the key in the cluster.

5.0 redis-cli cluster management test

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.