Skip to content

CSD Developer Tricks and Tools

Kostas Sakellis edited this page Feb 26, 2014 · 10 revisions

Using a directory instead of a jar file

Partial Installation (Development Mode Only)

WARNING WARNING, DANGER DANGER: These APIs only exist to aid development of CSDs and could disappear with the next release. There is no guarantee that there will be backwards support for them. Use at own risk.

During development, it is helpful to have a dynamic way of reinstalling your CSD so that you can see your changes without having to restart Cloudera Manager. In Cloudera Manager 5 there are a few management APIs to help developers while they write their CSD.

##List

Reveals the internal state of the CSD repository since the last refresh (or restart).

Request:

GET /cmf/csd/list

Sample Response:

{
    "message": "OK",
    "data": {
        "externalRootPath": "/opt/cloudera/csd",
        "internalRootPath": "/usr/share/cmf/csd",
        "availableCsds": [
            {
                "csdName": "SPARK",
                "source": "/usr/share/cmf/csd/SPARK-1.0-20140220.014146-19.jar",
                "isInstalled": true,
                "hasPlaceholder": false
            },
            {
                "csdName": "TESTCSD",
                "source": "/opt/cloudera/csd/TESTCSD-1.0.jar",
                "isInstalled": false,
                "hasPlaceholder": false
            }
        ],
        "shadowedCsds": [],
        "placeholderHandlers": [],
        "invalidCsds": {},
        "repoEnabled": true
    }
}

##Refresh

Refreshes the CSD repository and lists all the CSDs found with any validation errors. Refreshing does not install any CSDs.

Request:

GET /cmf/csd/refresh

Response

Same as List.

##Install

Once the CSD is listed in the repository without any errors, it can be installed. Installing a CSD registers the CSD service type with Cloudera Manager and then is available in the "Add Services" wizard.

Request:

GET /cmf/csd/install?csdName=<name>

Response:

{
    "message": "OK",
    "data": null
}

##Uninstall

Uninstalling a CSD will remove the service type from the "Add Services" wizard.

Request:

GET /cmf/csd/uninstall?csdName=<name>

Response:

{
    "message": "OK",
    "data": null
}

If a service of this service type exists on the cluster, this command will fail with the following error:

{
    "message": "CSD [<name>] cannot be uninstalled since services [<service_name1>,<service_name2>] are still using the CSD",
    "data": null
}

To uninstall the CSD, the services will first need to be removed from the cluster. Only then can the CSD be uninstalled.

There is an option to force the uninstallation of the CSD. You can pass force=true and the CSD will be uninstalled and a placeholder service type handler will be added for any services of that type that exist on the cluster. This operation is only recommended if the CSD will be added again.

##Reinstall

Reinstalls all the installed CSDs - available CSDs that are not installed won't get touched.

Request:

GET /cmf/csd/reinstall

Response:

{
    "message": "OK",
    "data": null
}

During normal development when you make a change to a CSD, you will need to do the following things:

  1. Refresh the repo: GET <hostname:port>/cmf/csd/refresh
  2. Check your CSD doesn't have any validation errors
  3. Uninstall your CSD, probably with a force GET <hostname:port>/cmf/csd/uninstall?csdName=<csd_name>&force=true
  4. Install your CSD GET <hostname:port>/cmf/csd/install?csdName=<csd_name>

The reinstall command will do all of these operations on the installed CSDs. If there is a validation error on any of the installed CSDs after refresh, the operation will not proceed. This allows the developer to fix any validation error that surface before proceeding again.

Limitations

Partial Installation of CSDs is not recommended for customers. There may be some unpredictable behavior when partially installing CSDs. Known issues/limitations include:

  1. Monitoring does not work on a partially installed CSDs
  2. Graphs might show errors because of unknown entity types.

Clone this wiki locally