CDAP 3.x
CDAP 3.0 through CDAP 3.6 releases use multiple scripts to interface with different CDAP functionality.
Script | Location | Function | Example Use |
---|---|---|---|
cdap.bat | $CDAP_HOME/bin (SDK) | Manage CDAP Standalone on Windows | cdap.bat start |
cdap.sh | $CDAP_HOME/bin (SDK) | Manage CDAP Standalone on MacOS/Linux | cdap.sh start |
cdap-cli.bat | $CDAP_HOME/bin (SDK) | Execute the CDAP CLI on Windows | cdap-cli.bat list artifacts |
cdap-cli.sh | $CDAP_HOME/bin (SDK) $CDAP_HOME/cli/bin (Distributed) | Execute the CDAP CLI on MacOS/Linux | cdap-cli.sh list artifacts |
common.sh | $CDAP_HOME/*/bin (Distributed) | Functions for distributed CDAP | source $CDAP_HOME/master/common.sh |
common-env.sh | $CDAP_HOME/*/bin (Distributed) | Default environment variables for distributed CDAP | source $CDAP_HOME/master/common-env.sh |
service | $CDAP_HOME/*/bin (Distributed) | Distributed CDAP start script | n/a (script cannot be directly executed) |
config-tool | $CDAP_HOME/ui/bin (Distributed) | Convert CDAP XML configuration files to JSON | config-tool --cdap |
auth-server-env.sh | $CDAP_HOME/security/conf (Distributed) | Environment variables for CDAP Auth Server | source $CDAP_HOME/security/conf/auth-server-env.sh |
kafka-server-env.sh | $CDAP_HOME/kafka/conf (Distributed) | Environment variables for CDAP Kafka Server | source $CDAP_HOME/kafka/conf/kafka-server-env.sh |
master-env.sh | $CDAP_HOME/master/conf (Distributed) | Environment variables for CDAP Master | source $CDAP_HOME/master/conf/master-env.sh |
router-env.sh | $CDAP_HOME/gateway/conf (Distributed) | Environment variables for CDAP Router | source $CDAP_HOME/gateway/conf/router-env.sh |
ui-env.sh | $CDAP_HOME/ui/conf (Distributed) | Environment variables for CDAP UI | source $CDAP_HOME/ui/conf/ui-env.sh |
svc-auth-server | $CDAP_HOME/security/bin (Distributed) | Symlink to manage CDAP Auth Server | $CDAP_HOME/security/bin/svc-auth-server start |
svc-kafka-server | $CDAP_HOME/kafka/bin (Distributed) | Symlink to manage CDAP Kafka Server | $CDAP_HOME/kafka/bin/svc-kafka-server start |
svc-master | $CDAP_HOME/master/bin (Distributed) | Symlink to manage CDAP Master | $CDAP_HOME/master/bin/svc-master run \ co.cask.cdap.data.tools.UpgradeTool upgrade |
svc-router | $CDAP_HOME/gateway/bin (Distribtued) | Symlink to manage CDAP Router | $CDAP_HOME/gateway/bin/svc-router start |
svc-ui | $CDAP_HOME/ui/bin (Distributed) | Symlink to manage CDAP UI | $CDAP_HOME/ui/bin/svc-ui start |
tx-debugger.bat | $CDAP_HOME/bin (SDK) | Execute Transaction Debugger on Windows | tx-debugger.bat |
tx-debugger.sh | $CDAP_HOME/bin (SDK) | Execute Transaction Debugger on MacOS/Linux | tx-debugger.sh |
Functionality is spread across the file-system and it is difficult to know which script to use for which functionality. The service script, while not run directly, changes its functionality based on the way it is run, rather than arguments. This makes the script rather fragile and difficult to modify without knowing how it will possibly effect other services. Each distributed component also has a copy of the common.sh and common-env.sh files, making them identical, but not common across the components.
CDAP 4.x
CDAP 4.0 introduces a single script which unifies and simplifies the interface with CDAP. Rather than multiple scripts, the cdap script should support all of the necessary functionality for running CDAP in either distributed mode or standalone mode within the CDAP SDK. This reduces the maintenance cost of these scripts while providing a single location for end users to perform CDAP actions.
The entirety of the scripts above have been rolled into a small set of scripts.
Script | Location | Function | Example Use |
---|---|---|---|
cdap.bat | $CDAP_HOME/bin (SDK) | Interface with CDAP on Windows | cdap.bat sdk start |
cdap | $CDAP_HOME/bin (SDK), $CDAP_HOME/*/bin (Distributed) | Interface with CDAP on MacOS/Linux | cdap sdk start |
functions.sh | $CDAP_HOME/bin (SDK), $CDAP_HOME/*/bin (Distributed) | Provide shell functions for MacOS/Linux (SDK) or Linux (Distributed) | source $CDAP_HOME/bin/function.sh |
CDAP does not provide a set of usable functions on Windows due to the limitations of the BAT file format.
Using the cdap script
The cdap script is merely a wrapper which takes certain arguments and passes them to the correct functions in the function.sh shell function library. Any commands which are not recognized by the script are passed to the CDAP CLI and executed. The table below shows some common uses which will mirror the previous functionality. However, it is not intended to be exhaustive and will not include every command or option.
Command | Context | Old Command | Notes |
---|---|---|---|
cdap sdk start --foreground | SDK | cdap.sh start --foreground | CDAP SDK command arguments remain unchanged |
cdap sdk --help | SDK | cdap.sh --help | |
cdap cli list artifacts | Distributed, SDK | cdap-cli.sh list artifacts | |
REMOVE: cdap list artifacts | Distributed, SDK | cdap-cli.sh list artifacts | Arguments not directly recognized by the script are passed to the CDAP CLI |
cdap auth-server start | Distributed | $CDAP_HOME/security/bin/svc-auth-server start | |
cdap classpath | Distributed | $CDAP_HOME/master/bin/svc-master classpath | Always returns the CDAP Master CLASSPATH |
REMOVE DOC: cdap config-tool --cdap | Distributed | $CDAP_HOME/ui/bin/config-tool --cdap | |
cdap upgrade | Distributed | $CDAP_HOME/master/bin/svc-master run \ co.cask.cdap.data.tools.UpgradeTool upgrade | Using run from a service script other than svc-master would result in an invalid CLASSPATH |
cdap upgrade hbase | Distributed | $CDAP_HOME/master/bin/svc-master run \ co.cask.cdap.data.tools.UpgradeTool upgrade_hbase | |
CHANGE: cdap debug transaction - cdap tx-debugger | Distributed, SDK | $CDAP_HOME/bin/tx-debugger.sh (SDK only) | Previously, the script was only available on SDK WARNING: Token file must exist or provided on command line |
cdap version | Distributed, SDK | Show cdap_version output | |
cdap status | Distributed, SDK | Show status of CDAP processes | |
cdap start cdap stop | Distributed, SDK | Distributed shows usage "cdap $service start" SDK starts or stops | |
cdap support-bundle | Distributed, SDK | Logs, jmap, jstack, environment vars + below | |
cdap info | Distributed, SDK | Display info about CDAP: versions, has internet (curl cask.co), data directory structure (SDK only), CLASSPATH, JAR checksums for CDAP, JDK |
Shell function library
All CDAP functions are provided in a library shell file, which can be sourced to easily interact with CDAP from the command line, especially useful for integrating CDAP into new deployment or management systems. Below is a list of functions which may be useful to integrators.
Function | Input | Output | Description |
---|---|---|---|
cdap_home | location of CDAP | Returns the location of CDAP Home to STDOUT | |
cdap_get_conf | property name, file to read, default response (optional) | value of property or default response | Returns 1 if property isn't found and no default is set |
cdap_kinit | CDAP_PRINCIPAL (optional), CDAP_KEYTAB (optional) | Initializes Kerberos ticket using variables or cdap-site.xml configuration | |
cdap_set_java | JAVA_HOME (optional) | exports JAVA | Sets location to java binary in JAVA variable, uses JAVA_HOME, if set |
cdap_service | service, action, arguments (optional) | Executes the given service with the correct environment | |
cdap_start_java | Executes a CDAP Java service with the given environment | ||
cdap_run_class | class name, arguments (optional) | Executes a non-service Java class with arguments using the CDAP Master environment | |
cdap_context | CDAP_HOME | context | Returns the CDAP_HOME context (sdk or distributed) to STDOUT |
cdap_version | CDAP_HOME, component (optional) | version | Returns the CDAP_HOME version to STDOUT |