ARTH — Task 11 👨🏻💻
Task Description📄
🔰 11.1 Configure Hadoop and start cluster services using Ansible Playbook
To have basic knowledge on ansible refer below blog:
MAIN STEP FOR THE TASK : CONFIGURING ANSIBLE IN CONTROL NODE -
STEP:1:Download ANSIBLE
cmd: pip3 install ansible
STEP:2:To create inventory
STEP:2.1:create a file
cmd: vim <filename>.txt [eg.,vim ip.txt or vim /root/ip.txt]
STEP:2.2:write a file
<ip> ansible_user=<user name> ansible_ssh_pass=<password> ansible_connection=ssh
Here, we have 2 managed nodes or target nodes :
- managed node1 : For configuring namenode or masternode
- managed node2 : For configuring datanode or slavenode
STEP:3:To create ansible configuration file
- create a directory = cmd: mkdir /etc/ansible
- create a file = cmd: vim /etc/ansible/ansible.cfg
3. write a file:
To check:
cmd: ansible all — list-hosts (shows ip of target nodes that are connected)
STEP:4:To connect the hosts
cmd: dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
then install sshpass,
cmd: yum install sshpass
To check: ansible all -m ping
MAIN STEP COMPLETED!!!!
Now,create 2 playbooks one for masternode and other for datanode:
- create a directory: cmd: mkdir /<name> [eg., mkdir /task]
- cd /ws ->create 2 file : vim <file name>.yml
A]write in NN.yml file:
B]write in DN.yml file:
Now, play the 2 playbook:
cmd: ansible-playbook <file name>
A]play the playbook NN.yml
B]play the playbook DN.yml
To check:
1]Go to managed node1[namenode or masternode]
2]Go to managed node2[datanode or slavenode]
SUCCESSFULLY COMPLETED!!!