Package cm_api :: Package endpoints :: Module cms :: Class ClouderaManager
[hide private]
[frames] | no frames]

Class ClouderaManager

source code

         object --+        
                  |        
types.BaseApiObject --+    
                      |    
  types.BaseApiResource --+
                          |
                         ClouderaManager

The Cloudera Manager instance.

Provides access to CM configuration and services.

Instance Methods [hide private]
 
__init__(self, resource_root)
Initializes internal state and sets all known writable properties of the object to None.
source code
 
_path(self)
Returns the path to the resource.
source code
 
get_commands(self, view=None)
Retrieve a list of running global commands.
source code
 
create_mgmt_service(self, service_setup_info)
Setup the Cloudera Management Service.
source code
 
delete_mgmt_service(self)
Delete the Cloudera Management Service.
source code
 
get_service(self)
Return the Cloudera Management Services instance.
source code
 
get_license(self)
Return information about the currently installed license.
source code
 
update_license(self, license_text)
Install or update the Cloudera Manager license.
source code
 
get_config(self, view=None)
Retrieve the Cloudera Manager configuration.
source code
 
update_config(self, config)
Update the CM configuration.
source code
 
generate_credentials(self)
Generate credentials for services configured with Kerberos.
source code
 
import_admin_credentials(self, username, password)
Imports the KDC Account Manager credentials needed by Cloudera Manager to create kerberos principals needed by CDH services.
source code
 
get_licensed_feature_usage(self)
Retrieve a summary of licensed feature usage.
source code
 
inspect_hosts(self)
Runs the host inspector on the configured hosts.
source code
 
collect_diagnostic_data(self, start_datetime, end_datetime, includeInfoLog=False)
This method is deprecated as of CM 4.5.
source code
 
collect_diagnostic_data_45(self, end_datetime, bundle_size_bytes, cluster_name=None, roles=None, collect_metrics=False, start_datetime=None)
Issue the command to collect diagnostic data.
source code
 
hosts_decommission(self, host_names)
Decommission the specified hosts by decommissioning the slave roles and stopping the remaining ones.
source code
 
hosts_offline_or_decommission(self, host_names, timeout=None)
Decommission the specified hosts by offlining or decommissioning the slave roles and stopping the remaining ones.
source code
 
hosts_recommission(self, host_names)
Recommission the specified hosts by recommissioning the slave roles.
source code
 
hosts_recommission_with_start(self, host_names)
Recommission the specified hosts by recommissioning the slave roles.
source code
 
hosts_start_roles(self, host_names)
Start all the roles on the specified hosts.
source code
 
create_peer(self, name, url, username, password, peer_type='REPLICATION')
Create a new peer for replication.
source code
 
_get_peer_type_param(self, peer_type)
Checks if the resource_root's API version is >= 11 and construct type param.
source code
 
delete_peer(self, name, peer_type='REPLICATION')
Delete a replication peer.
source code
 
update_peer(self, current_name, new_name, new_url, username, password, peer_type='REPLICATION')
Update a replication peer.
source code
 
get_peers(self)
Retrieve a list of replication peers.
source code
 
get_peer(self, name, peer_type='REPLICATION')
Retrieve a replication peer by name.
source code
 
test_peer_connectivity(self, name, peer_type='REPLICATION')
Test connectivity for a replication peer.
source code
 
get_all_hosts_config(self, view=None)
Retrieve the default configuration for all hosts.
source code
 
update_all_hosts_config(self, config)
Update the default configuration for all hosts.
source code
 
auto_assign_roles(self)
Automatically assign roles to hosts and create the roles for the Cloudera Management Service.
source code
 
auto_configure(self)
Automatically configures roles of the Cloudera Management Service.
source code
 
host_install(self, user_name, host_names, ssh_port=None, password=None, private_key=None, passphrase=None, parallel_install_count=None, cm_repo_url=None, gpg_key_custom_url=None, java_install_strategy=None, unlimited_jce=None)
Install Cloudera Manager Agent on a set of hosts.
source code
 
begin_trial(self)
Begin the trial license for this Cloudera Manager instance.
source code
 
end_trial(self)
End the trial license for this Cloudera Manager instance.
source code
 
import_cluster_template(self, api_cluster_template, add_repositories=False)
Create a cluster according to the provided template
source code
 
delete_credentials(self)
Delete credentials for services configured with Kerberos.
source code

Inherited from types.BaseApiObject: __setattr__, __str__, 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]

Inherited from types.BaseApiObject (private): _ATTRIBUTES, _WHITELIST

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, resource_root)
(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)

_path(self)

source code 

Returns the path to the resource.

e.g., for a service 'foo' in cluster 'bar', this should return '/clusters/bar/services/foo'.

Overrides: types.BaseApiResource._path
(inherited documentation)

get_commands(self, view=None)

source code 

Retrieve a list of running global commands.

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

create_mgmt_service(self, service_setup_info)

source code 

Setup the Cloudera Management Service.

Parameters:
  • service_setup_info - ApiServiceSetupInfo object.
Returns:
The management service instance.

delete_mgmt_service(self)

source code 

Delete the Cloudera Management Service.

Returns:
The deleted management service instance.

get_service(self)

source code 

Return the Cloudera Management Services instance.

Returns:
An ApiService instance.

get_license(self)

source code 

Return information about the currently installed license.

Returns:
License information.

update_license(self, license_text)

source code 

Install or update the Cloudera Manager license.

Parameters:
  • license_text - the license in text form

get_config(self, view=None)

source code 

Retrieve the Cloudera Manager configuration.

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:
Dictionary with configuration data.

update_config(self, config)

source code 

Update the CM configuration.

Parameters:
  • config - Dictionary with configuration to update.
Returns:
Dictionary with updated configuration.

generate_credentials(self)

source code 

Generate credentials for services configured with Kerberos.

Returns:
Information about the submitted command.

import_admin_credentials(self, username, password)

source code 

Imports the KDC Account Manager credentials needed by Cloudera
Manager to create kerberos principals needed by CDH services.

@param username Username of the Account Manager. Full name including the Kerberos
       realm must be specified.
@param password Password for the Account Manager.

@return: Information about the submitted command.

@since API v7

get_licensed_feature_usage(self)

source code 

Retrieve a summary of licensed feature usage.

This command will return information about what Cloudera Enterprise licensed features are in use in the clusters being managed by this Cloudera Manager, as well as totals for usage across all clusters.

The specific features described can vary between different versions of Cloudera Manager.

Available since API v6.

inspect_hosts(self)

source code 

Runs the host inspector on the configured hosts.

Returns:
Information about the submitted command.

collect_diagnostic_data(self, start_datetime, end_datetime, includeInfoLog=False)

source code 

This method is deprecated as of CM 4.5. You should use collect_diagnostic_data_45. Issue the command to collect diagnostic data.

Parameters:
  • start_datetime - The start of the collection period. Type datetime.
  • end_datetime - The end of the collection period. Type datetime.
  • includeInfoLog - Whether to include INFO level log messages.

collect_diagnostic_data_45(self, end_datetime, bundle_size_bytes, cluster_name=None, roles=None, collect_metrics=False, start_datetime=None)

source code 

Issue the command to collect diagnostic data. If start_datetime is specified, diagnostic data is collected for the entire period between start_datetime and end_datetime provided that bundle size is less than or equal to bundle_size_bytes. Diagnostics data collection fails if the bundle size is greater than bundle_size_bytes.

If start_datetime is not specified, diagnostic data is collected starting from end_datetime and collecting backwards upto a maximum of bundle_size_bytes.

Parameters:
  • end_datetime - The end of the collection period. Type datetime.
  • bundle_size_bytes - The target size for the support bundle in bytes
  • cluster_name - The cluster to collect or None for all clusters
  • roles - Role ids of roles to restrict log and metric collection to. Valid since v10.
  • collect_metrics - Whether to collect metrics for viewing as charts. Valid since v13.
  • start_datetime - The start of the collection period. Type datetime. Valid since v13.

hosts_decommission(self, host_names)

source code 

Decommission the specified hosts by decommissioning the slave roles and stopping the remaining ones.

Parameters:
  • host_names - List of names of hosts to be decommissioned.
Returns:
Information about the submitted command.

Since: API v2

hosts_offline_or_decommission(self, host_names, timeout=None)

source code 

Decommission the specified hosts by offlining or decommissioning the slave roles and stopping the remaining ones. Offline has precedence if supported by the service.

Parameters:
  • host_names - List of names of hosts to be decommissioned.
  • timeout - Offline timeout in seconds. Omit to get the default timeout (4 hours).
Returns:
Information about the submitted command.

Since: API v17

hosts_recommission(self, host_names)

source code 

Recommission the specified hosts by recommissioning the slave roles. This command doesn't start the roles. Use hosts_start_roles for that.

Parameters:
  • host_names - List of names of hosts to be recommissioned.
Returns:
Information about the submitted command.

Since: API v2

hosts_recommission_with_start(self, host_names)

source code 

Recommission the specified hosts by recommissioning the slave roles. This command will start the roles before recommissioning.

Warning: Evolving. This method may change in the future and does not offer standard compatibility guarantees. Do not use without guidance from Cloudera.

Currently, only HDFS DataNodes will be started by this command.

Parameters:
  • host_names - List of names of hosts to be recommissioned.
Returns:
Information about the submitted command.

Since: API v15

hosts_start_roles(self, host_names)

source code 

Start all the roles on the specified hosts.

Parameters:
  • host_names - List of names of hosts on which to start all roles.
Returns:
Information about the submitted command.

Since: API v2

create_peer(self, name, url, username, password, peer_type='REPLICATION')

source code 

Create a new peer for replication.

Parameters:
  • name - The name of the peer.
  • url - The url of the peer.
  • username - The admin username to use to setup the remote side of the peer connection.
  • password - The password of the admin user.
  • peer_type - Added in v11. The type of the peer. Defaults to 'REPLICATION'.
Returns:
The newly created peer.

Since: API v3

delete_peer(self, name, peer_type='REPLICATION')

source code 

Delete a replication peer.

Parameters:
  • name - The name of the peer.
  • peer_type - Added in v11. The type of the peer. Defaults to 'REPLICATION'.
Returns:
The deleted peer.

Since: API v3

update_peer(self, current_name, new_name, new_url, username, password, peer_type='REPLICATION')

source code 

Update a replication peer.

Parameters:
  • current_name - The name of the peer to updated.
  • new_name - The new name for the peer.
  • new_url - The new url for the peer.
  • username - The admin username to use to setup the remote side of the peer connection.
  • password - The password of the admin user.
  • peer_type - Added in v11. The type of the peer. Defaults to 'REPLICATION'.
Returns:
The updated peer.

Since: API v3

get_peers(self)

source code 

Retrieve a list of replication peers.

Returns:
A list of replication peers.

Since: API v3

get_peer(self, name, peer_type='REPLICATION')

source code 

Retrieve a replication peer by name.

Parameters:
  • name - The name of the peer.
  • peer_type - Added in v11. The type of the peer. Defaults to 'REPLICATION'.
Returns:
The peer.

Since: API v3

test_peer_connectivity(self, name, peer_type='REPLICATION')

source code 

Test connectivity for a replication peer.

Parameters:
  • name - The name of the peer to test.
  • peer_type - Added in v11. The type of the peer to test. Defaults to 'REPLICATION'.
Returns:
The command representing the test.

Since: API v3

get_all_hosts_config(self, view=None)

source code 

Retrieve the default configuration for all hosts.

Parameters:
  • view - View to materialize.
  • view - View to materialize ('full' or 'summary')
Returns:
Dictionary with configuration data.

update_all_hosts_config(self, config)

source code 

Update the default configuration for all hosts.

Parameters:
  • config - Dictionary with configuration to update.
Returns:
Dictionary with updated configuration.

auto_assign_roles(self)

source code 

Automatically assign roles to hosts and create the roles for the Cloudera Management Service.

Assignments are done based on number of hosts in the deployment and hardware specifications. Existing roles will be taken into account and their assignments will be not be modified. The deployment should not have any clusters when calling this endpoint. If it does, an exception will be thrown preventing any role assignments.

Since: API v6

auto_configure(self)

source code 

Automatically configures roles of the Cloudera Management Service.

Overwrites some existing configurations. Only default role config groups must exist before calling this endpoint. Other role config groups must not exist. If they do, an exception will be thrown preventing any configuration. Ignores any clusters (and their services and roles) colocated with the Cloudera Management Service. To avoid over-committing the heap on hosts, place the Cloudera Management Service roles on machines not used by any of the clusters.

Since: API v6

host_install(self, user_name, host_names, ssh_port=None, password=None, private_key=None, passphrase=None, parallel_install_count=None, cm_repo_url=None, gpg_key_custom_url=None, java_install_strategy=None, unlimited_jce=None)

source code 

Install Cloudera Manager Agent on a set of hosts.

Parameters:
  • user_name - The username used to authenticate with the hosts. Root access to your hosts is required to install Cloudera packages. The installer will connect to your hosts via SSH and log in either directly as root or as another user with password-less sudo privileges to become root.
  • host_names - List of names of hosts to configure for use with Cloudera Manager. A host may be specified by a hostname(FQDN) or an IP address.
  • ssh_port - SSH port. If unset, defaults to 22.
  • password - The password used to authenticate with the hosts. Specify either this or a private key. For password-less login, use an empty string as password.
  • private_key - The private key to authenticate with the hosts. Specify either this or a password.
  • passphrase - The passphrase associated with the private key used to authenticate with the hosts (optional).
  • parallel_install_count - Number of simultaneous installations. Defaults to 10. Running a large number of installations at once can consume large amounts of network bandwidth and other system resources.
  • cm_repo_url - The Cloudera Manager repository URL to use (optional). Example for SLES, Redhat or other RPM based distributions: http://archive-primary.cloudera.com/cm5/redhat/6/x86_64/cm/5/ Example for Ubuntu or other Debian based distributions: "deb http://archive.cloudera.com/cm5/ubuntu/lucid/amd64/cm/ lucid-cm5 contrib"
  • gpg_key_custom_url - The Cloudera Manager public GPG key (optional). Example for SLES, Redhat or other RPM based distributions: http://archive-primary.cloudera.com/cm5/redhat/6/x86_64/cm/RPM-GPG-KEY-cloudera Example for Ubuntu or other Debian based distributions: http://archive.cloudera.com/debian/archive.key
  • java_install_strategy - Added in v8: Strategy to use for JDK installation. Valid values are 1. AUTO (default): Cloudera Manager will install the JDK versions that are required when the "AUTO" option is selected. Cloudera Manager may overwrite any of the existing JDK installations. 2. NONE: Cloudera Manager will not install any JDK when "NONE" option is selected. It should be used if an existing JDK installation has to be used.
  • unlimited_jce - Added in v8: Flag for unlimited strength JCE policy files installation If unset, defaults to false
Returns:
Information about the submitted command.

Since: API v6

begin_trial(self)

source code 

Begin the trial license for this Cloudera Manager instance.

This allows the user to have enterprise-level features for a 60-day trial period.

Since: API v6

end_trial(self)

source code 

End the trial license for this Cloudera Manager instance.

Since: API v6

import_cluster_template(self, api_cluster_template, add_repositories=False)

source code 

Create a cluster according to the provided template

Parameters:
  • api_cluster_template - cluster template to import
  • add_repositories - if true the parcels repositories in the cluster template will be added.
Returns:
Command handing cluster import

Since: API v12

delete_credentials(self)

source code 

Delete credentials for services configured with Kerberos.

Returns:
Information about the submitted command.

Since: API v17