Use Ansible installation zookeeper

Preparing the environment:

Because already configured on a basic environment and environmental variables, not repeat them here

Installation zookeeper:

cd /etc/ansible/roles

mkdir -p zookeeper/files zookeeper/handlers zookeeper/tasks zookeeper/templates zookeeper/vars

vim hosts

[zk_servers]
server01 myid = 1
server02 myid = 2
server03 myid = 3

vim zk.yml

- hosts: all
  roles:
  - zookeeper

cd zookeeper/files

The configuration files and download the installation package put to good zk files folder

cd ../tasks

vim main.yml

---
- name: copy  zookeeper tar
  unarchive: src=zookeeper-3.4.5-cdh5.11.0.tar.gz dest=/root
- name: config zoo
  copy: src=zoo.cfg dest=/root/zookeeper-3.4.5/conf/zoo.cfg
- name: add myid file
  shell: echo {{ myid }} > /root/zookeeper-3.4.5/zkdata/myid
- name: add logdir
  file: name=/root/zookeeper-3.4.5/zkDataLog state=directory
- name: start zookeeper
  shell: zkServer.sh start

cd ..

ansible-playbook -i hosts zk.yml

zookeeper installation is complete!

jps shall verify that there QuorumPeerMain success! !

Next update Ansible installation kafka!

Published 21 original articles · won praise 5 · Views 412

Guess you like

Origin blog.csdn.net/weixin_41762839/article/details/104863005