-
Notifications
You must be signed in to change notification settings - Fork 550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can not connect to cluster from another PC #81
Comments
But, when I setup all of them on same machine. Everything work fine. |
docker run -e "IP=0.0.0.0" -p 7000:7000 -p 7001:7001 -p 7002:7002 -p 7003:7003 -p 7004:7004 -p 7005:7005 grokzen/redis-cluster:latest I did try with this, but It only worked with same machine. |
It is not intended to be used from a different machine. The 0.0.0.0 binding just makes it possible for your client to connect from your local machine to you redis cluster. You have to use some other mechanism or bind the internal IP to another IP or make a mesh network between the machines to enable access between servers. This is something you have to do yourself to make it work. |
Then what is the solution? any fork repo which we can use to connect to cluster from another PC |
@Nikunja6 I dont think there is any good solution really. I have been thinking about adding option for some kind of generic translation mechanism, but that has not yet materialized in any way. That would just allow you to say some basic stuff like, if you see ip |
Hmm, i think i wrote the last part from the wrong pov and i wrote it from a clients pov... But what i mean is that one bit is that this container is not really desined to be used from another computer, i am sure that you can find other container builds that is more built towards running inside a k8s cluster, or inside a compose cluster, or swarm or what have you. The intention of this container is what is specified in the README file. I personally have no interest in fixing or changing the container to suite some other solution right now as this container suits my needs and what the container is intended for. However, as it also says in there, i have no issue with reviewing and merging some solution that would bridge any further functionality into this container if anyone has any ideas of how to make it work in more scenarios. But in the end, the point from my prev post still stands that it is a problem that is combined with docker + redis-server + redis client at the same time that makes it fubared. You need all 3 parts playing well with eachother and that is not happening right now sadly and i dont really know of have any good generic solution that will suite all use-cases or everyones choices in how they want to run this. In theory, what is needed is for redis to be able to map other IP:s internally when working inside a docker container to allow for the redis cluster to report the correct IP:s when inside a docker container. If that is solved, then all of the things would work out. The other solution i have been contemplating is to acctually split the cluster into different containers instead of running it inside one container, that might just solve the problem, but i have not experimented with that solution yet to see if it helps or not. |
try |
Yes like @mlixytz wrote, network_mode: host is the general solution for this to get the ports exposed to your host that you can then connect to from a remote machine, but there is no guarantee that the internal IP:s tracked inside your cluster will work out with a client lib so you have to test it out a bit. |
I have two machines are running on Ubuntu 18.04. First machine (IP: 192.168.1.7) run redis cluster, and second (IP: 192.168.1.8) run nodejs application.
The application can not connect to Redis cluster, I don't know why.
When I check the docker logs. It show "IP After trim: '172.22.0.2'". I use FastoRedis connect to Redis cluster with IP 192.168.1.7 successful. But when I create key-value, It show message "Redirected to slot [11518] located at 172.22.0.2:7002"
I try to set IP: 0.0.0.0 but It does not work.
I use IORedis lib on nodejs application, and this is my config:
[ { port: 7000, host: '192.168.1.7' }, { port: 7001, host: '192.168.1.7' }, { port: 7002, host: '192.168.1.7' }, { port: 7003, host: '192.168.1.7' }, { port: 7004, host: '192.168.1.7' }, { port: 7005, host: '192.168.1.7' } ]
Please help me, thank you.
The text was updated successfully, but these errors were encountered: