Support Questions

Find answers, ask questions, and share your expertise

editing cluster-env.xml but does not change same property in Blueprint

avatar

i want change the following property in cluster-env.xml:

 <property>
    <name>recovery_enabled</name>
    <value>true</value>
    <description>Auto start enabled or not for this cluster.</description>
    <on-ambari-upgrade add="true"/>
  </property>
  <property>
    <name>recovery_type</name>
    <value>FULL</value>
    <description>Auto start type.</description>
    <on-ambari-upgrade add="true"/>
  </property>
  <property>
    <name>recovery_lifetime_max_count</name>
    <value>1024</value>
    <description>Auto start lifetime maximum count of recovery attempt allowed per host component. This is reset when agent is restarted.</de$
    <on-ambari-upgrade add="true"/>
  </property>
  <property>
    <name>recovery_max_count</name>
    <value>1</value>
    <description>Auto start maximum count of recovery attempt allowed per host component in a window. This is reset when agent is restarted.<$
    <on-ambari-upgrade add="true"/>
  </property>
  <property>
 .
 .

after change property do not any effect in Blueprints and if we see the value of property is different:

is way to change this property in blueprints ?

96717-1.png

1 ACCEPTED SOLUTION

avatar
Master Mentor

@abbas mohammadnejad

1. How are you updating the blueprint?
2. After upgrading the blueprint where actually checking the values for "cluster-env" ?

Usually we export the blueprint setting of an existing cluster with the following API call.

# curl --user admin:admin -i -H 'X-Requested-By: ambari' -X GET "http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER_NAME?format=blueprint" -o /tmp/cluster_blueprint.json

.


In the exported blueprint "/tmp/cluster_blueprint.json" you will find the current cluster information. Also you will find the "cluster-env" properties there inside the same "/tmp/cluster_blueprint.json" file.

So if you want to make any changes to the blueprint then you can either edit the same "/tmp/cluster_blueprint.json" file with your own values as you mentioned above. and then use the ambari API call to POST the same edited blueprint back to ambari.

NOTE: However the blueprint will be used to create a new cluster. It is not used to modify the settings/configurations of an existing cluster.


The other option will be to make the changes in "cluster-env" settings of your current cluster usijng utilities like "config.py" and then export the blueprint freshly using the same API call.

# curl --user admin:admin -i -H 'X-Requested-By: ambari' -X GET "http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER_NAME?format=blueprint"  -o /tmp/cluster_blueprint_new.json

.


Making changes in cluster-env using config.py then exporting blueprint:
You can make the changes in the "cluster-env" configuration of current cluster using the following kind of commands from ambari server host:

# /var/lib/ambari-server/resources/scripts/configs.py --user=admin --password=admin --port=8080 --action=set --host=localhost --cluster=KerLatest --config-type=cluster-env -k "recovery_lifetime_max_count" -v "1024"

# 
/var/lib/ambari-server/resources/scripts/configs.py --user=admin --password=admin --port=8080 --action=set --host=localhost --cluster=KerLatest --config-type=cluster-env -k "recovery_enabled" -v "true"



NOTE:
Please make sure to change the cluster name "CLUSTER_NAME" (example: KerLatest is my cluster name) here to your existing clustername.

Then export the blueprint of this cluster again.

# curl --user admin:admin -i -H 'X-Requested-By: ambari' -X GET "http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER_NAME?format=blueprint"  -o /tmp/cluster_blueprint_new_1.json

.

View solution in original post

2 REPLIES 2

avatar
Master Mentor

@abbas mohammadnejad

1. How are you updating the blueprint?
2. After upgrading the blueprint where actually checking the values for "cluster-env" ?

Usually we export the blueprint setting of an existing cluster with the following API call.

# curl --user admin:admin -i -H 'X-Requested-By: ambari' -X GET "http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER_NAME?format=blueprint" -o /tmp/cluster_blueprint.json

.


In the exported blueprint "/tmp/cluster_blueprint.json" you will find the current cluster information. Also you will find the "cluster-env" properties there inside the same "/tmp/cluster_blueprint.json" file.

So if you want to make any changes to the blueprint then you can either edit the same "/tmp/cluster_blueprint.json" file with your own values as you mentioned above. and then use the ambari API call to POST the same edited blueprint back to ambari.

NOTE: However the blueprint will be used to create a new cluster. It is not used to modify the settings/configurations of an existing cluster.


The other option will be to make the changes in "cluster-env" settings of your current cluster usijng utilities like "config.py" and then export the blueprint freshly using the same API call.

# curl --user admin:admin -i -H 'X-Requested-By: ambari' -X GET "http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER_NAME?format=blueprint"  -o /tmp/cluster_blueprint_new.json

.


Making changes in cluster-env using config.py then exporting blueprint:
You can make the changes in the "cluster-env" configuration of current cluster using the following kind of commands from ambari server host:

# /var/lib/ambari-server/resources/scripts/configs.py --user=admin --password=admin --port=8080 --action=set --host=localhost --cluster=KerLatest --config-type=cluster-env -k "recovery_lifetime_max_count" -v "1024"

# 
/var/lib/ambari-server/resources/scripts/configs.py --user=admin --password=admin --port=8080 --action=set --host=localhost --cluster=KerLatest --config-type=cluster-env -k "recovery_enabled" -v "true"



NOTE:
Please make sure to change the cluster name "CLUSTER_NAME" (example: KerLatest is my cluster name) here to your existing clustername.

Then export the blueprint of this cluster again.

# curl --user admin:admin -i -H 'X-Requested-By: ambari' -X GET "http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER_NAME?format=blueprint"  -o /tmp/cluster_blueprint_new_1.json

.

avatar

thank you so much @Jay Kumar SenSharma for good answer.

I wanted to make changes the file cluster-env.xml that auto start works properly. The way you said it changed the blueprint and it's perfectly correct, but my services are still starting after rebooting the system after about 40 minutes.

can you tell me what i do step by step for active service auto start?