Created 03-15-2018 09:28 AM
hi all,
Until HDP version - 2.6.4 we can use the configs.sh as the following example
( in this example we print all variables that relevant to the config type - yarn-site )
cluster name - HDP
config type - yarn-site
ambari server - localhost
/var/lib/ambari-server/resources/scripts/configs.sh get localhost HDP yarn-site ########## Performing 'GET' on (Site:yarn-site, Tag:version1512057597218) "properties" : { "hadoop.registry.rm.enabled" : "true", . . .
from 2.6.4 version ( and include config.sh isn't supported )
/var/lib/ambari-server/resources/scripts/configs.py get localhost HDP yarn-site Usage: configs.py [options] configs.py: error: One of required options is not passed
so we using now the configs.py instead
but seems that flags in configs.sh not as in configs.py
what is the right syntax to use the configs.py in order to get all variable according to the config type as we do on configs.sh ?
/var/lib/ambari-server/resources/scripts/configs.py get localhost HDP yarn-site Usage: configs.py [options] configs.py: error: One of required options is not passed
Created 03-15-2018 09:33 AM
Here is a simple example of config.py:
# /var/lib/ambari-server/resources/scripts/configs.py --user=admin --password=admin --port=8080 --action=get --host=localhost --cluster=Sandbox --config-type=yarn-site
Created 03-15-2018 09:33 AM
Here is a simple example of config.py:
# /var/lib/ambari-server/resources/scripts/configs.py --user=admin --password=admin --port=8080 --action=get --host=localhost --cluster=Sandbox --config-type=yarn-site
Created 03-15-2018 09:37 AM
Here is another example in which we are setting a property in cluster-env. Notice "-k" means Key and "-v" for value. Following command will set the Auto Start for Cluster services to true.
# /var/lib/ambari-server/resources/scripts/configs.py --user=admin --password=admin --port=8080 --action=set --host=localhost --cluster=Sandbox --config-type=cluster-env -k "recovery_enabled" -v "true"
Created 03-15-2018 09:41 AM
@jay thank you , another little equation regrading that
in configs.sh in order to set new value we do that ( for example )
/var/lib/ambari-server/resources/scripts/configs.sh set localhost HDP yarn.timeline-service.recovery.enabled true
what is the syntax for configs.py?
Created 03-15-2018 10:21 AM
Yes we can set individual properties as well like following:
# /var/lib/ambari-server/resources/scripts/configs.py --user=admin --password=admin --port=8080 --action=set --host=localhost --cluster=Sandbox --config-type=yarn-site -k "yarn.timeline-service.recovery.enabled" -v "true"
Created 11-14-2018 07:11 PM
Hi ,
I am trying to use this in my environment but fails. Its a kerberized environment and SSL enabled. "XXX" is where I replace the right values.
/var/lib/ambari-server/resources/scripts/configs.py --user=admin --password="XXXXXXXXX" --port=8442 --action=get --host="XXX"--cluster="XXX" --config-type=yarn-site 2018-11-14 10:58:36,163 INFO ### Performing "get" content: Traceback (most recent call last): File "/var/lib/ambari-server/resources/scripts/configs.py", line 364, in <module> sys.exit(main()) File "/var/lib/ambari-server/resources/scripts/configs.py", line 350, in main return get_properties(cluster, config_type, action_args, accessor) File "/var/lib/ambari-server/resources/scripts/configs.py", line 260, in get_properties get_config(cluster, config_type, accessor, output) File "/var/lib/ambari-server/resources/scripts/configs.py", line 212, in get_config properties, attributes = get_current_config(cluster, config_type, accessor) File "/var/lib/ambari-server/resources/scripts/configs.py", line 123, in get_current_config config_tag = get_config_tag(cluster, config_type, accessor) File "/var/lib/ambari-server/resources/scripts/configs.py", line 94, in get_config_tag response = accessor(DESIRED_CONFIGS_URL.format(cluster)) File "/var/lib/ambari-server/resources/scripts/configs.py", line 89, in do_request raise Exception('Problem with accessing api. Reason: {0}'.format(exc)) Exception: Problem with accessing api. Reason: ''
Created 11-15-2018 04:16 AM
@Mayank Bhatt do add "--protocol https --port 8443" options if ambari is running on HTTPS.