You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ambari.apache.org by jbuy0710 <ju...@gmail.com> on 2013/06/10 04:41:17 UTC
get service content fail
Hi
I try the following command to get the information of service content
curl -u admin:admin -X GET -i
http://10.1.191.20:8080/api/v1/clusters/ambari5f/configurations?type=mapred-site&tag=version1
The expected result is
{
"href" : "
http://10.1.191.20:8080/api/v1/clusters/ambari5f/configurations?type=mapred-site&tag=version1
",
"items" : [
{
"href" : "
http://10.1.191.20:8080/api/v1/clusters/ambari5f/configurations?type=mapred-site&tag=version1
",
"tag" : "version1",
"type" : "mapred-site",
"Config" : {
"cluster_name" : "ambari5f"
},
"properties" : {
"mapred.reduce.tasks.speculative.execution" : "false",
"mapred.tasktracker.map.tasks.maximum" : "4",
"mapred.hosts.exclude" : "/etc/hadoop/mapred.exclude",
"mapreduce.tasktracker.group" : "hadoop",
.
.
.
But the result I got lost the property section.
{
"href" : "
http://10.1.191.20:8080/api/v1/clusters/ambari5f/configurations?type=mapred-site
",
"items" : [
{
"href" : "
http://10.1.191.20:8080/api/v1/clusters/ambari5f/configurations?type=mapred-site&tag=version1
",
"tag" : "version1",
"type" : "mapred-site",
"Config" : {
"cluster_name" : "ambari5f"
}
}
]
}
[1]+ Done curl -u admin:admin -X GET -i
http://10.1.191.20:8080/api/v1/clusters/ambari5f/configurations?type=mapred-site
The problem seems only occurs when getting service content using curl to
get the information.
I try to use the browser to get the information of configuration , and the
result is as expected.
Using the other command like the following will get the correct result, too.
curl -u admin:admin -X GET -i
http://10.1.191.20:8080/api/v1/clusters/ambari5f/services/HDFS/components/DATANODE
{
"href" : "
http://10.1.191.20:8080/api/v1/clusters/ambari5f/services/HDFS/components/DATANODE
",
"ServiceComponentInfo" : {
"cluster_name" : "ambari5f",
"component_name" : "DATANODE",
"state" : "STARTED",
"service_name" : "HDFS",
"desired_configs" : { }
},
"host_components" : [
{
"href" : "
http://10.1.191.20:8080/api/v1/clusters/ambari5f/hosts/ambariserver.ambari/host_components/DATANODE
",
"HostRoles" : {
"cluster_name" : "ambari5f",
"component_name" : "DATANODE",
"host_name" : "ambariserver.ambari"
}
}
]
Re: get service content fail
Posted by Mahadev Konar <ma...@hortonworks.com>.
Juby,
I think its mostly bash interpreting the &.
Just put single quotes around your url:
curl -u admin:admin -X GET -i *'*
http://10.1.191.20:8080/api/v1/clusters/ambari5f/configurations?type=mapred-site&tag=version1
*'*
* *The above should work.
mahadev
On Sun, Jun 9, 2013 at 7:41 PM, jbuy0710 <ju...@gmail.com> wrote:
> Hi
>
> I try the following command to get the information of service content
> curl -u admin:admin -X GET -i
> http://10.1.191.20:8080/api/v1/clusters/ambari5f/configurations?type=mapred-site&tag=version1
>
> The expected result is
>
> {
>
> "href" : "
> http://10.1.191.20:8080/api/v1/clusters/ambari5f/configurations?type=mapred-site&tag=version1
> ",
>
> "items" : [
>
> {
>
> "href" : "
> http://10.1.191.20:8080/api/v1/clusters/ambari5f/configurations?type=mapred-site&tag=version1
> ",
>
> "tag" : "version1",
>
> "type" : "mapred-site",
>
> "Config" : {
>
> "cluster_name" : "ambari5f"
>
> },
>
> "properties" : {
>
> "mapred.reduce.tasks.speculative.execution" : "false",
>
> "mapred.tasktracker.map.tasks.maximum" : "4",
>
> "mapred.hosts.exclude" : "/etc/hadoop/mapred.exclude",
>
> "mapreduce.tasktracker.group" : "hadoop",
>
> .
>
> .
>
> .
>
> But the result I got lost the property section.
>
> {
>
> "href" : "
> http://10.1.191.20:8080/api/v1/clusters/ambari5f/configurations?type=mapred-site
> ",
>
> "items" : [
>
> {
>
> "href" : "
> http://10.1.191.20:8080/api/v1/clusters/ambari5f/configurations?type=mapred-site&tag=version1
> ",
>
> "tag" : "version1",
>
> "type" : "mapred-site",
>
> "Config" : {
>
> "cluster_name" : "ambari5f"
>
> }
>
> }
>
> ]
>
> }
>
> [1]+ Done curl -u admin:admin -X GET -i
> http://10.1.191.20:8080/api/v1/clusters/ambari5f/configurations?type=mapred-site
>
>
>
> The problem seems only occurs when getting service content using curl to
> get the information.
>
> I try to use the browser to get the information of configuration , and
> the result is as expected.
>
> Using the other command like the following will get the correct result,
> too.
>
> curl -u admin:admin -X GET -i
> http://10.1.191.20:8080/api/v1/clusters/ambari5f/services/HDFS/components/DATANODE
>
> {
>
> "href" : "
> http://10.1.191.20:8080/api/v1/clusters/ambari5f/services/HDFS/components/DATANODE
> ",
>
> "ServiceComponentInfo" : {
>
> "cluster_name" : "ambari5f",
>
> "component_name" : "DATANODE",
>
> "state" : "STARTED",
>
> "service_name" : "HDFS",
>
> "desired_configs" : { }
>
> },
>
> "host_components" : [
>
> {
>
> "href" : "
> http://10.1.191.20:8080/api/v1/clusters/ambari5f/hosts/ambariserver.ambari/host_components/DATANODE
> ",
>
> "HostRoles" : {
>
> "cluster_name" : "ambari5f",
>
> "component_name" : "DATANODE",
>
> "host_name" : "ambariserver.ambari"
>
> }
>
> }
>
> ]
>
>