Using Ambari Blueprint to Provision HDP automatically

  1. Define the Blueprint
    {
        "configurations": [
            {
                "hdfs-site": {
                    "properties_attributes": {
                        "final": {
                            "dfs.namenode.http-address": "true",
                            "dfs.support.append": "true"
                        }
                    },
                    "properties": {
                        "dfs.namenode.name.dir": "/hadoop/hdfs/namenode",
                        "dfs.datanode.data.dir": "/hadoop/hdfs/data"
                    }
                }
            },
            {
                "yarn-site": {
                    "properties_attributes": {},
                    "properties": {
                        "yarn.nodemanager.local-dirs": "/hadoop/yarn/local",
                        "yarn.nodemanager.log-dirs": "/hadoop/yarn/log"
                    }
                }
            },
            {
                "ams-hbase-site" : {
                     "properties_attributes": {},
                     "properties" : {
                         "hbase.rootdir" : "file:///var/lib/ambari-metrics-collector/hbase"
                     }
                }
            }
        ],
        "host_groups": [
            {
                "components": [
               {
                 "name" : "NODEMANAGER"
               },
               {
                 "name" : "MAPREDUCE2_CLIENT"
               },
               {
                 "name" : "YARN_CLIENT"
               },
               {
                 "name" : "HDFS_CLIENT"
               },
               {
                 "name" : "ZOOKEEPER_SERVER"
               },
               {
                 "name" : "HBASE_REGIONSERVER"
               },
               {
                 "name" : "DATANODE"
               },
               {
                 "name" : "HBASE_CLIENT"
               },
               {
                 "name" : "METRICS_MONITOR"
               },
               {
                 "name" : "ZOOKEEPER_CLIENT"
               },
               {
                 "name" : "PHOENIX_QUERY_SERVER"
               }
                ],
                "configurations": [],
                "name": "host_group_2",
                "cardinality": "4"
            },
            {
                "components": [
            {
              "name" : "SECONDARY_NAMENODE"
            },
            {
              "name" : "HDFS_CLIENT"
            },
            {
              "name" : "ZOOKEEPER_SERVER"
            },
            {
              "name" : "HISTORYSERVER"
            },
            {
              "name" : "METRICS_MONITOR"
            },
            {
              "name" : "HBASE_MASTER"
            },
            {
              "name" : "NAMENODE"
            },
            {
              "name" : "APP_TIMELINE_SERVER"
            },
            {
              "name" : "METRICS_COLLECTOR"
            },
            {
              "name" : "RESOURCEMANAGER"
            }
                ],
                "configurations": [],
                "name": "host_group_1",
                "cardinality": "1"
            }
        ],
        "Blueprints": {
            "stack_name": "HDP",
            "stack_version": "2.3"
        }
    }

  2. Save the above as a JSON file, say "blueprint.json"
  3. Using curl to post the JSON file to Ambar Server
    root@master:~# curl -H "X-Requested-By: ambari" -u admin:admin -i -X POST http://${target_ip}:${target_node_port}/api/v1/blueprints/blue?validate_topology=false -d @$BLUEPRINT_PATH/blueprint.json
  4. If the above succeed, it returns status code 201.
  5. Define the host name of nodes
    {
      "blueprint" : "blue",
      "configurations" : [
      ],
      "host_groups" :[
        {
          "name" : "host_group_1", 
          "hosts" : [ 
            {
              "fqdn" : "amb1-svc-dev"
            }
          ]
        },
        {
          "name" : "host_group_2", 
          "hosts" : [ 
            {"fqdn":"amb2-svc-dev"},{"fqdn":"amb3-svc-dev"},{"fqdn":"amb4-svc-dev"}
          ]
        }
      ]
    }
  6. Save above as a JSON file, say "provision.json"
  7. Register the hosts with Ambari Server, and start to provision
    curl -H "X-Requested-By: ambari" -u admin:admin -i -X POST http://${target_ip}:${target_node_port}/api/v1/clusters/cluster -d @$BLUEPRINT_PATH/provision.json
  8. If above succeed, it returns 
    {
      "href" : "http://140.92.25.239:30654/api/v1/clusters/cluster/requests/1",
      "Requests" : {
        "id" : 1,
        "status" : "Accepted"
      }
    }
  9. Using the value of href to query the status of provisioning.
  10. The detail configurations can be retrieve by 
    http://${target_ip}:${target_port}/api/v1/clusters/${cluster_name}?format=blueprint








  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值