- 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" } }
- Save the above as a JSON file, say "blueprint.json"
- 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
- If the above succeed, it returns status code 201.
- 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"} ] } ] }
- Save above as a JSON file, say "provision.json"
- 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
- If above succeed, it returns
{ "href" : "http://140.92.25.239:30654/api/v1/clusters/cluster/requests/1", "Requests" : { "id" : 1, "status" : "Accepted" } }
- Using the value of href to query the status of provisioning.
- The detail configurations can be retrieve by
http://${target_ip}:${target_port}/api/v1/clusters/${cluster_name}?format=blueprint
Using Ambari Blueprint to Provision HDP automatically
最新推荐文章于 2022-04-24 11:24:11 发布