In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
In the previous article, we introduced the deployment practice of Redis Cluster, "Redis Cluster Cluster deployment practice".
If the service cannot support the existing access or expand the capacity in the future, how to expand the capacity? The script for rapid capacity expansion can be made in advance, and the capacity can be expanded with one click or manually.
This is a manual expansion.
Background:
Suppose that due to the needs of rapid business growth, the above Redis cluster can no longer meet the supporting business system, and first need to rapidly expand the Redis cluster. Here, it is assumed that only one Redis (two instances) will be expanded.
Expansion list:
Hostnam
IP address
Redis port partition
Remarks
Node174
172.20.20.174
16001,16002
Note: the hosts of each host here is not configured. If the DNS is self-built, internal resolution needs to be configured.
Redis deployment strategy
See the link above. In addition, you can mirror it and change the IP address.
/ opt/redis/bin/redis-server / opt/redis/conf/redis-16001.conf
/ opt/redis/bin/redis-server / opt/redis/conf/redis-16002.conf
. / bin/redis-cli-- cluster add-node 172.20.20.174Frey 16001 172.20.20.171Rose 16001
Warning: Using a password with'- a'or'- u 'option on the command line interface may not be safe.
> Adding node 172.20.20.174 Adding node 16001 to cluster 172.20.20.171
> Performing Cluster Check (using node 172.20.20.171purl 16001)
S: a9ab7a12884d505efcf066fcc3aae74c2b3f101d 172.20.20.171:16001
Slots: (0 slots) slave
Replicates 6dec89e63a48a9a9f393011a698a0bda21b70f1e
M: 6dec89e63a48a9a9f393011a698a0bda21b70f1e 172.20.20.172:16002
Slots: [0-5460] (5461 slots) master
1 additional replica (s)
M: 04d9c29ef2569b1fc8abd9594d64fca33e4ad4f2 172.20.20.173:16001
Slots: [10923-16383] (5461 slots) master
1 additional replica (s)
M: 761348a0107f5b009cabc22c214e39578d0aa707 172.20.20.172:16001
Slots: [5461-10922] (5462 slots) master
1 additional replica (s)
S: 81d1b25ae1ea85421bd4abb2be094c258026c505 172.20.20.171:16002
Slots: (0 slots) slave
Replicates 04d9c29ef2569b1fc8abd9594d64fca33e4ad4f2
S: 14e79155f78065e4518e00cd5bd057336b17e3a7 172.20.20.173:16002
Slots: (0 slots) slave
Replicates 761348a0107f5b009cabc22c214e39578d0aa707
[OK] All nodes agree about slots configuration.
> Check for open slots...
> Check slots coverage...
[OK] All 16384 slots covered.
>
[OK] New node added correctly.
Log in to any one of 171Meltel 173 to view.
[root@node172 redis] #. / bin/redis-cli-h 172.20.20.172-p 16002
172.20.20.172purl 16002 > auth zjkj
OK
172.20.20.172purl 16002 > cluster nodes
761348a0107f5b009cabc22c214e39578d0aa707 172.20.20.172 connected 16001mm 26001 master-01564038119398 3 connected 5461-10922
Ea77d7d10c27a1d99de00f4f81034d2d82a3c765 172.20.20.174 connected 16001mm 26001 master-0 1564038119000 0
6dec89e63a48a9a9f393011a698a0bda21b70f1e 172.20.20.172 connected 1600214002 myself,master-01564038120000 7 connected 0-5460
A9ab7a12884d505efcf066fcc3aae74c2b3f101d 172.20.20.171 connected 16001mm 26001 slave 6dec89e63a48a9a9f393011a698a0bda21b70f1e 0 1564038121413 7
04d9c29ef2569b1fc8abd9594d64fca33e4ad4f2 172.20.20.173 connected 16001mm 26001 master-0 1564038118396 5 connected 10923-16383
81d1b25ae1ea85421bd4abb2be094c258026c505 172.20.20.171 connected 16002mm 26002 slave 04d9c29ef2569b1fc8abd9594d64fca33e4ad4f2 0 1564038118000
14e79155f78065e4518e00cd5bd057336b17e3a7 172.20.20.173 connected 16002mm 26002 slave 761348a0107f5b009cabc22c214e39578d0aa707 0 1564038120405 6
It is found that 172.20.20.174 is not assigned slot, so how to assign slot to 174hosts?
On the machine marked red with the word Master, log in to any master and assign slot to 174s
[root@node174 redis] #. / bin/redis-cli-- cluster reshard 172.20.20.171pur16001-a zjkj
Warning: Using a password with'- a'or'- u 'option on the command line interface may not be safe.
> Performing Cluster Check (using node 172.20.20.172)
M: 6dec89e63a48a9a9f393011a698a0bda21b70f1e 172.20.20.172:16002
Slots: [0-5460] (5461 slots) master
1 additional replica (s)
M: 761348a0107f5b009cabc22c214e39578d0aa707 172.20.20.172:16001
Slots: [5461-10922] (5462 slots) master
1 additional replica (s)
M: ea77d7d10c27a1d99de00f4f81034d2d82a3c765 172.20.20.174:16001
Slots: (0 slots) master
S: a9ab7a12884d505efcf066fcc3aae74c2b3f101d 172.20.20.171:16001
Slots: (0 slots) slave
Replicates 6dec89e63a48a9a9f393011a698a0bda21b70f1e
M: 04d9c29ef2569b1fc8abd9594d64fca33e4ad4f2 172.20.20.173:16001
Slots: [10923-16383] (5461 slots) master
1 additional replica (s)
S: 81d1b25ae1ea85421bd4abb2be094c258026c505 172.20.20.171:16002
Slots: (0 slots) slave
Replicates 04d9c29ef2569b1fc8abd9594d64fca33e4ad4f2
S: 14e79155f78065e4518e00cd5bd057336b17e3a7 172.20.20.173:16002
Slots: (0 slots) slave
Replicates 761348a0107f5b009cabc22c214e39578d0aa707
[OK] All nodes agree about slots configuration.
> Check for open slots...
> Check slots coverage...
[OK] All 16384 slots covered.
How many slots do you want to move (from 1 to 16384)?
How many slots do you want to move (from 1 to 16384)? 4096
What is the receiving node ID? Ea77d7d10c27a1d99de00f4f81034d2d82a3c765 # newly added main library Id
Please enter all the source node IDs.
Type 'all' to use all the nodes as source nodes for the hash slots.
Type 'done' once you entered all the source nodes IDs.
Source node # 1: all
Shell >. / bin/redis-cli-h 172.20.20.174-p 16002-a zjkj
172.20.20.174ID 16002 > cluster replicate ea77d7d10c27a1d99de00f4f81034d2d82a3c765 # the Id here is # new library ID
172.20.20.174purl 16002 > cluster nodes
761348a0107f5b009cabc22c214e39578d0aa707 172.20.20.172 connected 16001mm 26001 master-01564039099770 3
A9ab7a12884d505efcf066fcc3aae74c2b3f101d 172.20.20.171 connected 16001mm 26001 slave 6dec89e63a48a9a9f393011a698a0bda21b70f1e 0 1564039096756 7
14e79155f78065e4518e00cd5bd057336b17e3a7 172.20.20.173 connected 16002mm 26002 slave 761348a0107f5b009cabc22c214e39578d0aa707 0 1564039097762 3
6dec89e63a48a9a9f393011a698a0bda21b70f1e 172.20.20.172 connected 16002mm 26002 master-0 1564039098764 7
04d9c29ef2569b1fc8abd9594d64fca33e4ad4f2 172.20.20.173 connected 16001mm 26001 master-01564039097000 5 connected 12288-16383
81d1b25ae1ea85421bd4abb2be094c258026c505 172.20.20.171 connected 16002 slave 04d9c29ef2569b1fc8abd9594d64fca33e4ad4f2 0 1564039099000 5 connected
7d697261f0a4dd31f422e2fbe593d5cdd575fbb5 172.20.20.174 connected 16002mm 26002 myself,slave ea77d7d10c27a1d99de00f4f81034d2d82a3c765 0 1564039094000 0
Ea77d7d10c27a1d99de00f4f81034d2d82a3c765 172.20.20.174 ea77d7d10c27a1d99de00f4f81034d2d82a3c765 16001mm 26001 master-01564039097000 8 connected 0-1364 5461-6826 10923-12287
So far, the capacity has been expanded successfully. Take a look at the allocation of each instance.
There is a difference in the amount of data here, because I am still inserting data in bulk on the node of 171s.
Of course, the anti-plan of capacity expansion is followed by capacity reduction, which is generally needed after resisting sudden traffic. There is no need to reduce capacity when the normal amount of data increases. In addition, there is a certain risk of capacity reduction.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.