### What is this PR for? This PR contains miscellaneous fixes & improvements for documentation: - fixes for code snippets formatting, like, https://zeppelin.apache.org/docs/0.8.0-SNAPSHOT/setup/security/shiro_authentication.html#apply-multiple-roles-in-shiro-configuration - fixes syntax highlighting (adding `scala`, `xml`, `java`, `bash`, ...) - fixes for list of interpreters - ... ### What type of PR is it? Documentation Author: Alex Ott <alexott@gmail.com> Closes #2997 from alexott/doc-formatting-fixes and squashes the following commits:10eed86ca[Alex Ott] Merge branch 'master' into doc-formatting-fixes37a2bb778[Alex Ott] miscellaneous fixes - wording, formatting, etc.63ca2b0e2[Alex Ott] fix usage of the ``` markup that lead to broken formatting9d285a1b7[Alex Ott] Fix list of interpreters5a7950e79[Alex Ott] add missing language spec for syntax highlightingbb26a2954[Alex Ott] use same formatting for parser namec90b61f11[Alex Ott] use same capitalization in all interpreter namesa994f4ecf[Alex Ott] improve formatting for Cassandra interpreter docs
3.8 KiB
| layout | title | description | group |
|---|---|---|---|
| page | Shell interpreter for Apache Zeppelin | Shell interpreter uses Apache Commons Exec to execute external processes. | interpreter |
{% include JB/setup %}
Shell interpreter for Apache Zeppelin
Overview
Shell interpreter uses Apache Commons Exec to execute external processes.
In Zeppelin notebook, you can use %sh in the beginning of a paragraph to invoke system shell and run commands.
Note : Currently each command runs as the user Zeppelin server is running as.
Configuration
At the "Interpreters" menu in Zeppelin dropdown menu, you can set the property value for Shell interpreter.
| Name | Default | Description |
|---|---|---|
| shell.command.timeout.millisecs | 60000 | Shell command time out in millisecs |
| shell.working.directory.user.home | false | If this set to true, the shell's working directory will be set to user home |
| zeppelin.shell.auth.type | Types of authentications' methods supported are SIMPLE, and KERBEROS | |
| zeppelin.shell.principal | The principal name to load from the keytab | |
| zeppelin.shell.keytab.location | The path to the keytab file | |
| zeppelin.shell.interpolation | false | Enable ZeppelinContext variable interpolation into paragraph text |
Example
The following example demonstrates the basic usage of Shell in a Zeppelin notebook.
If you need further information about Zeppelin Interpreter Setting for using Shell interpreter, please read What is interpreter setting? section first.
Kerberos refresh interval
For changing the default behavior of when to renew Kerberos ticket following changes can be made in conf/zeppelin-env.sh.
# Change Kerberos refresh interval (default value is 1d). Allowed postfix are ms, s, m, min, h, and d.
export LAUNCH_KERBEROS_REFRESH_INTERVAL=4h
# Change kinit number retries (default value is 5), which means if the kinit command fails for 5 retries consecutively it will close the interpreter.
export KINIT_FAIL_THRESHOLD=10
Object Interpolation
The shell interpreter also supports interpolation of ZeppelinContext objects into the paragraph text.
The following example shows one use of this facility:
####In Scala cell:
z.put("dataFileName", "members-list-003.parquet")
// ...
val members = spark.read.parquet(z.get("dataFileName"))
// ...
####In later Shell cell:
%sh
rm -rf {dataFileName}
Object interpolation is disabled by default, and can be enabled (for the Shell interpreter) by
setting the value of the property zeppelin.shell.interpolation to true (see Configuration above).
More details of this feature can be found in Zeppelin-Context