Riak and host names

Charlie Voiselle cvoiselle at basho.com
Mon Jan 7 09:31:21 EST 2013


When you name a node in app.config with -name it has to have a '.' in it,  like riak at hostname.net  As you have surmised, you can get around that if you use the -sname argument instead. 

They have to be done consistently.  In your example, had you used the -sname argument, `riak at riaknode1` would work.  Making a host entry `riaknode1.priv` that points to the local address would work with the -name argument.

The inportant thing about -name and -sname is that they can't mix within a cluster.

Cluster replace is designed to replace a node with a new one and transfer all the partitions. You can cheat and use it to rename a node though.  

The process to do this would look like the following:

Stop the node to rename with `riak stop`
Mark it 'down' from another node in the cluster using `riak-admin down «old nodename».
Rename the node in vm.args.
Delete the ring directory.
Start the node with `riak start`.  
It will come up as a single instance which you can verify with `riak-admin member-status`.
Join the node to the cluster with `riak-admin cluster join «cluster nodename» `
Set it to replace the old instance of itself with `riak-admin cluster replace «old nodename» «new nodename»
Plan the changes with `riak-admin cluster plan`
Commit the changes with `riak-admin cluster commit`

As you can see, this is a very large effort, so best to use hostnames that aren't moving around.  Apologies for you getting this twice, Deepak. I failed to reply to the list as well.

Hope this makes sense...

On Jan 1, 2013, at 2:43 PM, 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 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
> 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 :)
> 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 ? 
> 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 ?
> Do let me know your thoughts.
> 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/79c44a1d/attachment.html>

More information about the riak-users mailing list