# RoleCommandsResource Resource

### POST /clusters/{clusterName}/services/{serviceName}/roleCommands/hdfsBootstrapStandBy

Bootstrap HDFS stand-by NameNodes.

Submit a request to synchronize HDFS NameNodes with their assigned HA partners. The command requires that the target NameNodes are part of existing HA pairs, which can be accomplished by setting the nameservice configuration parameter in the NameNode's configuration.

The HA partner must already be formatted and running for this command to run.

Request Parameters
name | type | description | default
--- | --- | --- | ---
clusterName | path |  | n/a
serviceName | path |  | n/a

Request Body
media type | data type | description
--- | --- | ---
application/json | ApiRoleNameList (JSON) | The names of the stand-by NameNodes to bootstrap.

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiBulkCommandList (JSON) | A list of submitted commands.

### POST /clusters/{clusterName}/services/{serviceName}/roleCommands/hdfsEnterSafemode

Enter safemode for namenodes

Available since API v4.

Request Parameters
name | type | description | default
--- | --- | --- | ---
clusterName | path |  | n/a
serviceName | path |  | n/a

Request Body
media type | data type | description
--- | --- | ---
application/json | ApiRoleNameList (JSON) | NameNodes for which to enter safemode.

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiBulkCommandList (JSON) | List of submitted commands.

### POST /clusters/{clusterName}/services/{serviceName}/roleCommands/hdfsFinalizeMetadataUpgrade

Finalize HDFS NameNode metadata upgrade.

Available since API v3.

Request Parameters
name | type | description | default
--- | --- | --- | ---
clusterName | path |  | n/a
serviceName | path |  | n/a

Request Body
media type | data type | description
--- | --- | ---
application/json | ApiRoleNameList (JSON) | NameNodes for which to finalize the upgrade.

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiBulkCommandList (JSON) | List of submitted commands.

### POST /clusters/{clusterName}/services/{serviceName}/roleCommands/hdfsFormat

Format HDFS NameNodes.

Submit a format request to a list of NameNodes on a service. Note that trying to format a previously formatted NameNode will fail.

Note about high availability: when two NameNodes are working in an HA pair, only one of them should be formatted.

Bulk command operations are not atomic, and may contain partial failures. The returned list will contain references to all successful commands, and a list of error messages identifying the roles on which the command failed.

Request Parameters
name | type | description | default
--- | --- | --- | ---
clusterName | path |  | n/a
serviceName | path |  | n/a

Request Body
media type | data type | description
--- | --- | ---
application/json | ApiRoleNameList (JSON) | The names of the NameNodes to format.

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiBulkCommandList (JSON) | A list of submitted commands.

### POST /clusters/{clusterName}/services/{serviceName}/roleCommands/hdfsInitializeAutoFailover

Initialize HDFS HA failover controller metadata.

The controllers being initialized must already exist and be properly configured. The command will make sure the needed data is initialized for the controller to work.

Only one controller per nameservice needs to be initialized.

Request Parameters
name | type | description | default
--- | --- | --- | ---
clusterName | path |  | n/a
serviceName | path |  | n/a

Request Body
media type | data type | description
--- | --- | ---
application/json | ApiRoleNameList (JSON) | The names of the controllers to initialize.

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiBulkCommandList (JSON) | A list of submitted commands.

### POST /clusters/{clusterName}/services/{serviceName}/roleCommands/hdfsInitializeSharedDir

Initialize HDFS NameNodes' shared edit directory.

Shared edit directories are used when two HDFS NameNodes are operating as a high-availability pair. This command initializes the shared directory to include the necessary metadata.

The provided role names should reflect one of the NameNodes in the respective HA pair; the role must be stopped and its data directory must already have been formatted. The shared edits directory must be empty for this command to succeed.

Request Parameters
name | type | description | default
--- | --- | --- | ---
clusterName | path |  | n/a
serviceName | path |  | n/a

Request Body
media type | data type | description
--- | --- | ---
application/json | ApiRoleNameList (JSON) | The names of the NameNodes.

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiBulkCommandList (JSON) | A list of submitted commands.

### POST /clusters/{clusterName}/services/{serviceName}/roleCommands/hdfsLeaveSafemode

Leave safemode for namenodes

Available since API v4.

Request Parameters
name | type | description | default
--- | --- | --- | ---
clusterName | path |  | n/a
serviceName | path |  | n/a

Request Body
media type | data type | description
--- | --- | ---
application/json | ApiRoleNameList (JSON) | NameNodes for which to leave safemode.

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiBulkCommandList (JSON) | List of submitted commands.

### POST /clusters/{clusterName}/services/{serviceName}/roleCommands/hdfsSaveNamespace

Save namespace for namenodes

Available since API v4.

Request Parameters
name | type | description | default
--- | --- | --- | ---
clusterName | path |  | n/a
serviceName | path |  | n/a

Request Body
media type | data type | description
--- | --- | ---
application/json | ApiRoleNameList (JSON) | NameNodes for which to save namespace.

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiBulkCommandList (JSON) | List of submitted commands.

### POST /clusters/{clusterName}/services/{serviceName}/roleCommands/hueSyncDb

Create / update the Hue database schema.

This command is to be run whenever a new database has been specified or, as necessary, after an upgrade.

This request should be sent to Hue servers only.

Request Parameters
name | type | description | default
--- | --- | --- | ---
clusterName | path |  | n/a
serviceName | path |  | n/a

Request Body
media type | data type | description
--- | --- | ---
application/json | ApiRoleNameList (JSON) | The names of the Hue server roles.

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiBulkCommandList (JSON) | A list of submitted commands.

### POST /clusters/{clusterName}/services/{serviceName}/roleCommands/jmapDump

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

Available since API v8.

Request Parameters
name | type | description | default
--- | --- | --- | ---
clusterName | path |  | n/a
serviceName | path |  | n/a

Request Body
media type | data type | description
--- | --- | ---
application/json | ApiRoleNameList (JSON) | the names of the roles to jmap.

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiBulkCommandList (JSON) | List of submitted commands.

### POST /clusters/{clusterName}/services/{serviceName}/roleCommands/jmapHisto

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

Available since API v8.

Request Parameters
name | type | description | default
--- | --- | --- | ---
clusterName | path |  | n/a
serviceName | path |  | n/a

Request Body
media type | data type | description
--- | --- | ---
application/json | ApiRoleNameList (JSON) | the names of the roles to jmap.

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiBulkCommandList (JSON) | List of submitted commands.

### POST /clusters/{clusterName}/services/{serviceName}/roleCommands/jstack

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

Available since API v8.

Request Parameters
name | type | description | default
--- | --- | --- | ---
clusterName | path |  | n/a
serviceName | path |  | n/a

Request Body
media type | data type | description
--- | --- | ---
application/json | ApiRoleNameList (JSON) | the names of the roles to jstack.

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiBulkCommandList (JSON) | List of submitted commands.

### POST /clusters/{clusterName}/services/{serviceName}/roleCommands/lsof

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

Available since API v8.

Request Parameters
name | type | description | default
--- | --- | --- | ---
clusterName | path |  | n/a
serviceName | path |  | n/a

Request Body
media type | data type | description
--- | --- | ---
application/json | ApiRoleNameList (JSON) | the names of the roles to lsof.

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiBulkCommandList (JSON) | List of submitted commands.

### POST /clusters/{clusterName}/services/{serviceName}/roleCommands/refresh

Refresh a role's data.

For MapReduce services, this command should be executed on JobTracker roles. It refreshes the role's queue and node information.

For HDFS services, this command should be executed on NameNode or DataNode roles. For NameNodes, it refreshes the role's node list. For DataNodes, it refreshes the role's data directory list and other configuration.

For YARN services, this command should be executed on ResourceManager roles. It refreshes the role's queue and node information.

Available since API v1. DataNode data directories refresh available since API v10.

Request Parameters
name | type | description | default
--- | --- | --- | ---
clusterName | path |  | n/a
serviceName | path |  | n/a

Request Body
media type | data type | description
--- | --- | ---
application/json | ApiRoleNameList (JSON) | The names of the roles.

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiBulkCommandList (JSON) | A list of submitted commands.

### POST /clusters/{clusterName}/services/{serviceName}/roleCommands/restart

Restart a set of role instances

Bulk command operations are not atomic, and may contain partial failures. The returned list will contain references to all successful commands, and a list of error messages identifying the roles on which the command failed.

Request Parameters
name | type | description | default
--- | --- | --- | ---
clusterName | path |  | n/a
serviceName | path |  | n/a

Request Body
media type | data type | description
--- | --- | ---
application/json | ApiRoleNameList (JSON) | The name of the roles to restart.

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiBulkCommandList (JSON) | A reference to the submitted command.

### POST /clusters/{clusterName}/services/{serviceName}/roleCommands/start

Start a set of role instances.

Bulk command operations are not atomic, and may contain partial failures. The returned list will contain references to all successful commands, and a list of error messages identifying the roles on which the command failed.

Request Parameters
name | type | description | default
--- | --- | --- | ---
clusterName | path |  | n/a
serviceName | path |  | n/a

Request Body
media type | data type | description
--- | --- | ---
application/json | ApiRoleNameList (JSON) | The names of the roles to start.

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiBulkCommandList (JSON) | A reference to the submitted command.

### POST /clusters/{clusterName}/services/{serviceName}/roleCommands/stop

Stop a set of role instances.

Bulk command operations are not atomic, and may contain partial failures. The returned list will contain references to all successful commands, and a list of error messages identifying the roles on which the command failed.

Request Parameters
name | type | description | default
--- | --- | --- | ---
clusterName | path |  | n/a
serviceName | path |  | n/a

Request Body
media type | data type | description
--- | --- | ---
application/json | ApiRoleNameList (JSON) | The role type.

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiBulkCommandList (JSON) | A reference to the submitted command.

### POST /clusters/{clusterName}/services/{serviceName}/roleCommands/zooKeeperCleanup

Cleanup a list of ZooKeeper server roles.

This command removes snapshots and transaction log files kept by ZooKeeper for backup purposes. Refer to the ZooKeeper documentation for more details.

Request Parameters
name | type | description | default
--- | --- | --- | ---
clusterName | path |  | n/a
serviceName | path |  | n/a

Request Body
media type | data type | description
--- | --- | ---
application/json | ApiRoleNameList (JSON) | The names of the roles.

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiBulkCommandList (JSON) | A list of submitted commands.

### POST /clusters/{clusterName}/services/{serviceName}/roleCommands/zooKeeperInit

Initialize a list of ZooKeeper server roles.

This applies to ZooKeeper services from CDH4. Before ZooKeeper server roles can be used, they need to be initialized.

Request Parameters
name | type | description | default
--- | --- | --- | ---
clusterName | path |  | n/a
serviceName | path |  | n/a

Request Body
media type | data type | description
--- | --- | ---
application/json | ApiRoleNameList (JSON) | The names of the roles.

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiBulkCommandList (JSON) | A list of submitted commands.

### POST /clusters/{clusterName}/services/{serviceName}/roleCommands/{commandName}

Execute a role command by name.

Available since API v6.

Request Parameters
name | type | description | default
--- | --- | --- | ---
clusterName | path |  | n/a
commandName | path | the name of command to execute. | n/a
serviceName | path |  | n/a

Request Body
media type | data type | description
--- | --- | ---
application/json | ApiRoleNameList (JSON) | the roles to run this command on.

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiBulkCommandList (JSON) | List of submitted commands.