Question: I currently have a situation where I have to find the next value after my current move. 

Currently I have below:

```
 SELECT CONVERT(CHAR(17), PlannedStartDateUTC,13) 
 FROM   VisitMovement VM 
 WHERE  vm.VisitMovement_GUID = (SELECT VM2.VisitMovement_GUID 
                                 FROM VisitMovement VM2 
                                 WHERE vm2.OrderIndex = (VisitMovement.OrderIndex +10) 
                                   AND VM2.Visit_GUID = VisitMovement.Visit_GUID )) AS [Estimated Move],

```

Which works by using `VisitMovement.OrderIndex` to find the next move. However, in some situations the `OrderIndex` might not be +10 but +20. 

I can't understand how I would logically write this to find the next move.

Any more information please get in touch.

Answer: 
Here is some ansible jinja2 template info for automating the build of a cluster with the 0.0.0.0 hostname in zoo.cfg

```
{% for url in zookeeper_hosts_list %}
  {%- set url_host = url.split(':')[0] -%}
  {%- if url_host == ansible_fqdn or url_host in     ansible_all_ipv4_addresses -%}
server.{{loop.index0}}=0.0.0.0:2888:3888
{% else %}
server.{{loop.index0}}={{url_host}}:2888:3888
{% endif %}
{% endfor %}

```
We faced the same issue , for our case the root cause of the problem is too-many number of client connections . The default ulimit on aws ec2 instance is 1024 and this causes zookeeper nodes not able to communicate with each other . 

The fix for this is 
change the ulimit to a higher number -> (> ulimit -n 20000 )
stop and start zookeeper.