Archive

Archive for May, 2015

Ansible Playbook – Setup Hadoop CDH5 Using tarball.

May 20, 2015 Leave a comment

Ansible Playbook – Setup Hadoop CDH5 Using tarball.


Table of Contents


This is a simple Hadoop playbook, to quickly start hadoop running in a cluster.
Here is the Script Location on Github: http://ift.tt/1FA0l44
Below are the steps to get started.

Get the script from Github.

Below is the command to clone.
ahmed@ahmed-server ~]$ git clone http://ift.tt/1FA0l44

Before we start.

Download hadoop-2.3.0-cdh5.1.2.tar.gz to file_archives directory.
Download jdk-7u75-linux-x64.tar.gz to file_archives directory.

Details about each Playbook ‘Roles’.

Details about each Role.

commons

This role is used to update OS parameters and will update the below files.
  1. sysctl.conf Update swapiness, networking and more. Info in defaults/main.yml
  2. limits.conf Update soft and hard limits.
  3. 90-nproc.conf Update user based limits and adding hadoop_user limits file.
  4. /etc/hosts Update hosts file on the server – from host_name in hosts file.
/etc/hosts file will get the server information from the [allnodes] group in the hosts file.
NOTE : Commons will update the HOSTNAME of the server as well as per these entries.

jdk

This role install jdk1.7. Installation path – from group_vars/all with variable java_home.

ssh_known_hosts

This role will create ssh known hosts for all the hosts in the hosts file.

ssh_password_lss

This role will make hadoop_user passwordless user for hadoop nodes.

cdh5_hadoop_commons_tarball

This role will install and configure hadoop installation. Update files.
  1. core-site.xml Add Namenode.
  2. hdfs-site.xml Update hdfs parameters – default/main.yml.
  3. mapred-site.xml Update MR information.
  4. yarn-site.xml Update Yarn.
  5. slaves Update slaves information – hosts file.
  6. hadoop-env.sh Update JAVA_HOME – group_vars.

post_install_setups

This is hadoop user creation after installation. If we need more users then we need to add them in rolepost_install_setups.
Current we will create a user called stormadmin. More details inroles/post_install_setups/tasks/create_hadoop_user.yml
#
# Creating a Storm User on Namenode/ This will eventually be a edge node.
#
- hosts: namenodes
  remote_user: root
  roles:
    - post_install_setups

Step 1. Update below variables as per requirement.

Global Vars can be found in the location group_vars/all.
# --------------------------------------
# USERs
# --------------------------------------

hadoop_user: hdadmin
hadoop_group: hdadmin
hadoop_password: $6$rounds=40000$1qjG/hovLZOkcerH$http://ift.tt/1KhoXzH

# Common Location information.
common:
  install_base_path: /usr/local
  soft_link_base_path: /opt

Step 2. User information come from group_vars.

Username can be changed in the Global Vars, zookeeper_user. Currently the password ishdadmin@123
Password can be generated using the below python snippet.
# Password Generated using python command below.
python -c "from passlib.hash import sha512_crypt; import getpass; print sha512_crypt.encrypt(getpass.getpass())"
Here is the execution. After entering the password you will get the encrypted password which can be used in the user creation.
ahmed@ahmed-server ~]$ python -c "from passlib.hash import sha512_crypt; import getpass; print sha512_crypt.encrypt(getpass.getpass())"
Enter Password: *******
$6$rounds=40000$1qjG/hovLZOkcerH$http://ift.tt/1KhoXzH
ahmed@ahmed-server ~]$

Step 3. Update Host File.

IMPORTANT update contents of hosts file. In hosts file host_name is used to create the /etc/hostsfile.
#
# All pre-prod nodes. 
#
[allnodes]
10.10.18.30 host_name=ahmd-namenode
10.10.18.31 host_name=ahmd-datanode-01
10.10.18.32 host_name=ahmd-datanode-02
10.10.18.34 host_name=ahmd-resourcemanager
10.10.18.93 host_name=ahmd-secondary-namenode
10.10.18.94 host_name=ahmd-datanode-03
10.10.18.95 host_name=ahmd-datanode-04


# 
# hadoop cluster
#

[namenodes]
10.10.18.30

[secondarynamenode]
10.10.18.93

[resourcemanager]
10.10.18.34

[jobhistoryserver]
10.10.18.34

[datanodes]
10.10.18.31
10.10.18.32
10.10.18.94
10.10.18.95

[hadoopcluster:children]
namenodes
secondarynamenode
resourcemanager
jobhistoryserver
datanodes

#
# sshknown hosts list.
#

[sshknownhosts:children]
hadoopcluster

Step 4. Executing yml.

Execute below command.
ansible-playbook ansible_hadoop.yml -i hosts --ask-pass

from Blogger http://ift.tt/1FA0lkz
via IFTTT

Categories: Others Tags: ,

Ansible Playbook – Setup Storm Cluster

May 20, 2015 Leave a comment

Ansible Playbook – Setup Storm Cluster.

This is a simple Storm Cluster Setup. We are using a dedicated Zookeeper Cluster/Node, instead of the standalone zkserver. Below is how we will deploy our cluster.
                        / ---- supervisor01
Nimbus[nimbus and ui]----- 
                        \ ---- supervisor02

Before we start.

Download apache-storm-0.9.4.tar.gz to file_archives directory.
Download zookeeper-3.4.5-cdh5.1.2.tar.gz to file_archives directory.
Download jdk-7u75-linux-x64.tar.gz to file_archives directory.

Get the script from Github.

Below is the command to clone.
ahmed@ahmed-server ~]$ git clone http://ift.tt/1JXPMFH

Step 1: Update Hosts File.

Update the host file to reflect your server IPs. Currently hosts file looks as below.
[zookeepernodes]
10.10.18.11 zookeeper_id=1
10.10.18.12 zookeeper_id=2
10.10.18.13 zookeeper_id=3

#
# storm cluster
#

[stormnimbusnodes]
10.10.18.11

[stormsupervisornodes]
10.10.18.12
10.10.18.13

[stormcluster:children]
stormnimbusnodes
stormsupervisornodes

Step 2: Update group_vars information as required.

Update users/password and Directory information in group_vars/all file. Currently we have the below information.
# --------------------------------------
# USERs
# --------------------------------------

zookeeper_user: zkadmin
zookeeper_group: zkadmin
zookeeper_password: $6$rounds=40000$1qjG/hovLZOkcerH$http://ift.tt/1KhoXzH

storm_user: stormadmin
storm_group: stormadmin
storm_password: $6$rounds=40000$1qjG/hovLZOkcerH$http://ift.tt/1KhoXzH

# --------------------------------------
# STORM Variables
# --------------------------------------

storm_local_dir: /data/ansible/storm
storm_log_dir: /data/ansible/storm_logging


# --------------------------------------
# COMMON FOR INSTALL PATH
# --------------------------------------

# Common Location information.
common:
  install_base_path: /usr/local
  soft_link_base_path: /opt

Step 3: Update default information in default/main.yml.

Update the default values if required.

Step 4: Executing.

Below is the command.
ahmed@ahmed-server ansible_kafka_tarball]$ ansible-playbook ansible_storm.yml -i hosts --ask-pass

from Blogger http://ift.tt/1FsnTWy
via IFTTT

Categories: Others Tags: ,

Ansible Playbook – Setup Kafka Cluster.

May 19, 2015 Leave a comment

Ansible Playbook – Setup Kafka Cluster.

This is a simple Kafka setup. In this setup we are running kafka over a dedicated zookeeper service. (NOT the standalone zookeeper which comes with kafka)
Before we start read more information about Zookeeper/Kafka in the below link.
  1. Setup Zookeeper.
  2. Setup Kafka. Server running on ports 9091/9092 ports on each server.

Before we start.

Download kafka_2.9.2-0.8.2.1.tgz to file_archives directory.
Download zookeeper-3.4.5-cdh5.1.2.tar.gz to file_archives directory.

Get the script from Github.

Below is the command to clone.
ahmed@ahmed-server ~]$ git clone http://ift.tt/1c2en0u

Step 1: Update Hosts File.

Update the host file to reflect your server IPs. Currently hosts file looks as below.
[zookeepers]
10.10.18.10 zookeeper_id=1
10.10.18.12 zookeeper_id=2
10.10.18.13 zookeeper_id=3

[kafka-nodes]
10.10.18.10 kafka_broker_id1=11 kafka_port1=9091 kafka_broker_id2=12 kafka_port2=9092
10.10.18.12 kafka_broker_id1=13 kafka_port1=9091 kafka_broker_id2=14 kafka_port2=9092
10.10.18.13 kafka_broker_id1=15 kafka_port1=9091 kafka_broker_id2=16 kafka_port2=9092

Step 2: Update group_vars information as required.

Update users/password and Directory information in group_vars/all file. Currently we have the below information.
# --------------------------------------
# USERs
# --------------------------------------

zookeeper_user: zkadmin
zookeeper_group: zkadmin
zookeeper_password: $6$rounds=40000$1qjG/hovLZOkcerH$http://ift.tt/1KhoXzH

kafka_user: kafkaadmin
kafka_group: kafkaadmin
kafka_password: $6$rounds=40000$1qjG/hovLZOkcerH$http://ift.tt/1KhoXzH


# --------------------------------------
# COMMON FOR INSTALL PATH
# --------------------------------------

# Common Location information.
common:
  install_base_path: /usr/local
  soft_link_base_path: /opt

Step 3: Update default information in default/main.yml.

Update the default values if required.

Step 4: Executing.

Below is the command.
ahmed@ahmed-server ansible_kafka_tarball]$ ansible-playbook ansible_kafka.yml -i hosts --ask-pass

from Blogger http://ift.tt/1c2en0C
via IFTTT

Categories: Others Tags: ,

Ansible Playbook – Setup Zookeeper Using tarball.

May 19, 2015 Leave a comment

Ansible Playbook – Setup Zookeeper Using tarball.

This is a simple zookeeper playbook, to quickly start zookeeper running on a single or more nodes, in a clustered mode.
Here is the Script Location on Github: http://ift.tt/1KhoXzF
Below are the steps to get started.

Before we start.

Please download zookeeper-3.4.5-cdh5.1.2.tar.gz and store it in file_archives directory.**

Get the script from Github.

Below is the command to clone.
ahmed@ahmed-server ~]$ git clone http://ift.tt/1KhoXzF

Step 1. Update below variables as per requirement.

Variables are located in roles/zookeeper_install_tarball/default/main.yml.
# Zookeeper Version.
zookeeper_version: zookeeper-3.4.5-cdh5.1.2

# Zookeeper Storage and Logging.
zookeeper_data_store: /data/ansible/zookeeper
zookeeper_logging: /data/ansible/zookeeper_logging
Global Vars can be found in the location group_vars/all.
# --------------------------------------
# USERs
# --------------------------------------

zookeeper_user: zkadmin
zookeeper_group: zkadmin
zookeeper_password: $6$rounds=40000$1qjG/hovLZOkcerH$http://ift.tt/1KhoXzH

# Common Location information.
common:
  install_base_path: /usr/local
  soft_link_base_path: /opt

Step 2. User information come from global_vars.

Username can be changed in the Global Vars, zookeeper_user.
Currently the password is hdadmin@123
Password can be generated using the below python snippet.
# Password Generated using python command below.
python -c "from passlib.hash import sha512_crypt; import getpass; print sha512_crypt.encrypt(getpass.getpass())"
Here is the execution. After entering the password you will get the encrypted password which can be used in the user creation.
ahmed@ahmed-server ~]$ python -c "from passlib.hash import sha512_crypt; import getpass; print sha512_crypt.encrypt(getpass.getpass())"
Enter Password: *******
$6$rounds=40000$1qjG/hovLZOkcerH$http://ift.tt/1KhoXzH
ahmed@ahmed-server ~]$

Step 3. Update playbook.

Update file called ansible_zookeeper.yml (if required) with hosts file in root of the directory structure.
Below is the sample directory structure.
zookeeper.yml
hosts
global_vars
  --> all
file_archives
  --> zookeeper-3.4.5-cdh5.1.2.tar.gz
  --> ...
roles
  --> zookeeper_install_tarball
  --> ...
Below are the contents for ansible_zookeeper.yml
#
#-----------------------------
# ZOOKEEPER CLUSTER SETUP
#-----------------------------
#

- hosts: zookeepernodes
  remote_user: root
  roles:
    - zookeeper_install_tarball
Steps used in zookeeper_install_tarball role.
  1. Create a user to running zookeeper service. NOTE: user information in global_vars.
  2. Copy tgz file and extract in destination.
  3. Changing permission to directory, setting zookeeper_user as the new owner.
  4. Creating Symbolic link. NOTE: soft_link_base_path information in global_vars.
  5. Updating Configuration File in Zookeeper.
  6. Creating directory for Zookeeper.
  7. Initializing myid file for Zookeeper.
  8. Starting Zookeeper Service.
Here are the contents of hosts file.
In hosts file zookeeper_id will be used to create an id in myid file, for each zookeeper running as a cluster.
#
# zookeeper cluster
# 

[zookeepernodes]
10.10.18.25 zookeeper_id=1
10.10.18.87 zookeeper_id=2
10.10.18.90 zookeeper_id=3

Step 4. Executing yml.

Execute below command.
ansible-playbook ansible_zookeeper.yml -i hosts --ask-pass

‚Äč

from Blogger http://ift.tt/1JWexlG
via IFTTT

Categories: Others Tags: ,