andrewrothstein / ansible-zookeeper-cluster

MIT License
10 stars 12 forks source link

zookeeper-quorum #6

Open patsevanton opened 4 years ago

patsevanton commented 4 years ago

Hello!

[zookeeper] host1 zookeeper_myid=1 host2 zookeeper_myid=2 host3 zookeeper_myid=3 .... hostN zookeeper_myid=N

[zookeeper-quorum] host[1:N] or host[1:N-1] ? Thanks!

andrewrothstein commented 4 years ago

I fixed the documentation. I was incorrectly presuming host[1:7] included the host labeled host7. it doesn't. I corrected the example to specify [0:7] and have a host0 zookeeper_my_id=0 in inventory.

In your example if your hosts are named host1 ... host7 then your quorum would be host[1:8].

paul42 commented 4 years ago

quick q: how would this look in a .yaml file? I'm still learning ansible/yaml, so thank you for your work!

dev_zookeeper:
  hosts:
    zk-1:
      ansible_ssh_host: 10.x.x.x
      zookeeper_myid: 1     
    zk-2:
      ansible_ssh_host: 10.x.x.x
      zookeeper_myid: 2
    zk-3:
      ansible_ssh_host: 10.x.x.x
      zookeeper_myid: 3
#not certain how to represent the zookeeper-quorum tag in .yaml
zookeeper-quorum:
    host[1:3]#?
paul42 commented 4 years ago

oh nvm, I found the part i missed in the documentation, it's just a second group with the same number of hosts: Documentation: https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html#adding-ranges-of-hosts In INI:

[webservers] www[01:50].example.com In YAML:

... webservers: hosts: www[01:50].example.com: