Hi guys,

I have a problem when I updating config group using ambari REST API call.

Problem: The config group can’t  update in existing cluster when I using ambari 
REST API call.

Following is the REST API call details:

1. Info of config_group before updating it using REST API call:
{
  "href" : 
"https://wdc-vhadp-pub2-dhcp-72-204.eng.vmware.com:8443/api/v1/clusters/am_1/config_groups/19";,
  "ConfigGroup" : {
    "cluster_name" : "am_1",
    "description" : "Host Group Configuration",
    "desired_configs" : [
      {
        "tag" : "version1429860457538",
        "type" : "hdfs-site",
        "href" : 
"https://wdc-vhadp-pub2-dhcp-72-204.eng.vmware.com:8443/api/v1/clusters/am_1/configurations?type=hdfs-site&tag=version1429860457538";
      }
    ],
    "group_name" : "am_1-worker-0",
    "hosts" : [
      {
        "host_name" : "wdc-vhadp-pub2-dhcp-72-158.eng.vmware.com",
        "href" : 
"https://wdc-vhadp-pub2-dhcp-72-204.eng.vmware.com:8443/api/v1/clusters/am_1/hosts/wdc-vhadp-pub2-dhcp-72-158.eng.vmware.com";
      }
    ],
    "id" : 19,
    "tag" : "HDFS"
  }
}

{
  "href" : 
"https://wdc-vhadp-pub2-dhcp-72-204.eng.vmware.com:8443/api/v1/clusters/am_1/configurations?type=hdfs-site&tag=version1429860457538";,
  "items" : [
    {
      "href" : 
"https://wdc-vhadp-pub2-dhcp-72-204.eng.vmware.com:8443/api/v1/clusters/am_1/configurations?type=hdfs-site&tag=version1429860457538";,
      "tag" : "version1429860457538",
      "type" : "hdfs-site",
      "version" : 9,
      "Config" : {
        "cluster_name" : "am_1"
      },
      "properties" : {
        "dfs.datanode.data.dir" : 
"/mnt/data0/hdfs/data,/mnt/data1/hdfs/data,/mnt/data2/hdfs/data,/mnt/data3/hdfs/data,/mnt/data4/hdfs/data,/mnt/data5/hdfs/data,/mnt/data6/hdfs/data"
      }
    }
  ]
}

2. Update config_group using REST API call.

curl -H  "X-Requested-By: ambari" -H "Content-Type: application/xml" -X PUT -d 
"@config_group" --user "admin:admin" -i 
https://wdc-vhadp-pub2-dhcp-72-204.eng.vmware.com:8443/api/v1/clusters/am_1/config_groups/19
 --cacert wdc-vhadp-pub2-dhcp-72-204.eng.vmware.com.crt

HTTP/1.1 200 OK

Set-Cookie: AMBARISESSIONID=12njnx2g1b16d2ge9pfooryrv;Path=/

Expires: Thu, 01 Jan 1970 00:00:00 GMT

Content-Type: text/plain

Content-Length: 0

Server: Jetty(7.6.7.v20120910)


cat config_group

[{"ConfigGroup":{"id":19,"cluster_name":"am_1","group_name":"am_1-worker-0","tag":"HDFS","description":"Host
 Group 
Configuration","hosts":[{"host_name":"wdc-vhadp-pub2-dhcp-72-158.eng.vmware.com"}],"service_config_version_note":"","desired_configs":[{"type":"hdfs-site","tag":"version1429860457538","properties":{"dfs.datanode.data.dir":"/mnt/data4/hdfs/data,/mnt/data5/hdfs/data,/mnt/data6/hdfs/data"}}]}}]



3. Info of config_group after updating it using REST API call:

{
  "href" : 
"https://wdc-vhadp-pub2-dhcp-72-204.eng.vmware.com:8443/api/v1/clusters/am_1/config_groups/19";,
  "ConfigGroup" : {
    "cluster_name" : "am_1",
    "description" : "Host Group Configuration",
    "desired_configs" : [
      {
        "tag" : "version1429860457538",
        "type" : "hdfs-site",
        "href" : 
"https://wdc-vhadp-pub2-dhcp-72-204.eng.vmware.com:8443/api/v1/clusters/am_1/configurations?type=hdfs-site&tag=version1429860457538";
      }
    ],
    "group_name" : "am_1-worker-0",
    "hosts" : [
      {
        "host_name" : "wdc-vhadp-pub2-dhcp-72-158.eng.vmware.com",
        "href" : 
"https://wdc-vhadp-pub2-dhcp-72-204.eng.vmware.com:8443/api/v1/clusters/am_1/hosts/wdc-vhadp-pub2-dhcp-72-158.eng.vmware.com";
      }
    ],
    "id" : 19,
    "tag" : "HDFS"
  }
}

{
  "href" : 
"https://wdc-vhadp-pub2-dhcp-72-204.eng.vmware.com:8443/api/v1/clusters/am_1/configurations?type=hdfs-site&tag=version1429860457538";,
  "items" : [
    {
      "href" : 
"https://wdc-vhadp-pub2-dhcp-72-204.eng.vmware.com:8443/api/v1/clusters/am_1/configurations?type=hdfs-site&tag=version1429860457538";,
      "tag" : "version1429860457538",
      "type" : "hdfs-site",
      "version" : 9,
      "Config" : {
        "cluster_name" : "am_1"
      },
      "properties" : {
        "dfs.datanode.data.dir" : 
"/mnt/data0/hdfs/data,/mnt/data1/hdfs/data,/mnt/data2/hdfs/data,/mnt/data3/hdfs/data,/mnt/data4/hdfs/data,/mnt/data5/hdfs/data,/mnt/data6/hdfs/data"
      }
    }
  ]
}


The response of REST API call is 200 OK, but the config_group info is still old 
one. Can you tell me How to update config group of existing cluster and make it 
effective using ambari REST API call?

Thanks,
-qing

Reply via email to