Requesting list of service config versions
Information about service config versions can be requested via separate API endpoint api/v1/clusters/<cluster_name>/configurations/service_config_versions.
Response will contain list of service config version objects. General API functionality like pagination, filtering, etc. can be applied to this list as well.
[root@c6401 ~]# curl -u admin:admin -H 'X-Requested-By:admin' 'http://localhost:8080/api/v1/clusters/cc/configuratons/service_config_versions' { "href" : "http://localhost:8080/api/v1/clusters/cc/configurations/service_config_versions", "items" : [ { "href" : "http://localhost:8080/api/v1/clusters/cc/configurations/service_config_versions?service_name=HDFS&service_config_version=1", "cluster_name" : "cc", "configurations" : [...], "createtime" : 1430922079860, "group_id" : -1, "group_name" : "default", "hosts" : [ ], "is_cluster_compatible" : true, "is_current" : true, "service_config_version" : 1, "service_config_version_note" : "Initial configurations for HDFS", "service_name" : "HDFS", "stack_id" : "HDP-2.2", "user" : "admin" }, { "href" : "http://localhost:8080/api/v1/clusters/cc/configurations/service_config_versions?service_name=MAPREDUCE2&service_config_version=1", "cluster_name" : "cc", "configurations" : [...], "createtime" : 1430922080448, "group_id" : -1, "group_name" : "default", "hosts" : [ ], "is_cluster_compatible" : true, "is_current" : true, "service_config_version" : 1, "service_config_version_note" : "Initial configurations for MapReduce2", "service_name" : "MAPREDUCE2", "stack_id" : "HDP-2.2", "user" : "admin" }, { "href" : "http://localhost:8080/api/v1/clusters/cc/configurations/service_config_versions?service_name=YARN&service_config_version=1", "cluster_name" : "cc", "configurations" : [...], "createtime" : 1430922080177, "group_id" : -1, "group_name" : "default", "hosts" : [ ], "is_cluster_compatible" : true, "is_current" : true, "service_config_version" : 1, "service_config_version_note" : "Initial configurations for YARN", "service_name" : "YARN", "stack_id" : "HDP-2.2", "user" : "admin" }, { "href" : "http://localhost:8080/api/v1/clusters/cc/configurations/service_config_versions?service_name=ZOOKEEPER&service_config_version=1", "cluster_name" : "cc", "configurations" : [...], "createtime" : 1430922080347, "group_id" : -1, "group_name" : "default", "hosts" : [ ], "is_cluster_compatible" : true, "is_current" : true, "service_config_version" : 1, "service_config_version_note" : "Initial configurations for ZooKeeper", "service_name" : "ZOOKEEPER", "stack_id" : "HDP-2.2", "user" : "admin" } ] }
Description of fields:
configurations - contains list of configs related to this service config version
createtime - timestamp indicating when service config version was created
group_id and group_name - id and name of config group for which service config version was created. -1 indicates default one (theres no group from server point of view)
hosts - also related to config groups - list of hosts in _cg
is_current - indicates if service config version is currently active (its configs are used for service)
service_config_version - number of service config version (per-service numeration)
service_config_version_note - user comment left on service config version creation
service_name - name of service which service config version is related to
Creating service config version
Service config version is created each time config is mapped to cluster:
curl -u admin:admin -H 'X-Requested-By:admin' -X PUT 'http://localhost:8080/api/v1/clusters/cc' -d '{ "Clusters": { "desired_config": { "type": "core-site", "tag": "version2", "properties": { "security.admin.operations.protocol.acl" : "hadoop", "security.client.datanode.protocol.acl" : "*", "security.client.protocol.acl" : "*", "security.datanode.protocol.acl" : "*", "security.inter.datanode.protocol.acl" : "*", "security.inter.tracker.protocol.acl" : "*", "security.job.client.protocol.acl" : "*", "security.job.task.protocol.acl" : "*", "security.namenode.protocol.acl" : "*", "security.refresh.policy.protocol.acl" : "hadoop", "security.refresh.usertogroups.mappings.protocol.acl" : "hadoop" } } } }'
Information containing id and service_name of service config version created will be returned in response
{ "resources" : [ { "href" : "http://localhost:8080/api/v1/clusters/cc/configurations/service_config_versions?service_name=HDFS&service_config_version=2", "configurations" : [ { "clusterName" : "cc", "stackId" : { "stackName" : "HDP", "stackVersion" : "2.2", "stackId" : "HDP-2.2" }, "type" : "core-site", "versionTag" : "version2", "version" : 2, "serviceConfigVersions" : null, "configs" : { "security.inter.datanode.protocol.acl" : "*", "security.refresh.usertogroups.mappings.protocol.acl" : "hadoop", "security.client.datanode.protocol.acl" : "*", "security.admin.operations.protocol.acl" : "hadoop", "security.inter.tracker.protocol.acl" : "*", "security.datanode.protocol.acl" : "*", "security.job.client.protocol.acl" : "*", "security.client.protocol.acl" : "*", "security.job.task.protocol.acl" : "*", "security.refresh.policy.protocol.acl" : "hadoop", "security.namenode.protocol.acl" : "*" }, "configAttributes" : { } } ], "group_id" : -1, "group_name" : null, "service_config_version" : 2, "service_config_version_note" : null, "service_name" : "HDFS" } ] }
Rollback to previous service config version
curl -u admin:admin -H 'X-Requested-By:admin' -X PUT 'http://localhost:8080/api/v1/clusters/cc' -d '{ "Clusters": { "desired_service_config_versions": { "service_name" : "HDFS", "service_config_version" : 1, "service_config_version_note" : "Manual rollback to service config version 1 (HDFS)" } } }'
Result of such request execution will be new service config version with configs copied from requested one (1st in this example)
{ "resources" : [ { "href" : "http://localhost:8080/api/v1/clusters/cc/configurations/service_config_versions?service_name=HDFS&service_config_version=3", "group_id" : -1, "group_name" : "default", "service_config_version" : 3, "service_config_version_note" : "Manual rollback to service config version 1 (HDFS)", "service_name" : "HDFS" } ] }
Requesting currently active service config versions
Service config versions which are currently used can be requested via service_config_versions endpoint using filtering by is_current field
curl -u admin:admin -H 'X-Requested-By:admin' 'http://localhost:8080/api/v1/clusters/cc/configurations/service_config_versions?is_current=true'