Skip to content

Instantly share code, notes, and snippets.

@tzolov
Last active December 22, 2015 04:18

Revisions

  1. tzolov revised this gist Oct 11, 2013. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion Vagrantfile
    Original file line number Diff line number Diff line change
    @@ -8,6 +8,9 @@ VAGRANTFILE_API_VERSION = "2"
    $phd_provision_script = <<SCRIPT
    #!/bin/bash
    # Install the packages required for all cluster and admin nodes
    yum -y install postgresql-devel nc expect ed ntp
    # Set timezone and run NTP (set to Europe - Amsterdam time).
    /etc/init.d/ntpd stop; mv /etc/localtime /etc/localtime.bak; ln -s /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime; /etc/init.d/ntpd start
    @@ -22,7 +25,6 @@ cat > /etc/hosts <<EOF
    EOF
    yum -y install postgresql-devel nc expect
    SCRIPT

    Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  2. tzolov revised this gist Sep 19, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Vagrantfile
    Original file line number Diff line number Diff line change
    @@ -76,11 +76,11 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
    pcc.vm.box = "CentOS-6.2-x86_64"
    pcc.vm.provider :virtualbox do |v|
    v.name = "pcc"
    v.customize ["modifyvm", :id, "--memory", "350"]
    v.customize ["modifyvm", :id, "--memory", "352"]
    end
    pcc.vm.provider "vmware_fusion" do |v|
    v.name = "pcc"
    v.vmx["memsize"] = "350"
    v.vmx["memsize"] = "352"
    end
    pcc.vm.hostname = "pcc.localdomain"
    pcc.vm.network :private_network, ip: "10.211.55.100"
  3. tzolov revised this gist Sep 6, 2013. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions Vagrantfile
    Original file line number Diff line number Diff line change
    @@ -12,10 +12,10 @@ $phd_provision_script = <<SCRIPT
    /etc/init.d/ntpd stop; mv /etc/localtime /etc/localtime.bak; ln -s /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime; /etc/init.d/ntpd start
    cat > /etc/hosts <<EOF
    127.0.0.1 localhost.localdomain localhost
    ::1 localhost6.localdomain6 localhost6
    127.0.0.1 localhost.localdomain localhost
    ::1 localhost6.localdomain6 localhost6
    10.211.55.100 pcc.localdomain pcc
    10.211.55.100 pcc.localdomain pcc
    10.211.55.101 phd1.localdomain phd1
    10.211.55.102 phd2.localdomain phd2
    10.211.55.103 phd3.localdomain phd3
  4. tzolov revised this gist Sep 6, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Vagrantfile
    Original file line number Diff line number Diff line change
    @@ -12,8 +12,8 @@ $phd_provision_script = <<SCRIPT
    /etc/init.d/ntpd stop; mv /etc/localtime /etc/localtime.bak; ln -s /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime; /etc/init.d/ntpd start
    cat > /etc/hosts <<EOF
    127.0.0.1 localhost.localdomain localhost
    ::1 localhost6.localdomain6 localhost6
    127.0.0.1 localhost.localdomain localhost
    ::1 localhost6.localdomain6 localhost6
    10.211.55.100 pcc.localdomain pcc
    10.211.55.101 phd1.localdomain phd1
  5. tzolov revised this gist Sep 6, 2013. 1 changed file with 68 additions and 63 deletions.
    131 changes: 68 additions & 63 deletions pcc_provision.sh
    Original file line number Diff line number Diff line change
    @@ -1,53 +1,59 @@
    #!/bin/bash

    # All configuration and installation steps applied here follow the PHD installation guide:
    # http://bitcast-a.v1.o1.sjc1.bitgravity.com/greenplum/pivotal-docs/PHD_10_Guide.pdf

    #
    # Note: The default pwd is /home/vagrant.

    #
    # Note: By default, Vagrant shares your project directory (that is the one with the Vagrantfile)
    # to the /vagrant directory in your guest VMs.
    #
    # Note: 'root' is the default user. You can not change the root user in the script. "$sudo su - gpadmin" will not work!
    # Use the inline syntax instead: "$su - -c "some command" gpadmin".

    # Sets the cluster name to be used in PCC (Pivotal Control Center)
    CLUSTER_NAME=PHD_C1

    # List of Hadoop services to be deployed with this installation.
    # Note: Hive is disabled because phd2 and ph3 VMs are configured with just 1GB of memory (Vagrantfile)! To enable Hive
    # increase the memory of the VMs to 2GB at least (edit Vagrantfile) and then add 'hive' to the $SERVICES variable.
    # Alternativly if you don't have enough physical memory then you can remove one VM (phd3 for example) and increase the memory
    # of the remaining VMs. For this you need to remove phd3 definition from the Vagrangfile and from the $MASTER_AND_SLAVES list.
    SERVICES=hdfs,yarn,pig,zookeeper,hbase,gpxf,hawq

    # Sets the dns name of the VM used as Master node for all Hadoop services (e.g. namenode, hawq master, jobtracker ...)
    # Note: Master node is not an Admin node (where PCC runs). By convention the Admin node is the pcc.localdomain.
    MASTER_NODE=phd1.localdomain

    # By default the HAWQ master is collocated with the other master services.
    HAWQ_MASTER=$MASTER_NODE

    # List of all Pivotal HD nodes in the cluster (including the master node)
    MASTER_AND_SLAVES=$MASTER_NODE,phd2.localdomain,phd3.localdomain

    # By default all nodes will be used as Hawq segment hosts. Edit the $HAWQ_SEGMENT_HOSTS variable to change this setup.
    HAWQ_SEGMENT_HOSTS=$MASTER_AND_SLAVES


    # Client node defaults to the MASTER node
    CLIENT_NODE=$MASTER_NODE

    # Root password required for creating gpadmin users on the cluster nodes.
    # (By default Vagrant creates 'vagrant' root user on every VM. The password is 'vagrant' - used below)
    ROOT_PASSWORD=vagrant

    # Non-empty password to be used for the gpadmin user. Required by the PHD installation.
    GPADMIN_PASSWORD=gpadmin

    echo "********************************************************************************"
    echo "* Prepare PCC (Pivotal Control Center) Perquisites "
    echo "********************************************************************************"

    # If missing try to download the Oracle JDK6 installation binary.
    if [ ! -f /vagrant/jdk-6u45-linux-x64-rpm.bin ];
    then
    cd /vagrant; wget --cookies=off --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" "http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-x64-rpm.bin"; cd ~
    fi

    # Ensure that all installation packages are available in the same folder where the 'vagrant up' is executed.
    [ ! -f /vagrant/jdk-6u45-linux-x64-rpm.bin ] && ( echo "Can not find jdk-6u45-linux-x64-rpm.bin in the vagrant startup directory"; exit 1 )
    [ ! -f /vagrant/PCC-2.0.1.84.121.163.x86_64.tar.gz ] && ( echo "Can not find PCC-2.0.1.84.121.163.x86_64.tar.gz in the vagrant startup directory"; exit 1 )
    @@ -58,123 +64,124 @@ then
    cd /vagrant; wget http://bitcast-a.v1.o1.sjc1.bitgravity.com/greenplum/pivotal-sw/PADS-1.1.0-8.tar.gz; cd ~
    fi
    # </HAWQ>

    # Disable security.
    sestatus; chkconfig iptables off; service iptables stop; service iptables status

    # Install required packages.
    yum -y install httpd mod_ssl postgresql postgresql-devel postgresql-server compat-readline5 createrepo sigar nc expect

    # Install Oracle Java 6 on PCC (e.g Admin) node.
    cp /vagrant/jdk-6u45-linux-x64-rpm.bin .; chmod a+x ./jdk-6u45-linux-x64-rpm.bin; sudo ./jdk-6u45-linux-x64-rpm.bin; java -version

    echo "********************************************************************************"
    echo "* Install PCC (Pivotal Control Center) "
    echo "********************************************************************************"

    service commander stop

    # Copy, uncompress and enter the PCC package folder
    cp /vagrant/PCC-2.0.1.84.121.163.x86_64.tar.gz* /home/vagrant/; tar --no-same-owner -xzvf ./PCC-2.0.1.84.121.163.x86_64.tar.gz; cd /home/vagrant/PCC-2.0.1.84

    tar --no-same-owner -xzvf /vagrant/PCC-2.0.1.84.121.163.x86_64.tar.gz --directory /home/vagrant/; cd /home/vagrant/PCC-2.0.1.84
    # Install PCC as root using root's login shell (Note: will not work without the '-' option)
    su - -c "cd /home/vagrant/PCC-2.0.1.84; ./install" root

    echo "********************************************************************************"
    echo "* Prepare Hosts for Cluster: $CLUSTER_NAME "
    echo "********************************************************************************"

    # Add Sun Java JDK RPM installer binary (jdk-6u45-linux-x64-rpm.bin). Will be installed on all cluster hosts automatically.
    # The JDK rpm file need to have execute permission. If the JDK version you have downloaded is only available as a .rpm file
    # (not as a Linux binary installer .bin file) you need to install the JDK by hand on all cluster nodes.
    su - -c "cp /vagrant/jdk-6u45-linux-x64-rpm.bin .; chmod a+x ./jdk-6u45-linux-x64-rpm.bin" gpadmin

    echo "Import PHD & PADS packages into the PCC local yum repository ..."

    # (Required) For installing PHD
    su - -c "cp /vagrant/PHD-1.0.1.0-19.tar.gz* .; tar -xzf ./PHD-1.0.1.0-19.tar.gz; icm_client import -p ./PHD-1.0.1.0-19" gpadmin

    su - -c "tar -xzf /vagrant/PHD-1.0.1.0-19.tar.gz --directory ~; icm_client import -p ./PHD-1.0.1.0-19" gpadmin
    # <<HAQW>>
    # Import HAWQ packages in the local yum repo
    su - -c "cp /vagrant/PADS-1.1.0-8.tar.gz* .; tar -xzf ./PADS-1.1.0-8.tar.gz; icm_client import -p ./PADS-1.1.0-8" gpadmin
    su - -c "tar -xzf /vagrant/PADS-1.1.0-8.tar.gz --directory ~; icm_client import -p ./PADS-1.1.0-8" gpadmin
    # <</HAWQ>>

    # (Optional) Import DataLoader and UUS installation packages
    #su - -c "cp /vagrant/PHDTools-1.0.1-19.tar.gz* .; tar -xzf ./PHDTools-1.0.1-19.tar.gz; icm_client import -p ./PHDTools-1.0.1-19" gpadmin

    #su - -c "tar -xzf /vagrant/PHDTools-1.0.1-19.tar.gz --directory ~; icm_client import -p ./PHDTools-1.0.1-19" gpadmin
    # Create a hostfile (HostFile.txt) that contains the hostnames of all cluster nodes (except pcc) separated by newlines.
    # Important: The hostfile should contain all nodes within your cluster EXCEPT the Admin node (e.g. except pcc.localdomain).
    su - -c "echo $MASTER_AND_SLAVES | tr , '\n' > /home/gpadmin/HostFile.txt" gpadmin

    echo "Prepare cluster hosts"

    # Preparing the Cluster Nodes for Pivotal HD
    # Note: preparehosts expects user inputs like root and gpadmin passwords. The 'expect' tool is used to emulate this user interaction.
    cat > /home/gpadmin/preparehosts.exp <<EOF
    #!/usr/bin/expect -f
    set timeout 100
    spawn icm_client preparehosts --hostfile=./HostFile.txt --java=jdk-6u45-linux-x64-rpm.bin --ntp --selinuxoff --iptablesoff
    expect "Please enter the root user's password. This is required for creating gpadmin users on the cluster nodes:"
    send -- "$ROOT_PASSWORD\r"
    expect "Please enter a non-empty password to be used for the gpadmin user:"
    send -- "$GPADMIN_PASSWORD\r"
    send -- "\r"
    expect eof
    EOF

    chown gpadmin:gpadmin /home/gpadmin/preparehosts.exp; chmod a+x /home/gpadmin/preparehosts.exp

    # Prepare all PHD hosts
    su - -c "expect -f /home/gpadmin/preparehosts.exp" gpadmin

    # <<HAWQ>>
    echo "Prepare HAWQ hosts"

    # Set vm.overcommit_memory to 1 to prevent OOM and other VM issues.
    sed -i 's/vm.overcommit_memory = 2/vm.overcommit_memory = 1/g' /usr/lib/gphd/gphdmgr/hawq_sys_config/sysctl.conf


    # Prepare all Hawq hosts. Asumes that HAWQ is deployed on all hosts.
    su - -c "icm_client prepare-hawq-hosts -f ./HostFile.txt -g /usr/lib/gphd/gphdmgr/hawq_sys_config/" gpadmin
    # <</HAWQ>>


    # Verify that all hosts are prepared for installation
    su - -c "icm_client scanhosts -f ./HostFile.txt" gpadmin

    echo "********************************************************************************"
    echo "* Deploy Cluster: $CLUSTER_NAME "
    echo "********************************************************************************"

    # Cluster is deployed as gpadmin user!

    # Pivotal HD manager deploys clusters using input from the cluster configuration directory. This cluster
    # configuration directory contains files that describes the topology and configuration for the cluster and the
    # installation procedure.

    # Fetch the default Cluster Configuration Templates.
    su - -c "icm_client fetch-template -o ~/ClusterConfigDir" gpadmin

    # Use the following mapping convention to assign cluster hosts to Hadoop service roles. All changes are
    # Use the following convention to assign cluster hosts to Hadoop service roles. All changes are
    # applied to the ~/ClusterConfigDir/clusterConfig.xml file, generated in the previous step.
    # Note: By default HAWQ_MASTER=MASTER_NODE, CLIENT_NODE=MASTER_NODE and HAWQ_SEGMENT_HOSTS=MASTER_AND_SLAVES
    # ---------------------------------------------------------------------------------------------------------
    # Hosts | Services
    # ---------------------------------------------------------------------------------------------------------
    # MASTER_NODE | client, namenode, secondarynameonde, yarn-resourcemanager, mapreduce-historyserver,
    # | hbase-master,hive-server,hive-metastore,hawq-master,hawq-standbymaste,hawq-segment,
    # | gpxf-agent
    # |
    # MASTER_AND_SLAVES | datanode,yarn-nodemanager,zookeeper-server,hbase-regionserver,hawq-segment,gpxf-agent
    # MASTER_AND_SLAVES | datanode,yarn-nodemanager,zookeeper-server,hbase-regionserver,hawq-segment,gpxf-agent
    # ---------------------------------------------------------------------------------------------------------

    # Apply the mapping convention (above) to the default clusterConfig.xml.
    sed -i "\
    s/<clusterName>.*<\/clusterName>/<clusterName>$CLUSTER_NAME<\/clusterName>/g;\
    s/<services>.*<\/services>/<services>$SERVICES<\/services>/g;\
    s/<client>.*<\/client>/<client>$MASTER_NODE<\/client>/g;\
    s/<client>.*<\/client>/<client>$CLIENT_NODE<\/client>/g;\
    s/<namenode>.*<\/namenode>/<namenode>$MASTER_NODE<\/namenode>/g;\
    s/<datanode>.*<\/datanode>/<datanode>$MASTER_AND_SLAVES<\/datanode>/g;\
    s/<secondarynamenode>.*<\/secondarynamenode>/<secondarynamenode>$MASTER_NODE<\/secondarynamenode>/g;\
    @@ -189,33 +196,31 @@ s/<hive-metastore>.*<\/hive-metastore>/<hive-metastore>$MASTER_NODE<\/hive-metas
    s/<hawq-master>.*<\/hawq-master>/<hawq-master>$HAWQ_MASTER<\/hawq-master>/g;\
    s/<hawq-standbymaster>.*<\/hawq-standbymaster>/<hawq-standbymaster>$HAWQ_MASTER<\/hawq-standbymaster>/g;\
    s/<hawq-segment>.*<\/hawq-segment>/<hawq-segment>$HAWQ_SEGMENT_HOSTS<\/hawq-segment>/g;" /home/gpadmin/ClusterConfigDir/clusterConfig.xml

    # Use ICM to perform the deploy
    su - -c "icm_client deploy -c ~/ClusterConfigDir" gpadmin

    # <<HAWQ>> post deploy configuration

    echo "********************************************************************************"
    echo "* HAWQ - post deploy configuration "
    echo "********************************************************************************"

    # <<HAWQ>>
    su - -c "echo $HAWQ_SEGMENT_HOSTS | tr , '\n' > /home/gpadmin/HAWQ_Segment_Hosts.txt" gpadmin

    su - -c "\
    scp /home/gpadmin/HAWQ_Segment_Hosts.txt gpadmin@$HAWQ_MASTER:/home/gpadmin/HAWQ_Segment_Hosts.txt;\
    ssh gpadmin@$HAWQ_MASTER 'source /usr/local/hawq/greenplum_path.sh;\
    /usr/local/hawq/bin/gpssh-exkeys -f /home/gpadmin/HAWQ_Segment_Hosts.txt -p $GPADMIN_PASSWORD'" gpadmin
    # <</HAWQ>>

    echo "********************************************************************************"
    echo "* Start Cluster: $CLUSTER_NAME "
    echo "********************************************************************************"

    su - -c "icm_client start -l $CLUSTER_NAME" gpadmin

    # <<HAWQ>>

    echo "********************************************************************************"
    echo "* Initialise HAWQ "
    echo "* Initialise HAWQ "
    echo "********************************************************************************"

    # <<HAWQ>>
    su - -c "ssh gpadmin@$HAWQ_MASTER '/etc/init.d/hawq init'" gpadmin;
    # <</HAWQ>>
  6. tzolov revised this gist Sep 5, 2013. 2 changed files with 45 additions and 33 deletions.
    2 changes: 1 addition & 1 deletion Vagrantfile
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ $phd_provision_script = <<SCRIPT
    cat > /etc/hosts <<EOF
    127.0.0.1 localhost.localdomain localhost
    ::1 localhost6.localdomain6 localhost6
    ::1 localhost6.localdomain6 localhost6
    10.211.55.100 pcc.localdomain pcc
    10.211.55.101 phd1.localdomain phd1
    76 changes: 44 additions & 32 deletions pcc_provision.sh
    Original file line number Diff line number Diff line change
    @@ -1,32 +1,41 @@
    #!/bin/bash

    # All configuraiton steps applied here follow the PHD installation guide:
    # All configuration and installation steps applied here follow the PHD installation guide:
    # http://bitcast-a.v1.o1.sjc1.bitgravity.com/greenplum/pivotal-docs/PHD_10_Guide.pdf

    # Note: The default pwd is /home/vagrant.

    # Note: 'root' is the default user. You can not change the root user in the script. "$sudo su - gpadmin" will not work!
    # Use the inline syntax instead: "$su - -c "some command" gpadmin".

    # Sets the cluster name to be used in PCC (Pivotal Control Center)
    CLUSTER_NAME=PHD_C1

    # Note that Hive is disabled. To enable Hive along with all other service you need at least 2GB memory per each node in the cluster.
    # Currently phd2 and phd3 are set to 1GB of memory due to my laptop has only 8GB memory.
    # If you have enough physical memory then set at phd2 and phd3 to 2048MB (see Vagrant) and add 'hive' to the SERVICES variable
    # If you do not have enough momeory then you can remove phd3 from yor cluster configuration: Comment it in Vagrangfile and
    # edit the MASTER_AND_SLAVES variable
    #SERVICES=hdfs,yarn,pig,zookeeper,hbase,gpxf,hawq

    # List of Hadoop services to be deployed with this installation.
    # Note: Hive is disabled because phd2 and ph3 VMs are configured with just 1GB of memory (Vagrantfile)! To enable Hive
    # increase the memory of the VMs to 2GB at least (edit Vagrantfile) and then add 'hive' to the $SERVICES variable.
    # Alternativly if you don't have enough physical memory then you can remove one VM (phd3 for example) and increase the memory
    # of the remaining VMs. For this you need to remove phd3 definition from the Vagrangfile and from the $MASTER_AND_SLAVES list.
    SERVICES=hdfs,yarn,pig,zookeeper,hbase,gpxf,hawq

    # Sets the dns name of the VM used as Master node for all Hadoop services (e.g. namenode, hawq master, jobtracker ...)
    # Note: Master node is not an Admin node (where PCC runs). By convention the Admin node is the pcc.localdomain.
    MASTER_NODE=phd1.localdomain

    # By default the HAWQ master is collocated with the other master services.
    HAWQ_MASTER=$MASTER_NODE

    # List of all Pivotal HD nodes in the cluster (including the master node)
    MASTER_AND_SLAVES=$MASTER_NODE,phd2.localdomain,phd3.localdomain

    # By default all nodes will be used as Hawq segment hosts. Edit the $HAWQ_SEGMENT_HOSTS variable to change this setup.
    HAWQ_SEGMENT_HOSTS=$MASTER_AND_SLAVES


    # Root password required for creating gpadmin users on the cluster nodes.
    # (By default Vagrant creates 'vagrant' root user on every VM. The password is 'vagrant' - used below)
    ROOT_PASSWORD=vagrant

    # Non-empty password to be used for the gpadmin user. Required by the PHD installation.
    GPADMIN_PASSWORD=gpadmin

    echo "********************************************************************************"
    @@ -36,13 +45,19 @@ echo "**************************************************************************
    # If missing try to download the Oracle JDK6 installation binary.
    if [ ! -f /vagrant/jdk-6u45-linux-x64-rpm.bin ];
    then
    cd /vagrant; wget -O jdk-6u45-linux-x64-rpm.bin --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" "http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-x64-rpm.bin" --no-check-certificate; cd ~
    cd /vagrant; wget --cookies=off --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" "http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-x64-rpm.bin"; cd ~
    fi

    # Ensure that all installation packages are available in the same folder where the 'vagrant up' is executed.
    [ ! -f /vagrant/jdk-6u45-linux-x64-rpm.bin ] && ( echo "Can not find jdk-6u45-linux-x64-rpm.bin in the vagrant startup directory"; exit 1 )
    [ ! -f /vagrant/PCC-2.0.1.84.121.163.x86_64.tar.gz ] && ( echo "Can not find PCC-2.0.1.84.121.163.x86_64.tar.gz in the vagrant startup directory"; exit 1 )
    [ ! -f /vagrant/PHD-1.0.1.0-19.tar.gz ] && ( echo "Can not find PHD-1.0.1.0-19.tar.gz in the vagrant startup directory"; exit 1 )
    # <HAWQ> If PADS (e.g. HAWQ) is not available locally, download it from the public distribution.
    if [ ! -f /vagrant/PADS-1.1.0-8.tar.gz ];
    then
    cd /vagrant; wget http://bitcast-a.v1.o1.sjc1.bitgravity.com/greenplum/pivotal-sw/PADS-1.1.0-8.tar.gz; cd ~
    fi
    # </HAWQ>

    # Disable security.
    sestatus; chkconfig iptables off; service iptables stop; service iptables status
    @@ -62,7 +77,7 @@ service commander stop
    # Copy, uncompress and enter the PCC package folder
    cp /vagrant/PCC-2.0.1.84.121.163.x86_64.tar.gz* /home/vagrant/; tar --no-same-owner -xzvf ./PCC-2.0.1.84.121.163.x86_64.tar.gz; cd /home/vagrant/PCC-2.0.1.84

    # Install PCC as root using root with root's login shell (Note: will not work without the '-' option)
    # Install PCC as root using root's login shell (Note: will not work without the '-' option)
    su - -c "cd /home/vagrant/PCC-2.0.1.84; ./install" root

    echo "********************************************************************************"
    @@ -79,20 +94,15 @@ echo "Import PHD & PADS packages into the PCC local yum repository ..."
    # (Required) For installing PHD
    su - -c "cp /vagrant/PHD-1.0.1.0-19.tar.gz* .; tar -xzf ./PHD-1.0.1.0-19.tar.gz; icm_client import -p ./PHD-1.0.1.0-19" gpadmin

    # <<HAWQ>> Import HAWQ packages
    # If not available locally yet, download the HAWQ from the public distribution URL
    if [ ! -f /vagrant/PADS-1.1.0-8.tar.gz ];
    then
    cd /vagrant; wget http://bitcast-a.v1.o1.sjc1.bitgravity.com/greenplum/pivotal-sw/PADS-1.1.0-8.tar.gz; cd ~
    fi
    # <<HAQW>>
    # Import HAWQ packages in the local yum repo
    su - -c "cp /vagrant/PADS-1.1.0-8.tar.gz* .; tar -xzf ./PADS-1.1.0-8.tar.gz; icm_client import -p ./PADS-1.1.0-8" gpadmin
    # <</HAWQ>>

    # (Optional) Import DataLoader and UUS installation packages
    #su - -c "cp /vagrant/PHDTools-1.0.1-19.tar.gz* .; tar -xzf ./PHDTools-1.0.1-19.tar.gz; icm_client import -p ./PHDTools-1.0.1-19" gpadmin

    # Create a hostfile (HostFile.txt) that contains the hostnames of all your cluster nodes except the Admin node; separated by newlines
    # Create a hostfile (HostFile.txt) that contains the hostnames of all cluster nodes (except pcc) separated by newlines.
    # Important: The hostfile should contain all nodes within your cluster EXCEPT the Admin node (e.g. except pcc.localdomain).
    su - -c "echo $MASTER_AND_SLAVES | tr , '\n' > /home/gpadmin/HostFile.txt" gpadmin

    @@ -139,23 +149,25 @@ echo "**************************************************************************
    echo "* Deploy Cluster: $CLUSTER_NAME "
    echo "********************************************************************************"

    # As gpadmin deploy the PHD cluster. Pivotal HD manager deploys clusters using input from the cluster
    # configuration directory. This cluster configuration directory contains files that describes the topology
    # and configuration for the cluster and the installation procedure.
    # Cluster is deployed as gpadmin user!

    # Pivotal HD manager deploys clusters using input from the cluster configuration directory. This cluster
    # configuration directory contains files that describes the topology and configuration for the cluster and the
    # installation procedure.

    # Fetch the default Cluster Configuration Templates.
    su - -c "icm_client fetch-template -o ~/ClusterConfigDir" gpadmin

    # The default clusterConfig.xml is modified to assign cluster hosts to Hadoop service roles.
    # Following mapping convention is applied:
    # Use the following mapping convention to assign cluster hosts to Hadoop service roles. All changes are
    # applied to the ~/ClusterConfigDir/clusterConfig.xml file, generated in the previous step.
    # ---------------------------------------------------------------------------------------------------------
    # Hosts | Services
    # ---------------------------------------------------------------------------------------------------------
    # MASTER_NODE | client, namenode, secondarynameonde, yarn-resourcemanager, mapreduce-historyserver,
    # | hbase-master,hive-server,hive-metastore,hawq-master,hawq-standbymaste,hawq-segment,
    # | gpxf-agent
    # |
    # MASTER_AND_SLAVES | datanode,yarn-nodemanager,zookeeper-server,hbase-regionserver,hawq-segment,gpxf-agent
    # MASTER_AND_SLAVES | datanode,yarn-nodemanager,zookeeper-server,hbase-regionserver,hawq-segment,gpxf-agent
    # ---------------------------------------------------------------------------------------------------------

    # Apply the mapping convention (above) to the default clusterConfig.xml.
    @@ -174,23 +186,23 @@ s/<hbase-master>.*<\/hbase-master>/<hbase-master>$MASTER_NODE<\/hbase-master>/g;
    s/<hbase-regionserver>.*<\/hbase-regionserver>/<hbase-regionserver>$MASTER_AND_SLAVES<\/hbase-regionserver>/g;\
    s/<hive-server>.*<\/hive-server>/<hive-server>$MASTER_NODE<\/hive-server>/g;\
    s/<hive-metastore>.*<\/hive-metastore>/<hive-metastore>$MASTER_NODE<\/hive-metastore>/g;\
    s/<hawq-master>.*<\/hawq-master>/<hawq-master>$MASTER_NODE<\/hawq-master>/g;\
    s/<hawq-standbymaster>.*<\/hawq-standbymaster>/<hawq-standbymaster>$MASTER_NODE<\/hawq-standbymaster>/g;\
    s/<hawq-master>.*<\/hawq-master>/<hawq-master>$HAWQ_MASTER<\/hawq-master>/g;\
    s/<hawq-standbymaster>.*<\/hawq-standbymaster>/<hawq-standbymaster>$HAWQ_MASTER<\/hawq-standbymaster>/g;\
    s/<hawq-segment>.*<\/hawq-segment>/<hawq-segment>$HAWQ_SEGMENT_HOSTS<\/hawq-segment>/g;" /home/gpadmin/ClusterConfigDir/clusterConfig.xml

    # Perform the deploy
    # Use ICM to perform the deploy
    su - -c "icm_client deploy -c ~/ClusterConfigDir" gpadmin

    # <<HAWQ>> post deploy configuration
    echo "********************************************************************************"
    echo "* HAWQ - post deploy configuration "
    echo "* HAWQ - post deploy configuration "
    echo "********************************************************************************"

    su - -c "echo $HAWQ_SEGMENT_HOSTS | tr , '\n' > /home/gpadmin/HAWQ_Segment_Hosts.txt" gpadmin

    su - -c "\
    scp /home/gpadmin/HAWQ_Segment_Hosts.txt gpadmin@$MASTER_NODE:/home/gpadmin/HAWQ_Segment_Hosts.txt;\
    ssh gpadmin@$MASTER_NODE 'source /usr/local/hawq/greenplum_path.sh;\
    scp /home/gpadmin/HAWQ_Segment_Hosts.txt gpadmin@$HAWQ_MASTER:/home/gpadmin/HAWQ_Segment_Hosts.txt;\
    ssh gpadmin@$HAWQ_MASTER 'source /usr/local/hawq/greenplum_path.sh;\
    /usr/local/hawq/bin/gpssh-exkeys -f /home/gpadmin/HAWQ_Segment_Hosts.txt -p $GPADMIN_PASSWORD'" gpadmin
    # <</HAWQ>>

    @@ -202,8 +214,8 @@ su - -c "icm_client start -l $CLUSTER_NAME" gpadmin

    # <<HAWQ>>
    echo "********************************************************************************"
    echo "* Start HAWQ "
    echo "* Initialise HAWQ "
    echo "********************************************************************************"

    su - -c "ssh gpadmin@$MASTER_NODE '/etc/init.d/hawq init'" gpadmin;
    su - -c "ssh gpadmin@$HAWQ_MASTER '/etc/init.d/hawq init'" gpadmin;
    # <</HAWQ>>
  7. tzolov revised this gist Sep 4, 2013. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions pcc_provision.sh
    Original file line number Diff line number Diff line change
    @@ -123,9 +123,9 @@ su - -c "expect -f /home/gpadmin/preparehosts.exp" gpadmin
    # <<HAWQ>>
    echo "Prepare HAWQ hosts"

    # Disable vm.overcommit_memory to prevent OOM. Pivotal recommends that you do not set the vm.overcommit_memory
    # parameter if you run HAWQ on small memory virtual machines. If you set this parameter you may encounter out of memory issues.
    sed -i 's/vm.overcommit_memory/# vm.overcommit_memory/g' /usr/lib/gphd/gphdmgr/hawq_sys_config/sysctl.conf
    # Set vm.overcommit_memory to 1 to prevent OOM and other VM issues.
    sed -i 's/vm.overcommit_memory = 2/vm.overcommit_memory = 1/g' /usr/lib/gphd/gphdmgr/hawq_sys_config/sysctl.conf


    # Prepare all Hawq hosts. Asumes that HAWQ is deployed on all hosts.
    su - -c "icm_client prepare-hawq-hosts -f ./HostFile.txt -g /usr/lib/gphd/gphdmgr/hawq_sys_config/" gpadmin
  8. tzolov revised this gist Sep 2, 2013. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions pcc_provision.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,8 @@
    #!/bin/bash

    # All configuraiton steps applied here follow the PHD installation guide:
    # http://bitcast-a.v1.o1.sjc1.bitgravity.com/greenplum/pivotal-docs/PHD_10_Guide.pdf

    # Note: The default pwd is /home/vagrant.

    # Note: 'root' is the default user. You can not change the root user in the script. "$sudo su - gpadmin" will not work!
  9. tzolov revised this gist Sep 2, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions pcc_provision.sh
    Original file line number Diff line number Diff line change
    @@ -148,8 +148,8 @@ su - -c "icm_client fetch-template -o ~/ClusterConfigDir" gpadmin
    # ---------------------------------------------------------------------------------------------------------
    # Hosts | Services
    # ---------------------------------------------------------------------------------------------------------
    # MASTER_NODE | client, namenode, secondarynameonde, yarn-resourcemanager, mapreduce-historyserver,
    # | hbase-master,hive-server,hive-metastore,hawq-master,hawq-standbymaste,hawq-segment,
    # MASTER_NODE | client, namenode, secondarynameonde, yarn-resourcemanager, mapreduce-historyserver,
    # | hbase-master,hive-server,hive-metastore,hawq-master,hawq-standbymaste,hawq-segment,
    # | gpxf-agent
    # |
    # MASTER_AND_SLAVES | datanode,yarn-nodemanager,zookeeper-server,hbase-regionserver,hawq-segment,gpxf-agent
  10. tzolov revised this gist Sep 2, 2013. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion pcc_provision.sh
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,13 @@

    CLUSTER_NAME=PHD_C1

    # hive
    # Note that Hive is disabled. To enable Hive along with all other service you need at least 2GB memory per each node in the cluster.
    # Currently phd2 and phd3 are set to 1GB of memory due to my laptop has only 8GB memory.
    # If you have enough physical memory then set at phd2 and phd3 to 2048MB (see Vagrant) and add 'hive' to the SERVICES variable
    # If you do not have enough momeory then you can remove phd3 from yor cluster configuration: Comment it in Vagrangfile and
    # edit the MASTER_AND_SLAVES variable
    #SERVICES=hdfs,yarn,pig,zookeeper,hbase,gpxf,hawq

    SERVICES=hdfs,yarn,pig,zookeeper,hbase,gpxf,hawq

    MASTER_NODE=phd1.localdomain
  11. tzolov created this gist Sep 2, 2013.
    91 changes: 91 additions & 0 deletions Vagrantfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,91 @@
    # -*- mode: ruby -*-
    # vi: set ft=ruby :

    # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
    VAGRANTFILE_API_VERSION = "2"

    # Embedded provisioning script common for all cluster hosts and PCC.
    $phd_provision_script = <<SCRIPT
    #!/bin/bash
    # Set timezone and run NTP (set to Europe - Amsterdam time).
    /etc/init.d/ntpd stop; mv /etc/localtime /etc/localtime.bak; ln -s /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime; /etc/init.d/ntpd start
    cat > /etc/hosts <<EOF
    127.0.0.1 localhost.localdomain localhost
    ::1 localhost6.localdomain6 localhost6
    10.211.55.100 pcc.localdomain pcc
    10.211.55.101 phd1.localdomain phd1
    10.211.55.102 phd2.localdomain phd2
    10.211.55.103 phd3.localdomain phd3
    EOF
    yum -y install postgresql-devel nc expect
    SCRIPT

    Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

    config.vm.define :phd1 do |phd1|
    phd1.vm.box = "CentOS-6.2-x86_64"
    phd1.vm.provider :virtualbox do |v|
    v.name = "phd1"
    v.customize ["modifyvm", :id, "--memory", "2048"]
    end
    phd1.vm.provider "vmware_fusion" do |v|
    v.name = "phd1"
    v.vmx["memsize"] = "2048"
    end
    phd1.vm.hostname = "phd1.localdomain"
    phd1.vm.network :private_network, ip: "10.211.55.101"
    phd1.vm.provision :shell, :inline => $phd_provision_script
    end

    config.vm.define :phd2 do |phd2|
    phd2.vm.box = "CentOS-6.2-x86_64"
    phd2.vm.provider :virtualbox do |v|
    v.name = "phd2"
    v.customize ["modifyvm", :id, "--memory", "1024"]
    end
    phd2.vm.provider "vmware_fusion" do |v|
    v.name = "phd2"
    v.vmx["memsize"] = "1024"
    end
    phd2.vm.hostname = "phd2.localdomain"
    phd2.vm.network :private_network, ip: "10.211.55.102"
    phd2.vm.provision :shell, :inline => $phd_provision_script
    end

    config.vm.define :phd3 do |phd3|
    phd3.vm.box = "CentOS-6.2-x86_64"
    phd3.vm.provider :virtualbox do |v|
    v.name = "phd3"
    v.customize ["modifyvm", :id, "--memory", "1024"]
    end
    phd3.vm.provider "vmware_fusion" do |v|
    v.name = "phd3"
    v.vmx["memsize"] = "1024"
    end
    phd3.vm.hostname = "phd3.localdomain"
    phd3.vm.network :private_network, ip: "10.211.55.103"
    phd3.vm.provision :shell, :inline => $phd_provision_script
    end

    config.vm.define :pcc do |pcc|
    pcc.vm.box = "CentOS-6.2-x86_64"
    pcc.vm.provider :virtualbox do |v|
    v.name = "pcc"
    v.customize ["modifyvm", :id, "--memory", "350"]
    end
    pcc.vm.provider "vmware_fusion" do |v|
    v.name = "pcc"
    v.vmx["memsize"] = "350"
    end
    pcc.vm.hostname = "pcc.localdomain"
    pcc.vm.network :private_network, ip: "10.211.55.100"
    pcc.vm.network :forwarded_port, guest: 5000, host: 5000
    pcc.vm.provision :shell, :inline => $phd_provision_script
    pcc.vm.provision :shell, :path => "pcc_provision.sh"
    end
    end
    200 changes: 200 additions & 0 deletions pcc_provision.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,200 @@
    #!/bin/bash

    # Note: The default pwd is /home/vagrant.

    # Note: 'root' is the default user. You can not change the root user in the script. "$sudo su - gpadmin" will not work!
    # Use the inline syntax instead: "$su - -c "some command" gpadmin".

    CLUSTER_NAME=PHD_C1

    # hive
    SERVICES=hdfs,yarn,pig,zookeeper,hbase,gpxf,hawq

    MASTER_NODE=phd1.localdomain

    MASTER_AND_SLAVES=$MASTER_NODE,phd2.localdomain,phd3.localdomain

    HAWQ_SEGMENT_HOSTS=$MASTER_AND_SLAVES

    ROOT_PASSWORD=vagrant

    GPADMIN_PASSWORD=gpadmin

    echo "********************************************************************************"
    echo "* Prepare PCC (Pivotal Control Center) Perquisites "
    echo "********************************************************************************"

    # If missing try to download the Oracle JDK6 installation binary.
    if [ ! -f /vagrant/jdk-6u45-linux-x64-rpm.bin ];
    then
    cd /vagrant; wget -O jdk-6u45-linux-x64-rpm.bin --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" "http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-x64-rpm.bin" --no-check-certificate; cd ~
    fi

    # Ensure that all installation packages are available in the same folder where the 'vagrant up' is executed.
    [ ! -f /vagrant/jdk-6u45-linux-x64-rpm.bin ] && ( echo "Can not find jdk-6u45-linux-x64-rpm.bin in the vagrant startup directory"; exit 1 )
    [ ! -f /vagrant/PCC-2.0.1.84.121.163.x86_64.tar.gz ] && ( echo "Can not find PCC-2.0.1.84.121.163.x86_64.tar.gz in the vagrant startup directory"; exit 1 )
    [ ! -f /vagrant/PHD-1.0.1.0-19.tar.gz ] && ( echo "Can not find PHD-1.0.1.0-19.tar.gz in the vagrant startup directory"; exit 1 )

    # Disable security.
    sestatus; chkconfig iptables off; service iptables stop; service iptables status

    # Install required packages.
    yum -y install httpd mod_ssl postgresql postgresql-devel postgresql-server compat-readline5 createrepo sigar nc expect

    # Install Oracle Java 6 on PCC (e.g Admin) node.
    cp /vagrant/jdk-6u45-linux-x64-rpm.bin .; chmod a+x ./jdk-6u45-linux-x64-rpm.bin; sudo ./jdk-6u45-linux-x64-rpm.bin; java -version

    echo "********************************************************************************"
    echo "* Install PCC (Pivotal Control Center) "
    echo "********************************************************************************"

    service commander stop

    # Copy, uncompress and enter the PCC package folder
    cp /vagrant/PCC-2.0.1.84.121.163.x86_64.tar.gz* /home/vagrant/; tar --no-same-owner -xzvf ./PCC-2.0.1.84.121.163.x86_64.tar.gz; cd /home/vagrant/PCC-2.0.1.84

    # Install PCC as root using root with root's login shell (Note: will not work without the '-' option)
    su - -c "cd /home/vagrant/PCC-2.0.1.84; ./install" root

    echo "********************************************************************************"
    echo "* Prepare Hosts for Cluster: $CLUSTER_NAME "
    echo "********************************************************************************"

    # Add Sun Java JDK RPM installer binary (jdk-6u45-linux-x64-rpm.bin). Will be installed on all cluster hosts automatically.
    # The JDK rpm file need to have execute permission. If the JDK version you have downloaded is only available as a .rpm file
    # (not as a Linux binary installer .bin file) you need to install the JDK by hand on all cluster nodes.
    su - -c "cp /vagrant/jdk-6u45-linux-x64-rpm.bin .; chmod a+x ./jdk-6u45-linux-x64-rpm.bin" gpadmin

    echo "Import PHD & PADS packages into the PCC local yum repository ..."

    # (Required) For installing PHD
    su - -c "cp /vagrant/PHD-1.0.1.0-19.tar.gz* .; tar -xzf ./PHD-1.0.1.0-19.tar.gz; icm_client import -p ./PHD-1.0.1.0-19" gpadmin

    # <<HAWQ>> Import HAWQ packages
    # If not available locally yet, download the HAWQ from the public distribution URL
    if [ ! -f /vagrant/PADS-1.1.0-8.tar.gz ];
    then
    cd /vagrant; wget http://bitcast-a.v1.o1.sjc1.bitgravity.com/greenplum/pivotal-sw/PADS-1.1.0-8.tar.gz; cd ~
    fi
    # Import HAWQ packages in the local yum repo
    su - -c "cp /vagrant/PADS-1.1.0-8.tar.gz* .; tar -xzf ./PADS-1.1.0-8.tar.gz; icm_client import -p ./PADS-1.1.0-8" gpadmin
    # <</HAWQ>>

    # (Optional) Import DataLoader and UUS installation packages
    #su - -c "cp /vagrant/PHDTools-1.0.1-19.tar.gz* .; tar -xzf ./PHDTools-1.0.1-19.tar.gz; icm_client import -p ./PHDTools-1.0.1-19" gpadmin

    # Create a hostfile (HostFile.txt) that contains the hostnames of all your cluster nodes except the Admin node; separated by newlines
    # Important: The hostfile should contain all nodes within your cluster EXCEPT the Admin node (e.g. except pcc.localdomain).
    su - -c "echo $MASTER_AND_SLAVES | tr , '\n' > /home/gpadmin/HostFile.txt" gpadmin

    echo "Prepare cluster hosts"

    # Preparing the Cluster Nodes for Pivotal HD
    # Note: preparehosts expects user inputs like root and gpadmin passwords. The 'expect' tool is used to emulate this user interaction.
    cat > /home/gpadmin/preparehosts.exp <<EOF
    #!/usr/bin/expect -f
    set timeout 100
    spawn icm_client preparehosts --hostfile=./HostFile.txt --java=jdk-6u45-linux-x64-rpm.bin --ntp --selinuxoff --iptablesoff
    expect "Please enter the root user's password. This is required for creating gpadmin users on the cluster nodes:"
    send -- "$ROOT_PASSWORD\r"
    expect "Please enter a non-empty password to be used for the gpadmin user:"
    send -- "$GPADMIN_PASSWORD\r"
    send -- "\r"
    expect eof
    EOF

    chown gpadmin:gpadmin /home/gpadmin/preparehosts.exp; chmod a+x /home/gpadmin/preparehosts.exp

    # Prepare all PHD hosts
    su - -c "expect -f /home/gpadmin/preparehosts.exp" gpadmin

    # <<HAWQ>>
    echo "Prepare HAWQ hosts"

    # Disable vm.overcommit_memory to prevent OOM. Pivotal recommends that you do not set the vm.overcommit_memory
    # parameter if you run HAWQ on small memory virtual machines. If you set this parameter you may encounter out of memory issues.
    sed -i 's/vm.overcommit_memory/# vm.overcommit_memory/g' /usr/lib/gphd/gphdmgr/hawq_sys_config/sysctl.conf

    # Prepare all Hawq hosts. Asumes that HAWQ is deployed on all hosts.
    su - -c "icm_client prepare-hawq-hosts -f ./HostFile.txt -g /usr/lib/gphd/gphdmgr/hawq_sys_config/" gpadmin
    # <</HAWQ>>


    # Verify that all hosts are prepared for installation
    su - -c "icm_client scanhosts -f ./HostFile.txt" gpadmin

    echo "********************************************************************************"
    echo "* Deploy Cluster: $CLUSTER_NAME "
    echo "********************************************************************************"

    # As gpadmin deploy the PHD cluster. Pivotal HD manager deploys clusters using input from the cluster
    # configuration directory. This cluster configuration directory contains files that describes the topology
    # and configuration for the cluster and the installation procedure.

    # Fetch the default Cluster Configuration Templates.
    su - -c "icm_client fetch-template -o ~/ClusterConfigDir" gpadmin

    # The default clusterConfig.xml is modified to assign cluster hosts to Hadoop service roles.
    # Following mapping convention is applied:
    # ---------------------------------------------------------------------------------------------------------
    # Hosts | Services
    # ---------------------------------------------------------------------------------------------------------
    # MASTER_NODE | client, namenode, secondarynameonde, yarn-resourcemanager, mapreduce-historyserver,
    # | hbase-master,hive-server,hive-metastore,hawq-master,hawq-standbymaste,hawq-segment,
    # | gpxf-agent
    # |
    # MASTER_AND_SLAVES | datanode,yarn-nodemanager,zookeeper-server,hbase-regionserver,hawq-segment,gpxf-agent
    # ---------------------------------------------------------------------------------------------------------

    # Apply the mapping convention (above) to the default clusterConfig.xml.
    sed -i "\
    s/<clusterName>.*<\/clusterName>/<clusterName>$CLUSTER_NAME<\/clusterName>/g;\
    s/<services>.*<\/services>/<services>$SERVICES<\/services>/g;\
    s/<client>.*<\/client>/<client>$MASTER_NODE<\/client>/g;\
    s/<namenode>.*<\/namenode>/<namenode>$MASTER_NODE<\/namenode>/g;\
    s/<datanode>.*<\/datanode>/<datanode>$MASTER_AND_SLAVES<\/datanode>/g;\
    s/<secondarynamenode>.*<\/secondarynamenode>/<secondarynamenode>$MASTER_NODE<\/secondarynamenode>/g;\
    s/<yarn-resourcemanager>.*<\/yarn-resourcemanager>/<yarn-resourcemanager>$MASTER_NODE<\/yarn-resourcemanager>/g;\
    s/<yarn-nodemanager>.*<\/yarn-nodemanager>/<yarn-nodemanager>$MASTER_AND_SLAVES<\/yarn-nodemanager>/g;\
    s/<mapreduce-historyserver>.*<\/mapreduce-historyserver>/<mapreduce-historyserver>$MASTER_NODE<\/mapreduce-historyserver>/g;\
    s/<zookeeper-server>.*<\/zookeeper-server>/<zookeeper-server>$MASTER_AND_SLAVES<\/zookeeper-server>/g;\
    s/<hbase-master>.*<\/hbase-master>/<hbase-master>$MASTER_NODE<\/hbase-master>/g;\
    s/<hbase-regionserver>.*<\/hbase-regionserver>/<hbase-regionserver>$MASTER_AND_SLAVES<\/hbase-regionserver>/g;\
    s/<hive-server>.*<\/hive-server>/<hive-server>$MASTER_NODE<\/hive-server>/g;\
    s/<hive-metastore>.*<\/hive-metastore>/<hive-metastore>$MASTER_NODE<\/hive-metastore>/g;\
    s/<hawq-master>.*<\/hawq-master>/<hawq-master>$MASTER_NODE<\/hawq-master>/g;\
    s/<hawq-standbymaster>.*<\/hawq-standbymaster>/<hawq-standbymaster>$MASTER_NODE<\/hawq-standbymaster>/g;\
    s/<hawq-segment>.*<\/hawq-segment>/<hawq-segment>$HAWQ_SEGMENT_HOSTS<\/hawq-segment>/g;" /home/gpadmin/ClusterConfigDir/clusterConfig.xml

    # Perform the deploy
    su - -c "icm_client deploy -c ~/ClusterConfigDir" gpadmin

    # <<HAWQ>> post deploy configuration
    echo "********************************************************************************"
    echo "* HAWQ - post deploy configuration "
    echo "********************************************************************************"

    su - -c "echo $HAWQ_SEGMENT_HOSTS | tr , '\n' > /home/gpadmin/HAWQ_Segment_Hosts.txt" gpadmin

    su - -c "\
    scp /home/gpadmin/HAWQ_Segment_Hosts.txt gpadmin@$MASTER_NODE:/home/gpadmin/HAWQ_Segment_Hosts.txt;\
    ssh gpadmin@$MASTER_NODE 'source /usr/local/hawq/greenplum_path.sh;\
    /usr/local/hawq/bin/gpssh-exkeys -f /home/gpadmin/HAWQ_Segment_Hosts.txt -p $GPADMIN_PASSWORD'" gpadmin
    # <</HAWQ>>

    echo "********************************************************************************"
    echo "* Start Cluster: $CLUSTER_NAME "
    echo "********************************************************************************"

    su - -c "icm_client start -l $CLUSTER_NAME" gpadmin

    # <<HAWQ>>
    echo "********************************************************************************"
    echo "* Start HAWQ "
    echo "********************************************************************************"

    su - -c "ssh gpadmin@$MASTER_NODE '/etc/init.d/hawq init'" gpadmin;
    # <</HAWQ>>