Dealing with changing IP addresses

13 views
Skip to first unread message

Evan Tahler

unread,
May 5, 2013, 5:21:15 PM5/5/13
to action...@googlegroups.com
(coppied here from an emailed question) 

Hi Evan,

i have a short question.
I currently try action hero with some PAAS provider (dotcloud, appfog) to test dynamic scaling of action hero servers.
When I start a new server the workers with the corresponding state are saved in redid, when  I shutdown the server and restart, it gets a new IP address and new worker entries in redid are created.
So after several test runs I have a big amount of worker states in redis, so they never removed.
Is this a bug or feature, why not delete such entries when the server shutdowns?

Evan Tahler

unread,
May 5, 2013, 5:21:29 PM5/5/13
to action...@googlegroups.com
I would say that this kind of thing was *intended* to be a feature, but in your use case, would be a bug :D

The reason this happens, is that a lot of data in actionHero is keyed to `api.id`.  This is important for a lot of things, but specifically the `task` and `stats` sub systems.  With tasks, there are queues created for each server and worker combination so we can build up individual queues for "all" tasks.  For stats, the ID is used to keep "local" stats, in addition to "global" stats.  

In this commit https://github.com/evantahler/actionHero/commit/4100a05968a1df09ff51b8306f17ba49b1bbf7d6 I allowed the optional config option of "api.configData.general.id" to be defined which would overwrite the default id creation logic (which is based on IP address).  Feel free to use this if you think your server IPs will be changing often.  It's really importnat that each and every server running (simultaneously) has a unique ID.  This includes running a node cluster with n workers.  If you need it, in config.js, you can append the pid or other such things to solve this problem.
Reply all
Reply to author
Forward
0 new messages