thefactory/marathon-python

Support for HA nodes

Closed this issue · 3 comments

iven commented

When Marathon is running in HA mode, there's multiple nodes that can provide the REST APIs. When one of them is down, we should automatically switch to other nodes.

So we should support a URI scheme like http://host1:8080,host2:8080/.

Great idea, I'll introduce this in the next couple of days

iven commented

Maybe we can use ZooKeeper information. Seems the leader hostname is stored there:

  -h, --hostname  <arg>                       The advertised hostname stored in
                                              ZooKeeper so another standby host
                                              can redirect to this elected leader
                                              (default = tp-a179-D)

(Fixed in in 0.5.1 / 9e85f46)

You can now pass a list of servers to MarathonClient()

>>> c = MarathonClient(['http://host1:8080', 'http://host2:8080'])

As this is a library (not a CLI), a list seemed like a better interface than parsing a connection string.

Similarly, I'm not sure a ZK dependency is appropriate for this library. Sounds like a nice pattern to use in a wrapper script or service, though.