Repository: aurora
Updated Branches:
refs/heads/master 0070a5fd1 -> 8bdfb8500
Added fix for client to connect to correct zookeeper-hosts address/port pairs.
When more than one zookeeper host was specified in the clusters.json file, only
the last host was accessed through the specified zk_port. The client would
attempt to connect to all other zookeeper hosts using the default port (2181).
For example, in clusters.json:
[{
"name": "<my_cluster>",
"zk": "host1.domain.com,host2.domain.com,host3.domain.com",
"zk_port": 2626,
"scheduler_zk_path": "/cluster/aurora/scheduler",
"slave_run_directory": "latest"
}
...
]
I found that the client would attempt to access the zk hosts addresses
host1.domain.com:2181, host1.domain.com:2181, and host3.domain.com:2626. Thus,
the "zk_port" attribute would only update the last host in the host string-list.
This change allows the client to properly connect to multiple zookeeper hosts
using a port other than the specified port.
Note, that the KazooClient accepts a comma-separated string of hosts.
Testing Done:
This is a simple change, but tested to make sure client can still connect to
each zookeeper host. Then verified that all hosts are now accessed through the
correct port, not just the default (port 2181). Also viewable by Aurora client
INFO logs.
Bugs closed: AURORA-1405
Reviewed at https://reviews.apache.org/r/36697/
Project: http://git-wip-us.apache.org/repos/asf/aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/8bdfb850
Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/8bdfb850
Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/8bdfb850
Branch: refs/heads/master
Commit: 8bdfb8500e792da199bd8cc9fed38d36e2448e81
Parents: 0070a5f
Author: Zane Silver <[email protected]>
Authored: Wed Jul 22 14:26:57 2015 -0700
Committer: [email protected] <[email protected]>
Committed: Wed Jul 22 14:26:57 2015 -0700
----------------------------------------------------------------------
src/main/python/apache/aurora/client/api/scheduler_client.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/aurora/blob/8bdfb850/src/main/python/apache/aurora/client/api/scheduler_client.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/api/scheduler_client.py
b/src/main/python/apache/aurora/client/api/scheduler_client.py
index b8361b8..8e91788 100644
--- a/src/main/python/apache/aurora/client/api/scheduler_client.py
+++ b/src/main/python/apache/aurora/client/api/scheduler_client.py
@@ -120,7 +120,8 @@ class ZookeeperSchedulerClient(SchedulerClient):
if cluster.scheduler_zk_path is None:
raise ValueError('Cluster has no defined scheduler path, must specify
scheduler_zk_path '
'in your cluster config!')
- zk = TwitterKazooClient.make(str('%s:%s' % (cluster.zk, port)),
verbose=verbose)
+ hosts = [h + ':{p}' for h in cluster.zk.split(',')]
+ zk = TwitterKazooClient.make(str(','.join(hosts).format(p=port)),
verbose=verbose)
return zk, ServerSet(zk, cluster.scheduler_zk_path, **kw)
def __init__(self, cluster, port=2181, verbose=False, _deadline=deadline,
**kwargs):