Riak and host names

Michael Johnson mj at mediatemple.net
Mon Jan 7 19:39:59 EST 2013


I'm not sure how much this will help, but I will throw my two cents into
the hat.  Given that I don't know the details of your requirements, and I
am fairly new to riak and aws, please take everything with a grain of salt.

On Tue, Jan 1, 2013 at 11:43 AM, Deepak Balasubramanyam <
deepak.balu at gmail.com> wrote:

> I took the AWS EC2 riak image for a spin today. I have a query regarding
> riak nodes and how they behave when the machine reboots.
>
> When an EC2 instance reboots, the internal ip / internal DNS / external
> DNS change. This renders the app.config and -name argument on vm.args
> incorrect. I was exploring solutions to deal with this problem.
>
> *1. Preventive measures*
>
> Someone on this thread dated May 2011<http://riak-users.197444.n3.nabble.com/EC2-and-node-names-td2892047.html> suggested
> using host file entries that point to the local internal IP address. That
> does not seem to work. Riak fails with the following error when I add a new
> entry to /etc/hosts and configure vm.args with -name riak at riaknode1
>
> If you add something that looks like a legitimate FQDN (like
riaknode1.mydomaind.com) into /etc/hosts and utilize that instead of just
riaknode1, that should work just fine.

The caveat is that all nodes you your cluster need to have entries in
/etc/hosts for all the other nodes.  This is where you may have some
management headaches.

It seems silly to me that erlang requires you to use a different command
line option depending on what the host name looks like, but then there are
many things that elrang does that seem silly to me.  There my be a good
technical explanation, but I can't come up with one.

Hostname riaknode1 is illegal
>
> I confirmed that riaknode1 pings correctly before starting riak. I guess
> erlang tries to match the hostname of the system resulting in this failure
> ? Can anyone throw some light on this ?
>
> *2. Use -sname*
>
> Is starting the erlang VM with the sname flag an option if it will help
> prevent the 'illegal hostname' error ?
> Disclaimer: My knowledge of erlang is close to zilch, so sorry if that
> option sounded like something you could dismiss easily :)
>
> As far as erlang is concerned, you absolutely could do this and it should
work fine for riak.  But the caveate is that you likely will have to rework
the riak init scripts or simply write your own.  RabbitMQ is another erlang
application I have used and it's init script requires that you use the
short name with no dots in it and passes that to erlang with -sname.  That
bugs me a bit as I perfer to use the FQDN, but the amount of work to manage
and maintain my own init scripts was just not work it for something that is
seemingly just asthetics.

*3. Use cluster replace
> *
>
>
a. I understand that the IPs in app.config and vm.args can be replaced with
> the correct IP on a restart and using a subsequent 'cluster replace'
> command will do. Will executing the 'cluster plan' and 'cluster commit'
> commands now produce network chatter ?
>

Rather than micro managing the ips in app.config, I've opted to just have
riak listing on any IP by specifying 0.0.0.0 and then restrict access using
IP tables to deny access base on the interface name which is generally
consistent across all nodes.  This means the configs are much more generic
and easy to maintain for me.  This might be a suitable option for you as
well.

>
> b . What happens if 2 nodes go down and one was joined with the other.
> They both have 2 different IP addresses on restart. How will 'cluster
> replace' work now ?
>

I've not played around with cluster replace much, but given riak likes to
do everything by hostname (which it then resolved to an IP), it shouldn't
matter if the ip changes as long was the node names don't change and those
names resolve to the correct IP addresses.  But then that means each time a
node comes up, you have to update DNS or /etc/hosts as appropriate which
will be a pain.

>
> Do let me know your thoughts.
>

Ultimately, I wouldn't want to be building a riak cluster where the IP
address of the nodes could/would change any time the node was rebooted.
 Surely there is a way to make sure the private IP of the nodes say the
same across reboots?  That will make your life a lot easier.


> Thanks
> -Deepak
>
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20130107/1eb27f71/attachment.html>


More information about the riak-users mailing list