Member since
09-29-2015
122
Posts
159
Kudos Received
26
Solutions
My Accepted Solutions
Title | Views | Posted |
---|---|---|
6725 | 11-12-2016 12:32 AM | |
1926 | 10-05-2016 08:08 PM | |
2645 | 08-02-2016 11:29 PM | |
23362 | 06-24-2016 11:46 PM | |
2064 | 05-25-2016 11:12 PM |
06-24-2016
11:46 PM
3 Kudos
See import external library section of https://community.hortonworks.com/articles/34424/apache-zeppelin-on-hdp-242.html Since databricks csv is published to maven, you can just add the following as the first note before any other note. %dep
z.load("com.databricks:spark-csv_2.10:1.2.0")
... View more
05-26-2016
06:55 PM
Yes, Zeppelin sends authenticated end-users via Livy downstream to Spark on YARN. Livy adds --proxy-user <username> to the spark-submit command it launches.
... View more
05-25-2016
11:55 PM
21 Kudos
Apache Zeppelin with HDP 2.4.2 In March, 2016 we delivered 2nd technical preview of Apache Zeppelin on HDP 2.4. Meanwhile we and the Zeppelin community continues to add new features. We now give you the final technical preview of Zeppelin, based on snapshot of Apache Zeppelin 0.6.0. The main features in this Zeppelin technical preview are: Ambari Managed Installation Zeppelin Livy integration Security
Execute jobs as authenticated user Zeppelin authentication against LDAP Notebook Authorization Prerequisites: HDP 2.4.2 is installed The cluster contains Spark 1.6 or 1.5 Git is installed on the node running Ambari Server
You can install git as ‘ sudo yum install git’ Java 8 is installed on the node where Zeppelin is installed This document provides instructions for : Setting up Zeppelin on HDP 2.4.2 with Spark 1.6
Ambari Managed Install Running Zeppelin against Spark on YARN with Livy interpreter Authentication with Zeppelin Authenticate users against LDAP Access Control on Notebooks Note, while both Ambari managed and Manual install instructions are provided, you only need to follow either one to get Zeppelin setup in your cluster. HDP Cluster Requirement This technical preview can be installed on any HDP 2.4.2 cluster, whether it is a multi-node cluster or a single-node HDP Sandbox. The following instructions assume that Spark (version 1.6 ) is already installed on the HDP cluster. Ambari Managed Zeppelin Install Step 1: Download the Zeppelin Ambari Stack Definition On the node running Ambari server, run the following sudo git clone https://github.com/hortonworks-gallery/ambari-zeppelin-service.git /var/lib/ambari-server/resources/stacks/HDP/2.4/services/ZEPPELIN Step 2: Re-start Ambari Server sudo service ambari-server restart Step 3: Add Zeppelin Service with Ambari Make sure to install Zeppelin Service to a node where Spark Client’s are installed. Once Ambari comes back up and the services turn green, you can click on 'Add Service' from the 'Actions' dropdown menu in the bottom left of the Ambari dashboard: Make a note of the node selected to run Zeppelin service, call this ZEPPELIN_HOST On bottom left -> Actions -> Add service -> check Zeppelin service -> Next -> Next -> Next -> Deploy. Accept all the default values and hit deploy button. Step 4: Launch Zeppelin Once Zeppelin is deployed, launch http://ZEPPELIN_HOST:9995 in your browser. Try out included Zeppelin tutorial. There are a few Zeppelin notebooks available at Hortonworks Zeppelin Gallery. Please try them out. The rest of the steps described in the doc are optional and needed for additional functionality around security. Optional: Enable Zeppelin for Security This section shows configuration to allow Zeppelin to authenticate end-user. Zeppelin uses Livy to execute jobs with Spark on YARN as the end user. These are the high level steps to enable Zeppelin Security: Configure Zeppelin for Authentication Install Livy Server and Configure Livy with Zeppelin Optionally, enable access control on Zeppelin notebook. Configure Zeppelin for Authentication Note, when Zeppelin is authenticating end users, and Livy propagates the end-user identity to Hadoop, the end-user needs to exist on all nodes. In production you can leverage sssd or pam for this, but for now manually add user1 to all hosts in your cluster. E.g to run as sample user “user1” run the below as OS root equivalent on all your worker nodes. useradd user1 -g hadoop As HDFS admin, create HDFS home for user1 su hdfs
hdfs dfs -mkdir /user/user1
hdfs dfs -chown user1 /user/user1 Note if you configure Zeppelin to run as another user, you need to add that user to the OS and create HDFS home directory for that user. Edit Zeppelin’s shiro config On the node where Zeppelin server is installed, manually edit /usr/hdp/current/zeppelin-server/lib/conf/shiro.ini and ensure the following in URL section [urls]
/api/version = anon
#/** = anon
/** = authcBasic You can use users defined in shiro for authentication. E.g enable the section to authenticate as user1/password2. [users]
admin = password1
user1 = password2
user2 = password3 Alternatively, to use LDAP as identity store by configuring the section below for your ldap. [main]
#ldapRealm = org.apache.shiro.realm.ldap.JndiLdapRealm
#ldapRealm.userDnTemplate = cn={0},cn=engg,ou=testdomain,dc=testdomain,dc=com
#ldapRealm.contextFactory.url = ldap://ldaphost:389
#ldapRealm.contextFactory.authenticationMechanism = SIMPLE Restart Zeppelin server You can use Ambari to restart Zeppelin server. Ignore the error in Ambari during Zeppelin restart, Zeppelin starts fine. Access Zeppelin-Tutorial and login as user1/password2 (or any user defined in your LDAP) Note: Logout functionality is not available in this technical preview but is being added. On the Zeppelin node, install Livy sudo yum install livy Configure Livy Server Create /etc/livy/conf/livy-env.sh with the following values. Ensure the path to Java is accurate for that node. export SPARK_HOME=/usr/hdp/current/spark-client
export JAVA_HOME=/usr/jdk64/jdk1.8.0_60
export PATH=/usr/jdk64/jdk1.8.0_60/bin:$PATH
export HADOOP_CONF_DIR=/etc/hadoop/conf
export LIVY_SERVER_JAVA_OPTS="-Xmx2g" Create /etc/livy/conf/livy-defaults.conf with the following content. livy.impersonation.enabled = true On the node where Livy is installed, create ‘livy’ user to run the Livy process as user livy. useradd livy -g hadoop Create livy’s logs directory and grant user ‘livy’ permissions to write to it. mkdir /usr/hdp/current/livy-server/logs
chmod 777 /usr/hdp/current/livy-server/logs
On Livy node, edit /etc/spark/conf/spark-defaults.conf to add the following spark.master yarn-client Step 5: Grant user livy the ability to proxy users in Hadoop’s core-site.xml Use Ambari to search add to the /etc/hadoop/conf/core-site.xml the following and restart HDFS with Ambari. See screenshot. <property>
<name>hadoop.proxyuser.livy.groups</name>
<value>*</value></property><property>
<name>hadoop.proxyuser.livy.hosts</name>
<value>*</value>
</property> Step 6: Start Livy server Launch Livy server as user ‘livy’ cd /usr/hdp/current/livy-server
su livy
./bin/livy-server start Step 7: Configure Zeppelin to use Livy In Zeppelin, notebooks are run against the configured Interpreters. Go to your notebook and click on interpreter bindings. On the next page select the interpreters you want to use. Note the interpreter selection is done via clicking on a interpreter in a toggle manner. The unselected interpreter appears in white color. You can reorder the interpreter available to your notebook by drag and drop of interpreter. E.g below screenshot shows Livy Spark interpreter is selected ahead of Spark and launch with %lspark Step 8: Confirm Livy Interpreter setting Note the below Livy interpreter setting. If you have Livy installed on another node, replace localhost in the Livy url with the Livy host. If you make any changes to Livy interpreter setting, make sure to re-start Livy interpreter. Step 9: Run Notebooks with Livy Interpreter. Livy support, Spark, SparkSQL, PySpark & SparkR. To run notes with Livy, make sure to use the corresponding magic string at the top of your note. E.g %lspark for Scala code to run via Livy or %lspark.sql to run against SparkSQL via Livy. To use SQLContext with Livy, make sure to not create any SQLContext explicitly since we create it by default. I.e. remove the following lines from your SparkSQL note. //val sqlContext = new org.apache.spark.sql.SQLContext(sc)
//import sqlContext.implicits._ Configure Zeppelin to authorize end-users to Zeppelin notebooks. With HDP 2.4.2, Zeppelin provides access control on each notebook. Click the lock icon on the notebook to configure access to that notebook. On the next popup add users who should have access to the policy. Refer to below screenshot Note with identity propagation enabled with Livy, the data access to controlled by the data source being accessed. E.g when you access HDFS as user1, the data access is controlled by HDFS permissions. Import External Libraries Often in the notebook you will want to use one or more libraries. For example, to run Magellan – you need to import its dependencies. To create a notebook to explore Magellan, you will need to include the Magellan library in your environment. There are several ways in Zeppelin to include an external dependency. Using the %dep interpreter. Note: this will only work for libraries that are published to Maven. %dep
z.load("group:artifact:version")
%spark
import...
Here is an example to import dependency for Magellan
%dep
z.addRepo("Spark Packages Repo").url("http://dl.bintray.com/spark-packages/maven")
z.load("com.esri.geometry:esri-geometry-api:1.2.1")
z.load("harsha2010:magellan:1.0.3-s_2.10")
For more information, see https://zeppelin.incubator.apache.org/docs/interpreter/spark.html#dependencyloading.
When you have a jar on the node where Zeppelin is running, the following approach can be useful:
Add spark.files property at SPARK_HOME/conf/spark-defaults.conf; for example:spark.files /path/to/my.jar
When you have a jar on the node where Zeppelin is running, this approach can also be useful:
Add SPARK_SUBMIT_OPTIONS env variable to the ZEPPELIN_HOME/conf/zeppelin-env.sh file; for example:export SPARK_SUBMIT_OPTIONS="--packages group:artifact:version" Stopping Zeppelin or Livy Server To stop the Zeppelin server, use Ambari. To stop Livy su livy; cd /usr/hdp/current/livy-server; ./bin/livy-server stop
... View more
Labels:
05-25-2016
11:12 PM
1 Kudo
I agree this is a major issue. I have the issue reproduced. Will find a fix.
... View more
05-25-2016
10:26 PM
@Smart Solutions Can you see if this solves your issue
... View more
05-25-2016
10:24 PM
Spark supports the following cluster modes:
Pseudo Cluster mode (everything runs on one node) - For debugging/developing Spark Standalone: Spark provides cluster manager facilities Spark on YARN : YARN provides Cluster manager facilities.
yarn-client mode: Spark Driver runs outside YARN yarn-cluster mode: Drivers also runs in YARN Spark on Mesos : Mesos provides Cluster manager facilities We don't supprot Spark on Mesos. For Spark on YARN specify mode by adding --master yarn-client or --master yarn-cluster on your Spark-submit command on a per job basis. Or configure it in spark-defaults.conf for all jobs submitted from that node. --master "spark://masterip:7077" indicates Spark standalone mode.
... View more
05-25-2016
12:14 AM
What are you trying to do?
... View more
05-25-2016
12:13 AM
You can have both HS2 & Spark Thrift Server running on the same node. To change the port of STS, modify hive.server2.thrift.port in advanced spark-hive-site-override.conf with Ambari Bot HS2 & STS can listen in binary (thrift) & HTTP. Binary is the default. I validated this with HDP 2.4.2.0-258
... View more
05-21-2016
08:35 AM
The key thing to remember is that in Spark RDD/DF are immutable. So once created you can not change them. However there are many situation where you want the column type to be different. E.g By default Spark comes with cars.csv where year column is a String. If you want to use a datetime function you need the column as a Datetime. You can change the column type from string to date in a new dataframe. Here is an example to change the column type. val df2 = sqlContext.load("com.databricks.spark.csv", Map("path" -> "file:///Users/vshukla/projects/spark/sql/core/src/test/resources/cars.csv", "header" -> "true"))
df2.printSchema()
val df4 = df2.withColumn("year2", 'year.cast("Int")).select('year2 as 'year, 'make, 'model, 'comment)
df4.printSchema
... View more
Labels:
05-20-2016
05:53 PM
1 Kudo
See https://community.hortonworks.com/articles/34424/apache-zeppelin-on-hdp-242.html for security (authentication/access control) with Zeppelin.
... View more