Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 647 Vote(s) - 3.48 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Redis cluster master slave - not able to add key

#1
I have setup up Redis master slave configuration having one master (6379 port) and 3 slaves (6380,6381,6382) running in the same machine. Looks like cluster is setup properly as I can see the following output on running info command:

# Replication
role:master
connected_slaves:3
slave0:ip=127.0.0.1,port=6380,state=online,offset=29,lag=1
slave1:ip=127.0.0.1,port=6381,state=online,offset=29,lag=1
slave2:ip=127.0.0.1,port=6382,state=online,offset=29,lag=1
master_repl_offset:43
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:2
repl_backlog_histlen:42

But wherever I try to add new key in master, I get the following error:

(error) CLUSTERDOWN Hash slot not served

Using redis-3.0.7 in Mac OS X Yosemite.
Reply

#2
You can use ruby script buddled with redis for creating clusters as mentioned below :

/usr/local/redis-3.2.11/src/redis-trib.rb create --replicas 1 192.168.142.128:7001 192.168.142.128:7002 192.168.142.128:7003 192.168.142.128:7004 192.168.142.128:7005 192.168.142.128:7006
Reply

#3
The issue comes when one or more Redis nodes gets corrupted and can no longer serve its configured hash slots.

You will have to bootstrap the cluster again to make sure the nodes agree on the hash slots to serve.

If the Redis nodes contain data or a key in the database 0, you will have to clear this data before rerunning the bootstrap.
Reply

#4
There is a hash slot not allotted to any master. Check the hash slots by looking at the column 9 in the output of following command (column 9 will be empty if no hash slots for that node):

redis-cli -h masterIP -p masterPORT CLUSTER NODES

The hash slots can be allotted by using the following command.

redis-cli -h masterIP -p masterPORT CLUSTER ADDSLOTS SLOTNNUMBER

But this has to be done for every slot number individually without missing. Use a bat script to include it in for loop. something like,

for /L %a in (0,1,5400) Do redis-cli -h 127.0.0.1 -p 7001 cluster addslots %a

Also, this command works before assigning slaves to master. After this ADDSLOTS step and completing the setup, the SET and GET worked fine. Remember to use **-c** along with redis-cli before SET to enable *cluster support*.
Reply

#5
I had the same issue, turned out I forgot to run the `create` cluster:

cd /path/to/utils/create-cluster
./create-cluster create

[To see links please register here]

Reply

#6
To fix slots issue while insertion:

redis-cli --cluster fix localhost:6379
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through