redis cluster on multiple hosts

613 views
Skip to first unread message

Дмитрий Александров

unread,
Feb 21, 2014, 9:41:07 AM2/21/14
to redi...@googlegroups.com
Hi. Please help me to configure redis cluster.
I can run redis cluster on one host with diferent ports. It works well without any problem, but not on the several hosts!
I install 3 separate servers and doing make install redis on it.

I can create cluster by ./redis-trib.rb
./redis-trib.rb create --replicas 0 10.77.94.65:7000 10.77.50.35:7001 10.77.56.67:7002
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.

Cluster says that it is OK:
127.0.0.1:7000> CLUSTER INFO
cluster_state:ok
cluster_slots_assigned:16384
cluster_slots_ok:16384
cluster_slots_pfail:0
cluster_slots_fail:0
cluster_known_nodes:3
cluster_size:3
cluster_current_epoch:0
cluster_stats_messages_sent:46
cluster_stats_messages_received:46

But set/get operations fails:
127.0.0.1:7000> set test1 test
(error) MOVED 4768 10.77.56.67:7002

Where is my mistake or maybe it`s a bug?

Salvatore Sanfilippo

unread,
Feb 21, 2014, 9:44:11 AM2/21/14
to Redis DB
On Fri, Feb 21, 2014 at 3:41 PM, Дмитрий Александров
<d.i.ale...@gmail.com> wrote:
> (error) MOVED 4768 10.77.56.67:7002
>
> Where is my mistake or maybe it`s a bug?

No mistake nor bug, this is a redirection error that tells you to
connect to host with port 7002 for this specific key, since this key
is not handled by the node you are taking with (which is "7000").

Salvatore

--
Salvatore 'antirez' Sanfilippo
open source developer - GoPivotal
http://invece.org

To "attack a straw man" is to create the illusion of having refuted a
proposition by replacing it with a superficially similar yet
unequivalent proposition (the "straw man"), and to refute it
-- Wikipedia (Straw man page)
Message has been deleted

Дмитрий Александров

unread,
Feb 24, 2014, 6:46:56 AM2/24/14
to redi...@googlegroups.com
Thank you for your answer. I found a problem. I use non-cluster client to connect to redis in cluster mode. Thanks.
But now I have another question. Is there any way to create cluster through NAT? I`m try to create cluster using my external IP address (e.g. 1.2.3.4) with port forwarding
./redis-trib.rb create --replicas 0 1.2.3.4:7000 1.2.3.4:7001 1.2.3.4:7002
>>> Creating cluster
Connecting to node 1.2.3.4:7000: OK
Connecting to node 1.2.3.4:7001: OK
Connecting to node 1.2.3.4:7002: OK
>>> Performing hash slots allocation on 3 nodes...
Using 3 masters:
1.2.3.4:7000
1.2.3.4:7001
1.2.3.4:7002
M: 04bd3744873f781d5d520e68347746f4131c83bc 1.2.3.4:7000
   slots:0-5460 (5461 slots) master
M: 48cbe923c34297983779837b614547ca49ae344f 1.2.3.4:7001
   slots:5461-10921 (5461 slots) master
M: 1bdd4794dc486d10acd757cb80d170bb4c945378 1.2.3.4:7002
   slots:10922-16383 (5462 slots) master
Can I set the above configuration? (type 'yes' to accept): yes
>>> Nodes configuration updated
>>> Sending CLUSTER MEET messages to join the cluster
Waiting for the cluster to join...........
Process hangs on message "Waiting for the cluster to join".

пятница, 21 февраля 2014 г., 18:44:11 UTC+4 пользователь Salvatore Sanfilippo написал:
Reply all
Reply to author
Forward
0 new messages