Geoscaling DNS balancing

57 views
Skip to first unread message

Molnár Mihály László

unread,
Dec 8, 2013, 7:55:09 AM12/8/13
to brookly...@googlegroups.com
Hi all!

I have a question about Geoscaling service.
If I see well it decide which IP to resolve based an location. Am I right?
I saw that if I resolv my DNS thorugh OpenDNS servers it gives back my private cloud IP in Europe. If I use google nameservers (8.8.8.8) I get back the HP clouds IP.

Can we make it somehow more like a loadbalancing thing? Like: http://en.wikipedia.org/wiki/Round-robin_DNS

Thanks!

Rusty

Aled Sage

unread,
Dec 8, 2013, 3:10:45 PM12/8/13
to brookly...@googlegroups.com
Hi Rusty,

You're right that our geoscaling.com usage is location-based (it infers
the location from the ip and returns the geographically closest value).

I'm not sure what support geoscaling.com give for round-robin. A quick
search and scan through their site didn't show anything, and [1] doesn't
give an example of that.

But it might be possible to script something. See [2] for our
script-generating code, and [3] for the geoscaling support contact details.

Anyone else know if round-robin is possible (and if so, how) with
geoscaling?

Aled

[1]
http://www.geoscaling.com/dns2/wiki/short_programming_guide_for_smart_subdomains
[2]
https://github.com/brooklyncentral/brooklyn/blob/master/software/webapp/src/main/java/brooklyn/entity/dns/geoscaling/GeoscalingScriptGenerator.java
[3] http://www.geoscaling.com/support.html
> --
> You received this message because you are subscribed to the Google
> Groups "brooklyn-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to brooklyn-user...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Molnár Mihály László

unread,
Dec 8, 2013, 3:45:04 PM12/8/13
to brookly...@googlegroups.com
Hi Aled!

Thanks for the info. I checked [1]. According to this it is possible to give both (or more) IP-s back. It's a good start. I will check how hosts reacts for this, which one would they use. (only use the first and the second as a backup, or is it random)
  else // if he/she comes from another network, just send both ips
  {
    $output[] = array("A", "86.55.16.126");
    $output[] = array("A", "193.138.195.114");
  }

And even as it's reconfigurable we can write a class which runs in a thread and periodically changes the IP. I know its a big hack, and maybe would end in something different, but it worth a test. I will look into [2] and geoscaling service a little.


Rusty


To unsubscribe from this group and stop receiving emails from it, send an email to brooklyn-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "brooklyn-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brooklyn-users+unsubscribe@googlegroups.com.

Molnár Mihály László

unread,
Dec 9, 2013, 11:13:09 AM12/9/13
to brookly...@googlegroups.com
Hi,

I think the only thing that should be modified is the template.php in brooklyn-software-webapp src/main/resources/brooklyn/entity/dns/geoscaling/
What do you think?

It tells it is auto-generated. Its auto-generated when? I would like to replace it with my own.

Thanks!


Rusty

Molnár Mihály László

unread,
Dec 9, 2013, 3:20:19 PM12/9/13
to brookly...@googlegroups.com
Hi,

It looks like to me that editing the template is a good way, but I have difficulties with this limited php. Do you have a list of functions which are supported?
I tried 'foreach' and 'for', and as I can tell you these are not working.

Thanks!


Rusty

Molnár Mihály László

unread,
Dec 9, 2013, 3:28:29 PM12/9/13
to brookly...@googlegroups.com
Sorry, 'for' should work as it works in the template. The problem must be something else.
I tried this to get all the hosts into the output:
$max = sizeof($hosts);
for ($i = 0 ; $i < $max; $i++) {
    $output[] = array("A", $hosts[$i]['ip']);

}

A code before it was commented of course.


Rusty

Molnár Mihály László

unread,
Dec 9, 2013, 6:07:07 PM12/9/13
to brookly...@googlegroups.com
validate ip is needed as a CNAME was in the hosts ip parameter.
but still missing the new region ip when i am testing with dig. looking into it tomorrow, but it is hard to debug.

Is it possibly to randomize the order in the output array? It would be some kind of loadbalancing I think.


Rusty

Aled Sage

unread,
Dec 11, 2013, 6:12:09 PM12/11/13
to brookly...@googlegroups.com
Hi Rusty,

To quickly answer your question about "auto-generated when", in GeoscalingDnsServiceImpl.reconfigureService it calls the GeoscalingScriptGenerator. This is called every time the member-set changes, for the target IPs.

---
To replace the template.php in brooklyn, the easiest thing to do is put your version ahead on the classpath at brooklyn/entity/dns/geoscaling/template.php. For example, by creating that dir+file in the `./conf/` directory when using the brooklyn launcher.

It's probably worth us exposing that path as a config key instead.

---
If you need to replace the entire generator then let us know. Currently that would involve sub-classing GeoscalingDnsServiceImpl and overriding the reconfigureService method.
(and then telling it to use your custom impl with: addChild(EntitySpec.create(GeoscalingDnsService.class).impl(YourCustomGeoscalingDnsServiceImpl.class))

We could refactor that so it's a smaller method that needs to be overridden. Are you running against master or 0.6.0?

Aled


Rusty




Rusty




Rusty




Rusty




Rusty


To unsubscribe from this group and stop receiving emails from it, send an email to brooklyn-user...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "brooklyn-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brooklyn-user...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "brooklyn-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brooklyn-user...@googlegroups.com.

Richard Downer

unread,
Dec 12, 2013, 9:59:34 AM12/12/13
to brookly...@googlegroups.com
Hi Rusty,

I've tried out your suggested change to template.php. It seems to work for me!

% dig brooklyn-nG4a3ntP.geopaas.org                                                                                                                                                                     
[....]
;; QUESTION SECTION:

;; ANSWER SECTION:
brooklyn-nG4a3ntP.geopaas.org. 271 IN   A       15.185.105.75
brooklyn-nG4a3ntP.geopaas.org. 271 IN   A       15.185.167.112
brooklyn-nG4a3ntP.geopaas.org. 271 IN   A       15.185.221.208
[....]

Normal DNS behaviour is to do "round robin" - where there are multiple records, for each request, the list is rotated. So if I run dig again:

;; ANSWER SECTION:
brooklyn-nG4a3ntP.geopaas.org. 195 IN   A       15.185.167.112
brooklyn-nG4a3ntP.geopaas.org. 195 IN   A       15.185.221.208
brooklyn-nG4a3ntP.geopaas.org. 195 IN   A       15.185.105.75

And again:

;; ANSWER SECTION:
brooklyn-nG4a3ntP.geopaas.org. 183 IN   A       15.185.221.208
brooklyn-nG4a3ntP.geopaas.org. 183 IN   A       15.185.105.75
brooklyn-nG4a3ntP.geopaas.org. 183 IN   A       15.185.167.112

In three successive requests, each time I see a different IP address at the top of the list.

HOWEVER... there is TTL to consider. Geoscaling.com applies a 300-second (5 minutes) TTL by default. This means that if the results of the query get cached anywhere, the IP at the top of the list at that time will be cached for 5 minutes. So if I run "ping" three times, I get the same IP address, because the resolver on my computer has cached it:

% for p in 1 2 3; do ping -c 1 brooklyn-nG4a3ntP.geopaas.org; done
PING brooklyn-ng4a3ntp.geopaas.org (15.185.221.208): 56 data bytes
[....]
PING brooklyn-ng4a3ntp.geopaas.org (15.185.221.208): 56 data bytes
[....]
PING brooklyn-ng4a3ntp.geopaas.org (15.185.221.208): 56 data bytes
[....]

If I wait for the cache to expire before trying again, then I'll see the next IP address appear:

PING brooklyn-ng4a3ntp.geopaas.org (15.185.105.75): 56 data bytes
[....]

I hope this answers your question, although I'm not fully sure what it is you are looking for. Please shout back if I've misunderstood you!

Cheers
Richard.


To unsubscribe from this group and stop receiving emails from it, send an email to brooklyn-user...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.



--
Richard Downer • Principal Engineer • Cloudsoft Corporation • http://www.cloudsoftcorp.com
GitHub richardcloudsoft • Twitter @FrontierTown

Molnár Mihály László

unread,
Dec 17, 2013, 5:20:27 AM12/17/13
to brookly...@googlegroups.com
Hi guys,

Thanks for your responses and tests.
I have this code in my templat.php

$max = sizeof($hosts);
$output[] = array("TXT", "GeoScaling config auto-updated by Brooklyn DATESTAMP");


for ($i = 0 ; $i < $max; $i++) {
    if (filter_var($hosts[$i]['ip'], FILTER_VALIDATE_IP)) {

        $output[] = array("A", $hosts[$i]['ip']);
    } else {
        $output[] = array("CNAME", $hosts[$i]['ip']);
    }
}

But somehow only my private cloud address is in dig results. Its a CNAME while HP cloud gives back an IP which is an A record.

I copied the filter_var part from the existing template, so I think it should work. Anybody any idea why I can't get HP Cloud's IP in dig response with this code?

Thanks again!


Rusty
Reply all
Reply to author
Forward
0 new messages