cassandra-web
cassandra-web copied to clipboard
Resolving FQDN for hostname params
Hi @avalanche123 et al.
I've done a small modification to the code in order to let HOST parameter work also with FQDN instead of only IPS.
I'm trying to use cassandra-web in kubernetes environments where IPs cannot be know in advance, so this small fix is really useful to me. Sadly I'm not a ruby developer so I tried to arrange it the best I could, but I'd like to share it to have it included in mainstream (maybe with some more elegant adjustment).
PR also include integration with Travis CI to create docker image and upload it to Docker hub (just change environment variables and secure to work on another account)
Ruby driver already performs dns lookup on hostnames, I’m not sure why this is needed
This is what happens if you pass a fqdn instaed of ip to 0.4.0 version:
✗ docker run -e"CASSANDRA_HOST_IP=www.google.com" delermando/docker-cassandra-web:v0.4.0
cassandra-web --hosts www.google.com --port 9042 --username cassandra --password cassandra
IPAddr::InvalidAddressError: invalid address
Usage: cassandra-web [options]
-B, --bind BIND ip:port or path for cassandra web to bind on (default: 0.0.0.0:3000)
-H, --hosts HOSTS coma-separated list of cassandra hosts (default: 127.0.0.1)
-P, --port PORT integer port that cassandra is running on (default: 9042)
-L, --log-level LEVEL log level (default: info)
-u, --username USER username to use when connecting to cassandra
-p, --password PASS password to use when connecting to cassandra
-C, --compression NAME compression algorithm to use (lz4 or snappy)
--server-cert PATH server ceritificate pathname
--client-cert PATH client ceritificate pathname
--private-key PATH path to private key
--passphrase SECRET passphrase for the private key
-h, --help Show help
Hmm, I’ll take a look, we might have to update the version of the ruby driver that cassandra-web is using
Can you rerun cassandra-web
with --debug
. And paste the stack-trace
no change in output ( I suppose you intended -L debug )
docker run -e"CASSANDRA_HOST_IP=www.google.com -L debug " delermando/docker-cassandra-web:v0.4.0
cassandra-web --hosts www.google.com -L debug --port 9042 --username cassandra --password cassandra
IPAddr::InvalidAddressError: invalid address
Usage: cassandra-web [options]
-B, --bind BIND ip:port or path for cassandra web to bind on (default: 0.0.0.0:3000)
-H, --hosts HOSTS coma-separated list of cassandra hosts (default: 127.0.0.1)
-P, --port PORT integer port that cassandra is running on (default: 9042)
-L, --log-level LEVEL log level (default: info)
-u, --username USER username to use when connecting to cassandra
-p, --password PASS password to use when connecting to cassandra
-C, --compression NAME compression algorithm to use (lz4 or snappy)
--server-cert PATH server ceritificate pathname
--client-cert PATH client ceritificate pathname
--private-key PATH path to private key
--passphrase SECRET passphrase for the private key
-h, --help Show help
I just realized that the Gemfile.lock
was pretty stale and I updated it, can you try again without your patch to ensure you get dns resolving now, thanks!
For me, version 0.5.0
still doesn't accept hostnames.
It's the line Cassandra::LoadBalancing::Policies::WhiteList.new(hosts, ::Cassandra::LoadBalancing::Policies::RoundRobin.new)
thats the culprit. It does not accept hostnames in hosts. So I think the patch is still needed.
Hi @avalanche123 , Can you take a look at this again?