Package cm_api :: Package endpoints :: Module services :: Class ApiService
[hide private]
[frames] | no frames]

Class ApiService

source code

         object --+        
                  |        
types.BaseApiObject --+    
                      |    
  types.BaseApiResource --+
                          |
                         ApiService
Known Subclasses:

Instance Methods [hide private]
 
__init__(self, resource_root, name=None, type=None)
Initializes internal state and sets all known writable properties of the object to None.
source code
 
__str__(self)
Default implementation of __str__.
source code
 
_get_cluster_name(self) source code
 
_path(self)
Return the API path for this service.
source code
 
_role_cmd(self, cmd, roles, api_version=1) source code
 
_parse_svc_config(self, json_dic, view=None)
Parse a json-decoded ApiServiceConfig dictionary into a 2-tuple.
source code
 
get_commands(self, view=None)
Retrieve a list of running commands for this service.
source code
 
get_running_activities(self) source code
 
query_activities(self, query_str=None) source code
 
get_activity(self, job_id) source code
 
list_watched_directories(self)
Returns a list of directories being watched by the Reports Manager.
source code
 
add_watched_directory(self, dir_path)
Adds a directory to the watching list.
source code
 
remove_watched_directory(self, dir_path)
Removes a directory from the watching list.
source code
 
get_impala_queries(self, start_time, end_time, filter_str='', limit=100, offset=0)
Returns a list of queries that satisfy the filter
source code
 
cancel_impala_query(self, query_id)
Cancel the query.
source code
 
get_query_details(self, query_id, format='text')
Get the query details
source code
 
get_impala_query_attributes(self)
Returns the list of all attributes that the Service Monitor can associate with Impala queries.
source code
 
create_impala_catalog_database(self)
Create the Impala Catalog Database.
source code
 
create_impala_catalog_database_tables(self)
Creates the Impala Catalog Database tables in the configured database.
source code
 
create_impala_user_dir(self)
Create the Impala user directory
source code
 
enable_llama_rm(self, llama1_host_id, llama1_role_name=None, llama2_host_id=None, llama2_role_name=None, zk_service_name=None, skip_restart=False)
Enable Llama-based resource management for Impala.
source code
 
disable_llama_rm(self)
Disable Llama-based resource management for Impala.
source code
 
enable_llama_ha(self, new_llama_host_id, zk_service_name=None, new_llama_role_name=None)
Enable high availability for an Impala Llama ApplicationMaster.
source code
 
disable_llama_ha(self, active_name)
Disable high availability for an Impala Llama active-standby pair.
source code
 
get_yarn_applications(self, start_time, end_time, filter_str='', limit=100, offset=0)
Returns a list of YARN applications that satisfy the filter
source code
 
kill_yarn_application(self, application_id)
Kills the application.
source code
 
get_yarn_application_attributes(self)
Returns the list of all attributes that the Service Monitor can associate with YARN applications.
source code
 
create_yarn_job_history_dir(self)
Create the Yarn job history directory.
source code
 
create_yarn_node_manager_remote_app_log_dir(self)
Create the Yarn NodeManager remote application log directory.
source code
 
collect_yarn_application_diagnostics(self, *application_ids)
DEPRECATED: use create_yarn_application_diagnostics_bundle on the Yarn service.
source code
 
create_yarn_application_diagnostics_bundle(self, application_ids, ticket_number=None, comments=None)
Collects the Diagnostics data for Yarn applications.
source code
 
get_config(self, view=None)
Retrieve the service's configuration.
source code
 
update_config(self, svc_config, **rt_configs)
Update the service's configuration.
source code
 
create_role(self, role_name, role_type, host_id)
Create a role.
source code
 
delete_role(self, name)
Delete a role by name.
source code
 
get_role(self, name)
Lookup a role by name.
source code
 
get_all_roles(self, view=None)
Get all roles in the service.
source code
 
get_roles_by_type(self, role_type, view=None)
Get all roles of a certain type in a service.
source code
 
get_role_types(self)
Get a list of role types in a service.
source code
 
get_all_role_config_groups(self)
Get a list of role configuration groups in the service.
source code
 
get_role_config_group(self, name)
Get a role configuration group in the service by name.
source code
 
create_role_config_group(self, name, display_name, role_type)
Create a role config group.
source code
 
update_role_config_group(self, name, apigroup)
Update a role config group.
source code
 
delete_role_config_group(self, name)
Delete a role config group by name.
source code
 
get_metrics(self, from_time=None, to_time=None, metrics=None, view=None)
This endpoint is not supported as of v6.
source code
 
start(self)
Start a service.
source code
 
stop(self)
Stop a service.
source code
 
restart(self)
Restart a service.
source code
 
start_roles(self, *role_names)
Start a list of roles.
source code
 
stop_roles(self, *role_names)
Stop a list of roles.
source code
 
restart_roles(self, *role_names)
Restart a list of roles.
source code
 
bootstrap_hdfs_stand_by(self, *role_names)
Bootstrap HDFS stand-by NameNodes.
source code
 
finalize_metadata_upgrade(self, *role_names)
Finalize HDFS NameNode metadata upgrade.
source code
 
create_beeswax_warehouse(self)
DEPRECATED: use create_hive_warehouse on the Hive service.
source code
 
create_hbase_root(self)
Create the root directory of an HBase service.
source code
 
create_hdfs_tmp(self)
Create the /tmp directory in HDFS with appropriate ownership and permissions.
source code
 
refresh(self, *role_names)
Execute the "refresh" command on a set of roles.
source code
 
decommission(self, *role_names)
Decommission roles in a service.
source code
 
recommission(self, *role_names)
Recommission roles in a service.
source code
 
deploy_client_config(self, *role_names)
Deploys client configuration to the hosts where roles are running.
source code
 
disable_hdfs_auto_failover(self, nameservice)
Disable auto-failover for a highly available HDFS nameservice.
source code
 
disable_hdfs_ha(self, active_name, secondary_name, start_dependent_services=True, deploy_client_configs=True, disable_quorum_storage=False)
Disable high availability for an HDFS NameNode.
source code
 
enable_hdfs_auto_failover(self, nameservice, active_fc_name, standby_fc_name, zk_service)
Enable auto-failover for an HDFS nameservice.
source code
 
enable_hdfs_ha(self, active_name, active_shared_path, standby_name, standby_shared_path, nameservice, start_dependent_services=True, deploy_client_configs=True, enable_quorum_storage=False)
Enable high availability for an HDFS NameNode.
source code
 
enable_nn_ha(self, active_name, standby_host_id, nameservice, jns, standby_name_dir_list=None, qj_name=None, standby_name=None, active_fc_name=None, standby_fc_name=None, zk_service_name=None, force_init_znode=True, clear_existing_standby_name_dirs=True, clear_existing_jn_edits_dir=True)
Enable High Availability (HA) with Auto-Failover for an HDFS NameNode.
source code
 
disable_nn_ha(self, active_name, snn_host_id, snn_check_point_dir_list, snn_name=None)
Disable high availability with automatic failover for an HDFS NameNode.
source code
 
enable_jt_ha(self, new_jt_host_id, force_init_znode=True, zk_service_name=None, new_jt_name=None, fc1_name=None, fc2_name=None)
Enable high availability for a MR JobTracker.
source code
 
disable_jt_ha(self, active_name)
Disable high availability for a MR JobTracker active-standby pair.
source code
 
enable_rm_ha(self, new_rm_host_id, zk_service_name=None)
Enable high availability for a YARN ResourceManager.
source code
 
disable_rm_ha(self, active_name)
Disable high availability for a YARN ResourceManager active-standby pair.
source code
 
enable_oozie_ha(self, new_oozie_server_host_ids, new_oozie_server_role_names=None, zk_service_name=None, load_balancer_host_port=None)
Enable high availability for Oozie.
source code
 
disable_oozie_ha(self, active_name)
Disable high availability for Oozie
source code
 
failover_hdfs(self, active_name, standby_name, force=False)
Initiate a failover of an HDFS NameNode HA pair.
source code
 
format_hdfs(self, *namenodes)
Format NameNode instances of an HDFS service.
source code
 
init_hdfs_auto_failover(self, *controllers)
Initialize HDFS failover controller metadata.
source code
 
init_hdfs_shared_dir(self, *namenodes)
Initialize a NameNode's shared edits directory.
source code
 
roll_edits_hdfs(self, nameservice=None)
Roll the edits of an HDFS NameNode or Nameservice.
source code
 
upgrade_hdfs_metadata(self)
Upgrade HDFS Metadata as part of a major version upgrade.
source code
 
upgrade_hbase(self)
Upgrade HBase data in HDFS and ZooKeeper as part of upgrade from CDH4 to CDH5.
source code
 
create_sqoop_user_dir(self)
Creates the user directory of a Sqoop service in HDFS.
source code
 
create_sqoop_database_tables(self)
Creates the Sqoop2 Server database tables in the configured database.
source code
 
upgrade_sqoop_db(self)
Upgrade Sqoop Database schema as part of a major version upgrade.
source code
 
upgrade_hive_metastore(self)
Upgrade Hive Metastore as part of a major version upgrade.
source code
 
cleanup_zookeeper(self, *servers)
Cleanup a ZooKeeper service or roles.
source code
 
init_zookeeper(self, *servers)
Initialize a ZooKeeper service or roles.
source code
 
sync_hue_db(self, *servers)
Synchronize the Hue server's database.
source code
 
dump_hue_db(self)
Dump the Hue server's database; it can be loaded later.
source code
 
load_hue_db(self)
Load data into Hue server's database from a previous data dump.
source code
 
lsof(self, *rolenames)
Run the lsof diagnostic command.
source code
 
jstack(self, *rolenames)
Run the jstack diagnostic command.
source code
 
jmap_histo(self, *rolenames)
Run the jmapHisto diagnostic command.
source code
 
jmap_dump(self, *rolenames)
Run the jmapDump diagnostic command.
source code
 
enter_maintenance_mode(self)
Put the service in maintenance mode.
source code
 
exit_maintenance_mode(self)
Take the service out of maintenance mode.
source code
 
rolling_restart(self, slave_batch_size=None, slave_fail_count_threshold=None, sleep_seconds=None, stale_configs_only=None, unupgraded_only=None, restart_role_types=None, restart_role_names=None)
Rolling restart the roles of a service.
source code
 
create_replication_schedule(self, start_time, end_time, interval_unit, interval, paused, arguments, alert_on_start=False, alert_on_success=False, alert_on_fail=False, alert_on_abort=False)
Create a new replication schedule for this service.
source code
 
get_replication_schedules(self)
Retrieve a list of replication schedules.
source code
 
get_replication_schedule(self, schedule_id)
Retrieve a single replication schedule.
source code
 
delete_replication_schedule(self, schedule_id)
Delete a replication schedule.
source code
 
update_replication_schedule(self, schedule_id, schedule)
Update a replication schedule.
source code
 
get_replication_command_history(self, schedule_id, limit=20, offset=0, view=None)
Retrieve a list of commands for a replication schedule.
source code
 
trigger_replication_schedule(self, schedule_id, dry_run=False)
Trigger replication immediately.
source code
 
create_snapshot_policy(self, policy)
Create a new snapshot policy for this service.
source code
 
get_snapshot_policies(self, view=None)
Retrieve a list of snapshot policies.
source code
 
get_snapshot_policy(self, name, view=None)
Retrieve a single snapshot policy.
source code
 
delete_snapshot_policy(self, name)
Delete a snapshot policy.
source code
 
update_snapshot_policy(self, name, policy)
Update a snapshot policy.
source code
 
get_snapshot_command_history(self, name, limit=20, offset=0, view=None)
Retrieve a list of commands triggered by a snapshot policy.
source code
 
install_oozie_sharelib(self)
Installs the Oozie ShareLib.
source code
 
create_oozie_embedded_database(self)
Create the Oozie Server Database.
source code
 
create_oozie_db(self)
Creates the Oozie Database Schema in the configured database.
source code
 
upgrade_oozie_db(self)
Upgrade Oozie Database schema as part of a major version upgrade.
source code
 
init_solr(self)
Initializes the Solr service in Zookeeper.
source code
 
create_solr_hdfs_home_dir(self)
Creates the home directory of a Solr service in HDFS.
source code
 
create_hive_metastore_tables(self)
Creates the Hive metastore tables in the configured database.
source code
 
create_hive_warehouse(self)
Creates the Hive warehouse directory in HDFS.
source code
 
create_hive_userdir(self)
Creates the Hive user directory in HDFS.
source code
 
create_hive_metastore_database(self)
Create the Hive Metastore Database.
source code
 
create_sentry_database(self)
Create the Sentry Server Database.
source code
 
create_sentry_database_tables(self)
Creates the Sentry Server database tables in the configured database.
source code
 
upgrade_sentry_database_tables(self)
Upgrades the Sentry Server database tables in the configured database.
source code
 
update_metastore_namenodes(self)
Update Hive Metastore to point to a NameNode's Nameservice name instead of hostname.
source code
 
import_mr_configs_into_yarn(self)
Import MapReduce configuration into Yarn, overwriting Yarn configuration.
source code
 
switch_to_mr2(self)
Change the cluster to use MR2 instead of MR1.
source code
 
finalize_rolling_upgrade(self)
Finalizes the rolling upgrade for HDFS by updating the NameNode metadata permanently to the next version.
source code
 
role_command_by_name(self, command_name, *role_names)
Executes a role command by name on the specified roles
source code
 
service_command_by_name(self, command_name)
Executes a command on the service specified by name.
source code
 
list_commands_by_name(self)
Lists all the commands that can be executed by name on the provided service.
source code
 
create_yarn_cm_container_usage_input_dir(self)
Creates the HDFS directory where YARN container usage metrics are stored by NodeManagers for CM to read and aggregate into app usage metrics.
source code

Inherited from types.BaseApiObject: __setattr__, to_json_dict

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __sizeof__, __subclasshook__

Class Methods [hide private]

Inherited from types.BaseApiObject: from_json_dict

Inherited from types.BaseApiObject (private): _get_attributes

Static Methods [hide private]

Inherited from types.BaseApiObject: init

Class Variables [hide private]
  _ATTRIBUTES = {'name': None, 'type': None, 'displayName': None...

Inherited from types.BaseApiObject (private): _WHITELIST

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, resource_root, name=None, type=None)
(Constructor)

source code 

Initializes internal state and sets all known writable properties of the object to None. Then initializes the properties given in the provided attributes dictionary.

Parameters:
  • resource_root - API resource object.
  • attrs - optional dictionary of attributes to set. This should only contain r/w attributes.
Overrides: object.__init__
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 

Default implementation of __str__. Uses the type name and the first attribute retrieved from the attribute map to create the string.

Overrides: object.__str__
(inherited documentation)

_path(self)

source code 

Return the API path for this service.

This method assumes that lack of a cluster reference means that the object refers to the Cloudera Management Services instance.

Overrides: types.BaseApiResource._path

_parse_svc_config(self, json_dic, view=None)

source code 

Parse a json-decoded ApiServiceConfig dictionary into a 2-tuple.

Parameters:
  • json_dic - The json dictionary with the config data.
  • view - View to materialize.
Returns:
2-tuple (service config dictionary, role type configurations)

get_commands(self, view=None)

source code 

Retrieve a list of running commands for this service.

Parameters:
  • view - View to materialize ('full' or 'summary')
Returns:
A list of running commands.

list_watched_directories(self)

source code 

Returns a list of directories being watched by the Reports Manager.

Returns:
A list of directories being watched

Since: API v14

add_watched_directory(self, dir_path)

source code 

Adds a directory to the watching list.

Parameters:
  • dir_path - The path of the directory to be added to the watching list
Returns:
The added directory, or null if failed

Since: API v14

remove_watched_directory(self, dir_path)

source code 

Removes a directory from the watching list.

Parameters:
  • dir_path - The path of the directory to be removed from the watching list
Returns:
The removed directory, or null if failed

Since: API v14

get_impala_queries(self, start_time, end_time, filter_str='', limit=100, offset=0)

source code 

Returns a list of queries that satisfy the filter

Parameters:
  • start_time (datetime.datetime. Note that the datetime must either be time zone aware or specified in the server time zone. See the python datetime documentation for more details about python's time zone handling.) - Queries must have ended after this time
  • end_time (datetime.datetime. Note that the datetime must either be time zone aware or specified in the server time zone. See the python datetime documentation for more details about python's time zone handling.) - Queries must have started before this time
  • filter_str - A filter to apply to the queries. For example: 'user = root and queryDuration > 5s'
  • limit - The maximum number of results to return
  • offset - The offset into the return list

Since: API v4

cancel_impala_query(self, query_id)

source code 

Cancel the query.

Parameters:
  • query_id - The query ID
Returns:
The warning message, if any.

Since: API v4

get_query_details(self, query_id, format='text')

source code 

Get the query details

Parameters:
  • query_id - The query ID
  • format - The format of the response ('text' or 'thrift_encoded')
Returns:
The details text

Since: API v4

get_impala_query_attributes(self)

source code 

Returns the list of all attributes that the Service Monitor can associate with Impala queries.

Examples of attributes include the user who issued the query and the number of HDFS bytes read by the query.

These attributes can be used to search for specific Impala queries through the get_impala_queries API. For example the 'user' attribute could be used in the search 'user = root'. If the attribute is numeric it can also be used as a metric in a tsquery (ie, 'select hdfs_bytes_read from IMPALA_QUERIES').

Note that this response is identical for all Impala services.

Returns:
A list of the Impala query attributes @since API v6

create_impala_catalog_database(self)

source code 

Create the Impala Catalog Database. Only works with embedded postgresql database. This command should usually be followed by a call to create_impala_catalog_database_tables.

Returns:
Reference to the submitted command.

Since: API v6

create_impala_catalog_database_tables(self)

source code 

Creates the Impala Catalog Database tables in the configured database. Will do nothing if tables already exist. Will not perform an upgrade.

Returns:
Reference to the submitted command.

Since: API v6

create_impala_user_dir(self)

source code 

Create the Impala user directory

Returns:
Reference to submitted command.

Since: API v6

enable_llama_rm(self, llama1_host_id, llama1_role_name=None, llama2_host_id=None, llama2_role_name=None, zk_service_name=None, skip_restart=False)

source code 

Enable Llama-based resource management for Impala.

This command only applies to CDH 5.1+ Impala services.

This command configures YARN and Impala for Llama resource management, and then creates one or two Llama roles, as specified by the parameters. When two Llama roles are created, they are configured as an active-standby pair. Auto-failover from active to standby Llama will be enabled using ZooKeeper.

If optional role name(s) are specified, the new Llama role(s) will be named accordingly; otherwise, role name(s) will be automatically generated.

By default, YARN, Impala, and any dependent services will be restarted, and client configuration will be re-deployed across the cluster. These default actions may be suppressed.

In order to enable Llama resource management, a YARN service must be present in the cluster, and Cgroup-based resource management must be enabled for all hosts with NodeManager roles. If these preconditions are not met, the command will fail.

Parameters:
  • llama1_host_id - id of the host where the first Llama role will be created.
  • llama1_role_name - Name of the first Llama role. If omitted, a name will be generated automatically.
  • llama2_host_id - id of the host where the second Llama role will be created. If omitted, only one Llama role will be created (i.e., high availability will not be enabled).
  • llama2_role_name - Name of the second Llama role. If omitted, a name will be generated automatically.
  • zk_service_name - Name of the ZooKeeper service to use for auto-failover. Only relevant when enabling Llama RM in HA mode (i.e., when creating two Llama roles). If Impala's ZooKeeper dependency is already set, then that ZooKeeper service will be used for auto-failover, and this parameter may be omitted.
  • skip_restart - true to skip the restart of Yarn, Impala, and their dependent services, and to skip deployment of client configuration. Default is False (i.e., by default dependent services are restarted and client configuration is deployed).
Returns:
Reference to the submitted command.

Since: API v8

disable_llama_rm(self)

source code 

Disable Llama-based resource management for Impala.

This command only applies to CDH 5.1+ Impala services.

This command disables resource management for Impala by removing all Llama roles present in the Impala service. Any services that depend on the Impala service being modified are restarted by the command, and client configuration is deployed for all services of the cluster.

Returns:
Reference to the submitted command.

Since: API v8

enable_llama_ha(self, new_llama_host_id, zk_service_name=None, new_llama_role_name=None)

source code 

Enable high availability for an Impala Llama ApplicationMaster.

This command only applies to CDH 5.1+ Impala services.

Parameters:
  • new_llama_host_id - id of the host where the second Llama role will be added.
  • zk_service_name - Name of the ZooKeeper service to use for auto-failover. If Impala's ZooKeeper dependency is already set, then that ZooKeeper service will be used for auto-failover, and this parameter may be omitted.
  • new_llama_role_name - Name of the new Llama role. If omitted, a name will be generated automatically.
Returns:
Reference to the submitted command.

Since: API v8

disable_llama_ha(self, active_name)

source code 

Disable high availability for an Impala Llama active-standby pair.

This command only applies to CDH 5.1+ Impala services.

Parameters:
  • active_name - name of the Llama role that will be active after the disable operation. The other Llama role will be removed.
Returns:
Reference to the submitted command.

Since: API v8

get_yarn_applications(self, start_time, end_time, filter_str='', limit=100, offset=0)

source code 

Returns a list of YARN applications that satisfy the filter

Parameters:
  • start_time (datetime.datetime. Note that the datetime must either be time zone aware or specified in the server time zone. See the python datetime documentation for more details about python's time zone handling.) - Applications must have ended after this time
  • filter_str - A filter to apply to the applications. For example: 'user = root and applicationDuration > 5s'
  • limit - The maximum number of results to return
  • offset - The offset into the return list
  • end_time (datetime.datetime. Note that the datetime must either be time zone aware or specified in the server time zone. See the python datetime documentation for more details about python's time zone handling.)

Since: API v6

kill_yarn_application(self, application_id)

source code 

Kills the application.

Returns:
The warning message, if any.

Since: API v6

get_yarn_application_attributes(self)

source code 

Returns the list of all attributes that the Service Monitor can associate with YARN applications.

Examples of attributes include the user who ran the application and the number of maps completed by the application.

These attributes can be used to search for specific YARN applications through the get_yarn_applications API. For example the 'user' attribute could be used in the search 'user = root'. If the attribute is numeric it can also be used as a metric in a tsquery (ie, 'select maps_completed from YARN_APPLICATIONS').

Note that this response is identical for all YARN services.

Returns:
A list of the YARN application attributes @since API v6

create_yarn_job_history_dir(self)

source code 

Create the Yarn job history directory.

Returns:
Reference to submitted command.

Since: API v6

create_yarn_node_manager_remote_app_log_dir(self)

source code 

Create the Yarn NodeManager remote application log directory.

Returns:
Reference to submitted command.

Since: API v6

collect_yarn_application_diagnostics(self, *application_ids)

source code 

DEPRECATED: use create_yarn_application_diagnostics_bundle on the Yarn service. Deprecated since v10.

Collects the Diagnostics data for Yarn applications.

Parameters:
  • application_ids - An array of strings containing the ids of the yarn applications.
Returns:
Reference to the submitted command.

Since: API v8

create_yarn_application_diagnostics_bundle(self, application_ids, ticket_number=None, comments=None)

source code 

Collects the Diagnostics data for Yarn applications.

Parameters:
  • application_ids - An array of strings containing the ids of the yarn applications.
  • ticket_number - If applicable, the support ticket number of the issue being experienced on the cluster.
  • comments - Additional comments
Returns:
Reference to the submitted command.

Since: API v10

get_config(self, view=None)

source code 

Retrieve the service's configuration.

Retrieves both the service configuration and role type configuration for each of the service's supported role types. The role type configurations are returned as a dictionary, whose keys are the role type name, and values are the respective configuration dictionaries.

The 'summary' view contains strings as the dictionary values. The full view contains ApiConfig instances as the values.

Parameters:
  • view - View to materialize ('full' or 'summary')
Returns:
2-tuple (service config dictionary, role type configurations)

update_config(self, svc_config, **rt_configs)

source code 

Update the service's configuration.

Parameters:
  • svc_config - Dictionary with service configuration to update.
  • rt_configs - Dict of role type configurations to update.
Returns:
2-tuple (service config dictionary, role type configurations)

create_role(self, role_name, role_type, host_id)

source code 

Create a role.

Parameters:
  • role_name - Role name
  • role_type - Role type
  • host_id - ID of the host to assign the role to
Returns:
An ApiRole object

delete_role(self, name)

source code 

Delete a role by name.

Parameters:
  • name - Role name
Returns:
The deleted ApiRole object

get_role(self, name)

source code 

Lookup a role by name.

Parameters:
  • name - Role name
Returns:
An ApiRole object

get_all_roles(self, view=None)

source code 

Get all roles in the service.

Parameters:
  • view - View to materialize ('full' or 'summary')
Returns:
A list of ApiRole objects.

get_roles_by_type(self, role_type, view=None)

source code 

Get all roles of a certain type in a service.

Parameters:
  • role_type - Role type
  • view - View to materialize ('full' or 'summary')
Returns:
A list of ApiRole objects.

get_role_types(self)

source code 

Get a list of role types in a service.

Returns:
A list of role types (strings)

get_all_role_config_groups(self)

source code 

Get a list of role configuration groups in the service.

Returns:
A list of ApiRoleConfigGroup objects.

Since: API v3

get_role_config_group(self, name)

source code 

Get a role configuration group in the service by name.

Parameters:
  • name - The name of the role config group.
Returns:
An ApiRoleConfigGroup object.

Since: API v3

create_role_config_group(self, name, display_name, role_type)

source code 

Create a role config group.

Parameters:
  • name - The name of the new group.
  • display_name - The display name of the new group.
  • role_type - The role type of the new group.
Returns:
New ApiRoleConfigGroup object.

Since: API v3

update_role_config_group(self, name, apigroup)

source code 

Update a role config group.

Parameters:
  • name - Role config group name.
  • apigroup - The updated role config group.
Returns:
The updated ApiRoleConfigGroup object.

Since: API v3

delete_role_config_group(self, name)

source code 

Delete a role config group by name.

Parameters:
  • name - Role config group name.
Returns:
The deleted ApiRoleConfigGroup object.

Since: API v3

get_metrics(self, from_time=None, to_time=None, metrics=None, view=None)

source code 

This endpoint is not supported as of v6. Use the timeseries API instead. To get all metrics for a service with the timeseries API use the query:

'select * where serviceName = $SERVICE_NAME'.

To get specific metrics for a service use a comma-separated list of the metric names as follows:

'select $METRIC_NAME1, $METRIC_NAME2 where serviceName = $SERVICE_NAME'.

For more information see http://tiny.cloudera.com/tsquery_doc

Retrieve metric readings for the service.

Parameters:
  • from_time - A datetime; start of the period to query (optional).
  • to_time - A datetime; end of the period to query (default = now).
  • metrics - List of metrics to query (default = all).
  • view - View to materialize ('full' or 'summary')
Returns:
List of metrics and their readings.

start(self)

source code 

Start a service.

Returns:
Reference to the submitted command.

stop(self)

source code 

Stop a service.

Returns:
Reference to the submitted command.

restart(self)

source code 

Restart a service.

Returns:
Reference to the submitted command.

start_roles(self, *role_names)

source code 

Start a list of roles.

Parameters:
  • role_names - names of the roles to start.
Returns:
List of submitted commands.

stop_roles(self, *role_names)

source code 

Stop a list of roles.

Parameters:
  • role_names - names of the roles to stop.
Returns:
List of submitted commands.

restart_roles(self, *role_names)

source code 

Restart a list of roles.

Parameters:
  • role_names - names of the roles to restart.
Returns:
List of submitted commands.

bootstrap_hdfs_stand_by(self, *role_names)

source code 

Bootstrap HDFS stand-by NameNodes.

Initialize their state by syncing it with the respective HA partner.

Parameters:
  • role_names - NameNodes to bootstrap.
Returns:
List of submitted commands.

finalize_metadata_upgrade(self, *role_names)

source code 

Finalize HDFS NameNode metadata upgrade. Should be done after doing HDFS upgrade with full downtime (and not with rolling upgrade).

Parameters:
  • role_names - NameNodes for which to finalize the upgrade.
Returns:
List of submitted commands.

Since: API v3

create_beeswax_warehouse(self)

source code 

DEPRECATED: use create_hive_warehouse on the Hive service. Deprecated since v3.

Create the Beeswax role's warehouse for a Hue service.

Returns:
Reference to the submitted command.

create_hbase_root(self)

source code 

Create the root directory of an HBase service.

Returns:
Reference to the submitted command.

create_hdfs_tmp(self)

source code 

Create the /tmp directory in HDFS with appropriate ownership and permissions.

Returns:
Reference to the submitted command

Since: API v2

refresh(self, *role_names)

source code 

Execute the "refresh" command on a set of roles.

Parameters:
  • role_names - Names of the roles to refresh.
Returns:
Reference to the submitted command.

decommission(self, *role_names)

source code 

Decommission roles in a service.

Parameters:
  • role_names - Names of the roles to decommission.
Returns:
Reference to the submitted command.

recommission(self, *role_names)

source code 

Recommission roles in a service.

Parameters:
  • role_names - Names of the roles to recommission.
Returns:
Reference to the submitted command.

Since: API v2

deploy_client_config(self, *role_names)

source code 

Deploys client configuration to the hosts where roles are running.

Parameters:
  • role_names - Names of the roles to decommission.
Returns:
Reference to the submitted command.

disable_hdfs_auto_failover(self, nameservice)

source code 

Disable auto-failover for a highly available HDFS nameservice. This command is no longer supported with API v6 onwards. Use disable_nn_ha instead.

Parameters:
  • nameservice - Affected nameservice.
Returns:
Reference to the submitted command.

disable_hdfs_ha(self, active_name, secondary_name, start_dependent_services=True, deploy_client_configs=True, disable_quorum_storage=False)

source code 

Disable high availability for an HDFS NameNode. This command is no longer supported with API v6 onwards. Use disable_nn_ha instead.

Parameters:
  • active_name - Name of the NameNode to keep.
  • secondary_name - Name of (existing) SecondaryNameNode to link to remaining NameNode.
  • start_dependent_services - whether to re-start dependent services.
  • deploy_client_configs - whether to re-deploy client configurations.
  • disable_quorum_storage - whether to disable Quorum-based Storage. Available since API v2. Quorum-based Storage will be disabled for all nameservices that have Quorum-based Storage enabled.
Returns:
Reference to the submitted command.

enable_hdfs_auto_failover(self, nameservice, active_fc_name, standby_fc_name, zk_service)

source code 

Enable auto-failover for an HDFS nameservice. This command is no longer supported with API v6 onwards. Use enable_nn_ha instead.

Parameters:
  • nameservice - Nameservice for which to enable auto-failover.
  • active_fc_name - Name of failover controller to create for active node.
  • standby_fc_name - Name of failover controller to create for stand-by node.
  • zk_service - ZooKeeper service to use.
Returns:
Reference to the submitted command.

enable_hdfs_ha(self, active_name, active_shared_path, standby_name, standby_shared_path, nameservice, start_dependent_services=True, deploy_client_configs=True, enable_quorum_storage=False)

source code 

Enable high availability for an HDFS NameNode. This command is no longer supported with API v6 onwards. Use enable_nn_ha instead.

Parameters:
  • active_name - name of active NameNode.
  • active_shared_path - shared edits path for active NameNode. Ignored if Quorum-based Storage is being enabled.
  • standby_name - name of stand-by NameNode.
  • standby_shared_path - shared edits path for stand-by NameNode. Ignored if Quourm Journal is being enabled.
  • nameservice - nameservice for the HA pair.
  • start_dependent_services - whether to re-start dependent services.
  • deploy_client_configs - whether to re-deploy client configurations.
  • enable_quorum_storage - whether to enable Quorum-based Storage. Available since API v2. Quorum-based Storage will be enabled for all nameservices except those configured with NFS High Availability.
Returns:
Reference to the submitted command.

enable_nn_ha(self, active_name, standby_host_id, nameservice, jns, standby_name_dir_list=None, qj_name=None, standby_name=None, active_fc_name=None, standby_fc_name=None, zk_service_name=None, force_init_znode=True, clear_existing_standby_name_dirs=True, clear_existing_jn_edits_dir=True)

source code 

Enable High Availability (HA) with Auto-Failover for an HDFS NameNode.

Parameters:
  • active_name - Name of Active NameNode.
  • standby_host_id - ID of host where Standby NameNode will be created.
  • nameservice - Nameservice to be used while enabling HA. Optional if Active NameNode already has this config set.
  • jns - List of Journal Nodes to be created during the command. Each element of the list must be a dict containing the following keys:
    • jnHostId: ID of the host where the new JournalNode will be created.
    • jnName: Name of the JournalNode role (optional)
    • jnEditsDir: Edits dir of the JournalNode. Can be omitted if the config is already set at RCG level.
  • standby_name_dir_list - List of directories for the new Standby NameNode. If not provided then it will use same dirs as Active NameNode.
  • qj_name - Name of the journal located on each JournalNodes' filesystem. This can be optionally provided if the config hasn't been already set for the Active NameNode. If this isn't provided and Active NameNode doesn't also have the config, then nameservice is used by default.
  • standby_name - Name of the Standby NameNode role to be created (Optional).
  • active_fc_name - Name of the Active Failover Controller role to be created (Optional).
  • standby_fc_name - Name of the Standby Failover Controller role to be created (Optional).
  • zk_service_name - Name of the ZooKeeper service to use for auto-failover. If HDFS service already depends on a ZooKeeper service then that ZooKeeper service will be used for auto-failover and in that case this parameter can either be omitted or should be the same ZooKeeper service.
  • force_init_znode - Indicates if the ZNode should be force initialized if it is already present. Useful while re-enabling High Availability. (Default: TRUE)
  • clear_existing_standby_name_dirs - Indicates if the existing name directories for Standby NameNode should be cleared during the workflow. Useful while re-enabling High Availability. (Default: TRUE)
  • clear_existing_jn_edits_dir - Indicates if the existing edits directories for the JournalNodes for the specified nameservice should be cleared during the workflow. Useful while re-enabling High Availability. (Default: TRUE)
Returns:
Reference to the submitted command.

Since: API v6

disable_nn_ha(self, active_name, snn_host_id, snn_check_point_dir_list, snn_name=None)

source code 

Disable high availability with automatic failover for an HDFS NameNode.

Parameters:
  • active_name - Name of the NamdeNode role that is going to be active after High Availability is disabled.
  • snn_host_id - Id of the host where the new SecondaryNameNode will be created.
  • snn_check_point_dir_list - List of directories used for checkpointing by the new SecondaryNameNode.
  • snn_name - Name of the new SecondaryNameNode role (Optional).
Returns:
Reference to the submitted command.

Since: API v6

enable_jt_ha(self, new_jt_host_id, force_init_znode=True, zk_service_name=None, new_jt_name=None, fc1_name=None, fc2_name=None)

source code 

Enable high availability for a MR JobTracker.

Parameters:
  • zk_service_name - Name of the ZooKeeper service to use for auto-failover. If MapReduce service depends on a ZooKeeper service then that ZooKeeper service will be used for auto-failover and in that case this parameter can be omitted.
  • new_jt_host_id - id of the host where the second JobTracker will be added.
  • force_init_znode - Initialize the ZNode used for auto-failover even if it already exists. This can happen if JobTracker HA was enabled before and then disabled. Disable operation doesn't delete this ZNode. Defaults to true.
  • new_jt_name - Name of the second JobTracker role to be created.
  • fc1_name - Name of the Failover Controller role that is co-located with the existing JobTracker.
  • fc2_name - Name of the Failover Controller role that is co-located with the new JobTracker.
Returns:
Reference to the submitted command.

Since: API v5

disable_jt_ha(self, active_name)

source code 

Disable high availability for a MR JobTracker active-standby pair.

Parameters:
  • active_name - name of the JobTracker that will be active after the disable operation. The other JobTracker and Failover Controllers will be removed.
Returns:
Reference to the submitted command.

enable_rm_ha(self, new_rm_host_id, zk_service_name=None)

source code 

Enable high availability for a YARN ResourceManager.

Parameters:
  • new_rm_host_id - id of the host where the second ResourceManager will be added.
  • zk_service_name - Name of the ZooKeeper service to use for auto-failover. If YARN service depends on a ZooKeeper service then that ZooKeeper service will be used for auto-failover and in that case this parameter can be omitted.
Returns:
Reference to the submitted command.

Since: API v6

disable_rm_ha(self, active_name)

source code 

Disable high availability for a YARN ResourceManager active-standby pair.

Parameters:
  • active_name - name of the ResourceManager that will be active after the disable operation. The other ResourceManager will be removed.
Returns:
Reference to the submitted command.

Since: API v6

enable_oozie_ha(self, new_oozie_server_host_ids, new_oozie_server_role_names=None, zk_service_name=None, load_balancer_host_port=None)

source code 

Enable high availability for Oozie.

Parameters:
  • new_oozie_server_host_ids - List of IDs of the hosts on which new Oozie Servers will be added.
  • new_oozie_server_role_names - List of names of the new Oozie Servers. This is an optional argument, but if provided, it should match the length of host IDs provided.
  • zk_service_name - Name of the ZooKeeper service that will be used for Oozie HA. This is an optional parameter if the Oozie to ZooKeeper dependency is already set.
  • load_balancer_host_port - Address and port of the load balancer used for Oozie HA. This is an optional parameter if this config is already set.
Returns:
Reference to the submitted command.

Since: API v6

disable_oozie_ha(self, active_name)

source code 

Disable high availability for Oozie

Parameters:
  • active_name - Name of the Oozie Server that will be active after High Availability is disabled.
Returns:
Reference to the submitted command.

Since: API v6

failover_hdfs(self, active_name, standby_name, force=False)

source code 

Initiate a failover of an HDFS NameNode HA pair.

This will make the given stand-by NameNode active, and vice-versa.

Parameters:
  • active_name - name of currently active NameNode.
  • standby_name - name of NameNode currently in stand-by.
  • force - whether to force failover.
Returns:
Reference to the submitted command.

format_hdfs(self, *namenodes)

source code 

Format NameNode instances of an HDFS service.

Parameters:
  • namenodes - Name of NameNode instances to format.
Returns:
List of submitted commands.

init_hdfs_auto_failover(self, *controllers)

source code 

Initialize HDFS failover controller metadata.

Only one controller per nameservice needs to be initialized.

Parameters:
  • controllers - Name of failover controller instances to initialize.
Returns:
List of submitted commands.

init_hdfs_shared_dir(self, *namenodes)

source code 

Initialize a NameNode's shared edits directory.

Parameters:
  • namenodes - Name of NameNode instances.
Returns:
List of submitted commands.

roll_edits_hdfs(self, nameservice=None)

source code 

Roll the edits of an HDFS NameNode or Nameservice.

Parameters:
  • nameservice - Nameservice whose edits should be rolled. Required only with a federated HDFS.
Returns:
Reference to the submitted command.

Since: API v3

upgrade_hdfs_metadata(self)

source code 

Upgrade HDFS Metadata as part of a major version upgrade.

Returns:
Reference to the submitted command.

Since: API v6

upgrade_hbase(self)

source code 

Upgrade HBase data in HDFS and ZooKeeper as part of upgrade from CDH4 to CDH5.

Returns:
Reference to the submitted command.

Since: API v6

create_sqoop_user_dir(self)

source code 

Creates the user directory of a Sqoop service in HDFS.

Returns:
Reference to the submitted command.

Since: API v4

create_sqoop_database_tables(self)

source code 

Creates the Sqoop2 Server database tables in the configured database. Will do nothing if tables already exist. Will not perform an upgrade.

Returns:
Reference to the submitted command.

Since: API v10

upgrade_sqoop_db(self)

source code 

Upgrade Sqoop Database schema as part of a major version upgrade.

Returns:
Reference to the submitted command.

Since: API v6

upgrade_hive_metastore(self)

source code 

Upgrade Hive Metastore as part of a major version upgrade.

Returns:
Reference to the submitted command.

Since: API v6

cleanup_zookeeper(self, *servers)

source code 

Cleanup a ZooKeeper service or roles.

If no server role names are provided, the command applies to the whole service, and cleans up all the server roles that are currently running.

Parameters:
  • servers - ZK server role names (optional).
Returns:
Command reference (for service command) or list of command references (for role commands).

init_zookeeper(self, *servers)

source code 

Initialize a ZooKeeper service or roles.

If no server role names are provided, the command applies to the whole service, and initializes all the configured server roles.

Parameters:
  • servers - ZK server role names (optional).
Returns:
Command reference (for service command) or list of command references (for role commands).

sync_hue_db(self, *servers)

source code 

Synchronize the Hue server's database.

Parameters:
  • servers - Name of Hue Server roles to synchronize. Not required starting with API v10.
Returns:
List of submitted commands.

dump_hue_db(self)

source code 

Dump the Hue server's database; it can be loaded later.

Returns:
List of submitted commands.

load_hue_db(self)

source code 

Load data into Hue server's database from a previous data dump.

Returns:
List of submitted commands.

lsof(self, *rolenames)

source code 

Run the lsof diagnostic command. This command runs the lsof utility to list a role's open files.

Parameters:
  • rolenames - Name of the role instances
Returns:
List of submitted commands.

Since: API v8

jstack(self, *rolenames)

source code 

Run the jstack diagnostic command. The command runs the jstack utility to capture a role's java thread stacks.

Parameters:
  • rolenames - Name of the role instances
Returns:
List of submitted commands.

Since: API v8

jmap_histo(self, *rolenames)

source code 

Run the jmapHisto diagnostic command. The command runs the jmap utility to capture a histogram of the objects on the role's java heap.

Parameters:
  • rolenames - Name of the role instances
Returns:
List of submitted commands.

Since: API v8

jmap_dump(self, *rolenames)

source code 

Run the jmapDump diagnostic command. The command runs the jmap utility to capture a dump of the role's java heap.

Parameters:
  • rolenames - Name of the role instances
Returns:
List of submitted commands.

Since: API v8

enter_maintenance_mode(self)

source code 

Put the service in maintenance mode.

Returns:
Reference to the completed command.

Since: API v2

exit_maintenance_mode(self)

source code 

Take the service out of maintenance mode.

Returns:
Reference to the completed command.

Since: API v2

rolling_restart(self, slave_batch_size=None, slave_fail_count_threshold=None, sleep_seconds=None, stale_configs_only=None, unupgraded_only=None, restart_role_types=None, restart_role_names=None)

source code 

Rolling restart the roles of a service. The sequence is:

  1. Restart all the non-slave roles
  2. If slaves are present restart them in batches of size specified
  3. Perform any post-command needed after rolling restart
Parameters:
  • slave_batch_size - Number of slave roles to restart at a time Must be greater than 0. Default is 1. For HDFS, this number should be less than the replication factor (default 3) to ensure data availability during rolling restart.
  • slave_fail_count_threshold - The threshold for number of slave batches that are allowed to fail to restart before the entire command is considered failed. Must be >= 0. Default is 0.
  • sleep_seconds - Number of seconds to sleep between restarts of slave role batches. Must be >=0. Default is 0.
  • stale_configs_only - Restart roles with stale configs only. Default is false.
  • unupgraded_only - Restart roles that haven't been upgraded yet. Default is false.
  • restart_role_types - Role types to restart. If not specified, all startable roles are restarted.
  • restart_role_names - List of specific roles to restart. If none are specified, then all roles of specified role types are restarted.
Returns:
Reference to the submitted command.

Since: API v3

create_replication_schedule(self, start_time, end_time, interval_unit, interval, paused, arguments, alert_on_start=False, alert_on_success=False, alert_on_fail=False, alert_on_abort=False)

source code 

Create a new replication schedule for this service.

The replication argument type varies per service type. The following types are recognized:

  • HDFS: ApiHdfsReplicationArguments
  • Hive: ApiHiveReplicationArguments
Parameters:
  • start_time (datetime.datetime) - The time at which the schedule becomes active and first executes.
  • end_time (datetime.datetime) - The time at which the schedule will expire.
  • interval_unit (str) - The unit of time the `interval` represents. Ex. MINUTE, HOUR, DAY. See the server documentation for a full list of values.
  • interval (int) - The number of time units to wait until triggering the next replication.
  • paused (bool) - Should the schedule be paused? Useful for on-demand replication.
  • arguments - service type-specific arguments for the replication job.
  • alert_on_start - whether to generate alerts when the job is started.
  • alert_on_success - whether to generate alerts when the job succeeds.
  • alert_on_fail - whether to generate alerts when the job fails.
  • alert_on_abort - whether to generate alerts when the job is aborted.
Returns:
The newly created schedule.

Since: API v3

get_replication_schedules(self)

source code 

Retrieve a list of replication schedules.

Returns:
A list of replication schedules.

Since: API v3

get_replication_schedule(self, schedule_id)

source code 

Retrieve a single replication schedule.

Parameters:
  • schedule_id - The id of the schedule to retrieve.
Returns:
The requested schedule.

Since: API v3

delete_replication_schedule(self, schedule_id)

source code 

Delete a replication schedule.

Parameters:
  • schedule_id - The id of the schedule to delete.
Returns:
The deleted replication schedule.

Since: API v3

update_replication_schedule(self, schedule_id, schedule)

source code 

Update a replication schedule.

Parameters:
  • schedule_id - The id of the schedule to update.
  • schedule - The modified schedule.
Returns:
The updated replication schedule.

Since: API v3

get_replication_command_history(self, schedule_id, limit=20, offset=0, view=None)

source code 

Retrieve a list of commands for a replication schedule.

Parameters:
  • schedule_id - The id of the replication schedule.
  • limit - Maximum number of commands to retrieve.
  • offset - Index of first command to retrieve.
  • view - View to materialize. Valid values are 'full', 'summary', 'export', 'export_redacted'.
Returns:
List of commands executed for a replication schedule.

Since: API v4

trigger_replication_schedule(self, schedule_id, dry_run=False)

source code 

Trigger replication immediately. Start and end dates on the schedule will be ignored.

Parameters:
  • schedule_id - The id of the schedule to trigger.
  • dry_run - Whether to execute a dry run.
Returns:
The command corresponding to the replication job.

Since: API v3

create_snapshot_policy(self, policy)

source code 

Create a new snapshot policy for this service.

Parameters:
  • policy - The snapshot policy to create
Returns:
The newly created policy.

Since: API v6

get_snapshot_policies(self, view=None)

source code 

Retrieve a list of snapshot policies.

Parameters:
  • view - View to materialize. Valid values are 'full', 'summary', 'export', 'export_redacted'.
Returns:
A list of snapshot policies.

Since: API v6

get_snapshot_policy(self, name, view=None)

source code 

Retrieve a single snapshot policy.

Parameters:
  • name - The name of the snapshot policy to retrieve.
  • view - View to materialize. Valid values are 'full', 'summary', 'export', 'export_redacted'.
Returns:
The requested snapshot policy.

Since: API v6

delete_snapshot_policy(self, name)

source code 

Delete a snapshot policy.

Parameters:
  • name - The name of the snapshot policy to delete.
Returns:
The deleted snapshot policy.

Since: API v6

update_snapshot_policy(self, name, policy)

source code 

Update a snapshot policy.

Parameters:
  • name - The name of the snapshot policy to update.
  • policy - The modified snapshot policy.
Returns:
The updated snapshot policy.

Since: API v6

get_snapshot_command_history(self, name, limit=20, offset=0, view=None)

source code 

Retrieve a list of commands triggered by a snapshot policy.

Parameters:
  • name - The name of the snapshot policy.
  • limit - Maximum number of commands to retrieve.
  • offset - Index of first command to retrieve.
  • view - View to materialize. Valid values are 'full', 'summary', 'export', 'export_redacted'.
Returns:
List of commands triggered by a snapshot policy.

Since: API v6

install_oozie_sharelib(self)

source code 

Installs the Oozie ShareLib. Oozie must be stopped before running this command.

Returns:
Reference to the submitted command.

Since: API v3

create_oozie_embedded_database(self)

source code 

Create the Oozie Server Database. Only works with embedded postgresql database. This command should usually be followed by a call to create_oozie_db.

Returns:
Reference to the submitted command.

Since: API v10

create_oozie_db(self)

source code 

Creates the Oozie Database Schema in the configured database. This command does not create database. This command creates only tables required by Oozie. To create database, please refer to create_oozie_embedded_database.

Returns:
Reference to the submitted command.

Since: API v2

upgrade_oozie_db(self)

source code 

Upgrade Oozie Database schema as part of a major version upgrade.

Returns:
Reference to the submitted command.

Since: API v6

init_solr(self)

source code 

Initializes the Solr service in Zookeeper.

Returns:
Reference to the submitted command.

Since: API v4

create_solr_hdfs_home_dir(self)

source code 

Creates the home directory of a Solr service in HDFS.

Returns:
Reference to the submitted command.

Since: API v4

create_hive_metastore_tables(self)

source code 

Creates the Hive metastore tables in the configured database. Will do nothing if tables already exist. Will not perform an upgrade.

Returns:
Reference to the submitted command.

Since: API v3

create_hive_warehouse(self)

source code 

Creates the Hive warehouse directory in HDFS.

Returns:
Reference to the submitted command.

Since: API v3

create_hive_userdir(self)

source code 

Creates the Hive user directory in HDFS.

Returns:
Reference to the submitted command.

Since: API v4

create_hive_metastore_database(self)

source code 

Create the Hive Metastore Database. Only works with embedded postgresql database. This command should usually be followed by a call to create_hive_metastore_tables.

Returns:
Reference to the submitted command.

Since: API v4

create_sentry_database(self)

source code 

Create the Sentry Server Database. Only works with embedded postgresql database. This command should usually be followed by a call to create_sentry_database_tables.

Returns:
Reference to the submitted command.

Since: API v7

create_sentry_database_tables(self)

source code 

Creates the Sentry Server database tables in the configured database. Will do nothing if tables already exist. Will not perform an upgrade.

Returns:
Reference to the submitted command.

Since: API v7

upgrade_sentry_database_tables(self)

source code 

Upgrades the Sentry Server database tables in the configured database.

Returns:
Reference to the submitted command.

Since: API v8

update_metastore_namenodes(self)

source code 

Update Hive Metastore to point to a NameNode's Nameservice name instead of hostname. Only available when all Hive Metastore Servers are stopped and HDFS has High Availability.

Back up the Hive Metastore Database before running this command.

Returns:
Reference to the submitted command.

Since: API v4

import_mr_configs_into_yarn(self)

source code 

Import MapReduce configuration into Yarn, overwriting Yarn configuration.

You will lose existing Yarn configuration. Read all MapReduce configuration, role assignments, and role configuration groups and update Yarn with corresponding values. MR1 configuration will be converted into the equivalent MR2 configuration.

Before running this command, Yarn must be stopped and MapReduce must exist with valid configuration.

Returns:
Reference to the submitted command.

Since: API v6

switch_to_mr2(self)

source code 

Change the cluster to use MR2 instead of MR1. Services will be restarted.

Will perform the following steps: * Update all services that depend on MapReduce to instead depend on Yarn. * Stop MapReduce * Start Yarn (includes MR2) * Deploy Yarn (MR2) Client Configuration

Available since API v6.

Returns:
Reference to the submitted command.

Since: API v6

finalize_rolling_upgrade(self)

source code 

Finalizes the rolling upgrade for HDFS by updating the NameNode metadata permanently to the next version. Should be done after doing a rolling upgrade to a CDH version >= 5.2.0.

Returns:
Reference to the submitted command.

Since: API v8

role_command_by_name(self, command_name, *role_names)

source code 

Executes a role command by name on the specified roles

Parameters:
  • command_name - The name of the command.
  • role_names - The role names to execute this command on.
Returns:
Reference to the submitted command.

Since: API v6

service_command_by_name(self, command_name)

source code 

Executes a command on the service specified by name.

Parameters:
  • command_name - The name of the command.
Returns:
Reference to the submitted command.

Since: API v6

list_commands_by_name(self)

source code 

Lists all the commands that can be executed by name on the provided service.

Returns:
A list of command metadata objects

Since: API v6

create_yarn_cm_container_usage_input_dir(self)

source code 

Creates the HDFS directory where YARN container usage metrics are stored by NodeManagers for CM to read and aggregate into app usage metrics.

Returns:
Reference to submitted command.

Since: API v13


Class Variable Details [hide private]

_ATTRIBUTES

Value:
{'name': None, 'type': None, 'displayName': None, 'serviceState': ROAt\
tr(), 'healthSummary': ROAttr(), 'healthChecks': ROAttr(), 'clusterRef\
': ROAttr(ApiClusterRef), 'configStale': ROAttr(), 'configStalenessSta\
tus': ROAttr(), 'clientConfigStalenessStatus': ROAttr(), 'serviceUrl':\
 ROAttr(), 'roleInstancesUrl': ROAttr(), 'maintenanceMode': ROAttr(), \
'maintenanceOwners': ROAttr(), 'entityStatus': ROAttr(),}