Skip to content
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

redis-trib support to resolve hostname to IP address #2323

Closed
wants to merge 1 commit into from
Closed

redis-trib support to resolve hostname to IP address #2323

wants to merge 1 commit into from

Conversation

MasahikoSawada
Copy link
Contributor

Currently, redis-trib can't resolve hostname to IP address, e.g., when it starts to create redis cluster.
Related to issue #2186.

mattsta pushed a commit to mattsta/redis that referenced this pull request Feb 3, 2015
@badboy
Copy link
Contributor

badboy commented Mar 29, 2015

This is a reasonable addition. If we want redis-trib to be the reference implementation of a Cluster management tool, we should make it easy to use, and that means allowing hostnames. Though we should properly document and communicate that Cluster itself deals only with IPs.

@andrepintorj
Copy link

This addition is a must have to facilitate the cluster's management.

@spuder
Copy link

spuder commented Aug 27, 2015

+1

@jamesongithub
Copy link

boo, hit no password support, now no hostname support. is it faster to just issue redis command directly?

@dannyman
Copy link

dannyman commented Jul 20, 2016

2c: I get why we wouldn't want to do this: if the cluster internally sets up as IP addresses then do not give the illusion of supporting hostnames.

In practice, though, that changes my crib notes from something clean like:

./redis-trib.rb create --replicas 1 \
  host0 host1 host2 host3 host4 host5

To this sort of atrocity:

./redis-trib.rb create --replicas 1 \
  `host host0 | cut -d ' ' -f 4`:6379 \
  `host host1 | cut -d ' ' -f 4`:6379 \
  `host host2 | cut -d ' ' -f 4`:6379 \
  `host host3 | cut -d ' ' -f 4`:6379 \
  `host host4 | cut -d ' ' -f 4`:6379 \
  `host host5 | cut -d ' ' -f 4`:6379

Might I suggest:

  • A flag that means "I understand you do IP addresses in the cluster config but please accept these hostnames for I am but a human"
  • If someone feeds hostnames in but doesn't supply the flag, detect this situation and error out with like "You need to feed me IP addresses instead of hostnames!!"
  • Do not require me to fill in the default port number.

Thanks,
-danny

@arunpmathew
Copy link

+1

@manolama
Copy link

2c: I get why we wouldn't want to do this: if the cluster internally sets up as IP addresses then do not give the illusion of supporting hostnames.

Wait, does Redis only support IPs internally for all operations or just clustering? The reason I ask is that I'm looking at setting up a fairly substantive cluster that would span multiple nodes. If a node dies, I can re-create it with the same hostname but the IP may change (due to the way our system handles virtual machines). If we're able to bring up a new VM with the same host, I'd love to see Redis auto-recover without having to remove the old IPs and add in the new ones and set new slaves.

+1 for internal hostname support!

@wolph
Copy link

wolph commented Aug 1, 2018

Even without internal hostname support it would be so much more convenient to call the command with a hostname. Especially if you use some (zsh) shell-globbing:

redis-trib.rb create --replicas 1 redis-{00..07}:{7000..7015}

Instead of... well, you can guess how it'll be when I replace those with IP addresses ;)

@qvissak
Copy link

qvissak commented May 21, 2019

+1 for internal hostname support

@qvissak
Copy link

qvissak commented May 21, 2019

redis-server works with hostname/ip mapping. i.e sample docker-compose:

  redis_master:
   image: redis

  redis_slave:
    command: redis-server --slaveof redis_master 6379 <-- this is where the magic happens
    image: redis

@tculp
Copy link

tculp commented Jun 25, 2019

@qvissak redis-server may support hostnames, but redis-cli -p 6379 cluster meet redismaster 6379 complains with "(error) ERR Invalid node address specified: redismaster:6379"

@AkashKrDutta
Copy link

AkashKrDutta commented Dec 3, 2019

As a workaround, why not use replicaof and provide the master hostname to slave (see here) like:

replicaof redis-master-0.redis-master.svc.cluster.local 6379

Edit: Ah, I am sorry. In cluster-mode you cannot set replica's with either config value of replicaof or from the COMMAND REPLICAOF. ERROR:

(error) ERR REPLICAOF not allowed in cluster mode.

@tculp
Copy link

tculp commented Feb 11, 2020

Any update on this?

@artix75
Copy link
Contributor

artix75 commented Feb 12, 2020

Any update on this?

@tculp redis-trib is no longer supported. New versions of redis use redis-cli --cluster instead.

@antirez antirez closed this Feb 20, 2020
@jordigarcl
Copy link

I get why this was closed, but no related ticket?

@nlalexandrov
Copy link

This is an issue for us too.
I have a wildcard TLS certificate. If I assemble my cluster with IP addresses, I get errors like these :
"Connection with Node 11c8443642680aebae33c5c74b7a5cf84617fb3c at :17001 failed: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed"
If I generate a self signed certificate the same configuration works. So I guess I have to assemble the cluster with names in order to match my *domain certificate, but I can't...

@oranagra
Copy link
Member

@jordigarcl @nlalexandrov all the code from redis-trib was moved to redis-cli, so this PR is no longer relevant. but it seems that redis-cli suffers from the same problem.
Anyone volunteers to make a PR to fix it? (or alternatively open a new issue with details and justifications)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.