Find and share helpful community-sourced technical articles
Recently active
Garbage CollectionBest Practice GC ConfigurationThis is an example implementation of our current recommendation for best practice GC tuning, driven by requirements of the NameNode:export HADOOP_NAMENODE_OPTS="-Dcom.sun.management.jmxremote -XX:+UseConcMarkSweepGC -XX:ParallelGCThreads=8 -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 -Xms1G -Xmx1G -XX:NewSize=128M -XX:MaxNewSize=128M -XX:PermSize=128M -XX:MaxPermSize=256M -verbose:gc -Xloggc:/Users/chris/hadoop-deploy-trunk/hadoop-3.0.0-SNAPSHOT/logs/gc.log-`date +'%Y%m%d%H%M'` -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:ErrorFile=/Users/chris/hadoop-deploy-trunk/hadoop-3.0.0-SNAPSHOT/logs/hs_err_pid%p.log -XX:+HeapDumpOnOutOfMemoryError $HADOOP_NAMENODE_OPTS"This is from a small development environment, so the heap is much smaller (1 GB) than what you’ll see in a real production cluster.In the past, we’ve shared with you what to use for GC settings, but have we ever explained why?GC T
I was looking for a way to easily forward and analyze provenance data that is available in nifi. There were a couple of options available. You could use the nifi-rest api to search for provenance data and then use the results for analysis or storing in a database. The other alternative was to setup a Site2Siteprovenancereportingtask in nifi. This will forward provenance events to a flow in nifi. option 1 is a very techy option , you could point you UI directly to the rest api and present a nice provenance visual with bulk replay capabilities. But, then it makes the developer responsible for keeping up with changes in the nifi rest api. It would be nice if we did not have direct dependency. Also, you might want to lockdown the rest api in production.option 2 is very easy , but it is limited in where i can send those provenance events.The apache nifi eng team resolved this situation with a ScriptedReportingTask controller service. It gives you an easy way of setting up the provenance r
Word Count using Spark Streaming in PysparkThis is a WordCount example with the followingLocal File System as a sourceCalculate counts using reduceByKey and store them in a temp tableQuerying running counts through SQL Setup: Define the function that sets up the StreamingContextThis function has to create a new StreamingContext and set it up with all the input stream, transformation and output operations.But it must not start the StreamingContext, it is just to capture all the setup code necessary for your streaming application in one place. from pyspark.streaming import StreamingContextbatchIntervalSeconds = 10 def creatingFunc(): ssc = StreamingContext(sc, batchIntervalSeconds) # Set each DStreams in this context to remember RDDs it generated in the last given duration. # DStreams remember RDDs only for a limited duration of time and releases them for garbage # collection. This method allows the developer to specify how long to remember the RDDs ( # if the developer wishes
Sentiment CoreNLP Processor[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP -Adding annotator tokenize[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.TokenizerAnnotator- No tokenizer type provided. Defaulting to PTBTokenizer.[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP -Adding annotator ssplit[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP -Adding annotator parse[pool-1-thread-1] INFO edu.stanford.nlp.parser.common.ParserGrammar- Loading parser from serialized file edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz... done [0.4 sec].[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP -Adding annotator sentimentFILE:Header,Header2,Header3Value,Value2,Value3Value4,Value5,Value6Attribute: {"names":"NEGATIVE"}Service Source CodeJUnit Test for ProcessorTo Add Sentiment Analysis to Your NiFi Data Flow, just add the custom processor, CoreNLPProcessor. You can downloada pre-built NAR from the github listed below. Add to yo
Create a HANA table for demo purposes firstCREATE COLUMN TABLE "CODEJAMMER"."STORE_ADDRESS" (ID bigint not null primary key ,"STREETNUMBER" INTEGER CS_INT, "STREET" NVARCHAR(200), "LOCALITY" NVARCHAR(200), "STATE" NVARCHAR(200), "COUNTRY" NVARCHAR(200)) UNLOAD PRIORITY 5 AUTO MERGE ; insert into "CODEJAMMER"."STORE_ADDRESS" (ID,STREETNUMBER,STREET,LOCALITY,STATE,COUNTRY) values(1,555,'Madison Ave','New York','NY','America');insert into "CODEJAMMER"."STORE_ADDRESS" (ID,STREETNUMBER,STREET,LOCALITY,STATE,COUNTRY) values(2,95,'Morten Street','New York','NY','USA');insert into "CODEJAMMER"."STORE_ADDRESS" (ID,STREETNUMBER,STREET,LOCALITY,STATE,COUNTRY) values(3,2395,'Broadway Street','New York','NY','USA'); Configure the SAP JDBC Driver in Spark config to where the driver is saved on ALL the nodes . My example: /tmp/ngdbc.jar You can also load the ngdbc.jar using the zeppelin depency if you dont want to system wide access:z.reset() // clean up previously added artifact an
Prerequisites:* SAP HANA - Instructions to setup a Cloud HANA on AWS or Azurehttps://community.hortonworks.com/content/kbentry/58427/getting-started-with-sap-hana-and-vora-with-hdp-us.html* HDP 2.5.xWe will use Spark shell, scala code and data frames to access HANA using JDBC driver.Start the spark shell with ngdbc.jar driver.spark-shell --master yarn-client --jars /tmp/ngdbc.jarscala> val url="jdbc:sap://xxxx:30015/?currentschema=CODEJAMMER"url: String = jdbc:sap://xxxx:30015/?currentschema=CODEJAMMER scala> | val prop = new java.util.Propertiesprop: java.util.Properties = {} scala> prop.setProperty("user","xxxx")res1: Object = null scala> prop.setProperty("password","xxxx")res2: Object = null scala> prop.setProperty("driver","com.sap.db.jdbc.Driver")res3: Object = null scala> scala> val emp_address = sqlContext.read.jdbc(url,"EMPLOYEE_ADDRESS",prop)emp_address: org.apache.spark.sql.DataFrame = [ID: bigint, STREETNUMBER: int, STREET: string, LOCALITY: string,
Prerequisites: * NIFI 1.0+ * SAP HANA - Instructions to setup a Cloud HANA on AWS or Azure: https://community.hortonworks.com/content/kbentry/58427/getting-started-with-sap-hana-and-vora-with-hdp-us.html SETUP:HANA (Source Database)In this setup we will create a table in HANA table. First follow this HCC article "Demo data in SAP Vora Using Eclipse HANA Modelling tools - Part 3"You will need to download Eclipse Neon - Eclipse IDE for Java Developers to connect to the SAP HANA that we setup in Part 1 . After you setup eclipse we will need to configure Eclipse to install HANA Modelling tools that will allow us to connect to SAP HANA and execute sql scripts to setup demo data that we will use from SAP Vora.After you establish connection to your HANA system. Run this code:DROP TABLE "CODEJAMMER"."EMPLOYEE_ADDRESS"; CREATE COLUMN TABLE "CODEJAMMER"."EMPLOYEE_ADDRESS" (ID bigint not null primary key generated by default as IDENTITY,"STREETNUMBER" INTEGER CS_INT, "STREET" NVARCHAR(200), "
AssumptionsThe following assumptions are made. The openldap clients and server are already installed. The basic setup of the ldap server has been completed and users "nifi admin", "nifi user1" and "nifi user2" are in the ldap database.LDAPS System ConfigurationThe example below is being configured on system nifi-sme-20. The CA certificate being used, aka truststore, is called, all-trusted.jks and the server certificate, aka keystore, is called nifi-sme-20.cert.pfx. There is also the encrypted private key for the server, nifi-sme-20.key.enc.pem which is needed for the configuration of the ldaps service. List the current certificates in the database, the default location is /etc/openldap/certs, using the following command:certutil -d /etc/openldap/certs/ -LOutput will look like the followingIf your CA is in pem format, then it can be imported into the NSS database. If you have a CA that is in jks format, it first must be converted before it can be imported.Converting it can be done
SparkR is an R package that provides a lightweight front end for using Apache Spark from R, thus supporting large-scale analytics on Hortonworks Data Platform (HDP) from the R language and environment. As of Spark 1.6.2, SparkR provides a distributed data frame implementation that supports operations like selection, filtering, and aggregation on large datasets. In addition, SparkR supports distributed machine learning through MLlib.ArchitectureSparkR which was introduced to Spark in version1.4 consists of wrappers over DataFrames and DataFrame-based APIs. In SparkR, the APIs are similar to existing ones in R (or R packages), rather than Python/Java/Scala APIs. The reason is that SparkR is very popular is primarily because it allows users to write spark jobs while staying entirely in the R framework/model. A SparkDataFrame is a distributed collection of data organized into named columns. It is conceptually equivalent to a table in a relational database or a data frame in R, but with ric
OVERVIEWThis facility is available in Zeppelin 0.7.0 based on the JIRA: https://issues.apache.org/jira/browse/ZEPPELIN-1320. The below steps allow you to get this working in HDP 2.5 environment with Zeppelin 0.6.ENVIRONMENT and SETUPI did test the below solution with HDP 2.5.0.0-1245Ambari 2.4.0.1Shiro.ini[users]# List of users with their password allowed to access Zeppelin.# To use a different strategy (LDAP / Database / ...) check the shiro doc at http://shiro.apache.org/configuration.html#Configuration-INISectionsadmin = passworduser1 = password, role1, role2user2 = password, role3#user3 = password4, role2# Sample LDAP configuration, for user Authentication, currently tested for single Realm[main]#activeDirectoryRealm = org.apache.zeppelin.server.ActiveDirectoryGroupRealm#activeDirectoryRealm.systemUsername = CN=Administrator,CN=Users,DC=HW,DC=EXAMPLE,DC=COM#activeDirectoryRealm.systemPassword = Password1!#activeDirectoryRealm.hadoopSecurityCredentialPath = jceks://user/zeppelin/ze
SYMPTOM:hive> create table mytab (col1 int) location '/tmp/abc';FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:java.security.AccessControlException: Permission denied: user=dbloader, access=WRITE, inode="/user/hive":hive:hadoop:drwxr-xr-x at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.check(FSPermissionChecker.java:319) at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkPermission(FSPermissionChecker.java:219) at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkPermission(FSPermissionChecker.java:190) at org.apache.hadoop.hdfs.server.namenode.FSDirectory.checkPermission(FSDirectory.java:1780) at org.apache.hadoop.hdfs.server.namenode.FSDirectory.checkPermission(FSDirectory.java:1764) at org.apache.hadoop.hdfs.server.namenode.FSDirectory.checkPathAccess(FSDirectory.java:1738) at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.ch
When you build a cluster and enable Kerberos , by default Ambari creates/uses default principal names. here is the steps to enable the Kerberos using Blueprint/APIs. 1. Blueprint: Create a blueprint. API- POST - http://apappu3.hdp.com:8080/api/v1/blueprints/cbp Payload - { "configurations" : [ { "zoo.cfg" : { "properties" : { "dataDir" : "/data/hadoop/zookeeper", "initLimit": "5", "syncLimit": "2", "maxClientCnxns": "0" } } } ], "host_groups" : [ { "components" : [ { "name" : "HIVE_SERVER" }, { "name" : "HISTORYSERVER" }, { "name" : "HIVE_METASTORE" }, { "name" : "ZOOKEEPER_CLIENT" }, { "name" : "WEBHCAT_SERVER" }, { "name" : "ZOOKEEPER_SERVER" }, { "name" : "APP_TIMELINE_SERVER" }, { "name" : "RESOURCEMANAGER" }, {
Permissions are available under existing notebook -> padlock buttonThere are three different permissions: Owners – this is the owner(s) of the notebook. This permissions allows owners to give further - read/write - permission to that notebookReaders – these users can only read scripts created in the section of that notebook. They can neither execute nor edit the scripts - see belowWriters – these users can edit the scripts in notebook. With that permissions the users can also read the notebook. Hence, there is no need to add them to be Reader as wellReader users:When they try to execute the scriptWhen they edit the script - the screen comes up after few seconds. But the content create is not saved
In Zeppelin LDAP Authentication with OpenLDAP and How to Set Up OpenLDAP we've shown how to use LDAP Authentication with Zeppelin. In this article, we'll harden that configuration by ensuring that Zeppelin and OpenLDAP communicate over LDAPS.LDAPS is a secure protocol that uses TLS to assure authenticity, confidentiality, and integrity of communications. This prevents man-in-the-middle attacks that sniff traffic to discover LDAP credentials communicated in plaintext, which could compromise the security of the cluster.The first step is to modify the configuration of the OpenLDAP server, as root, to expose LDAPS connectivity, we'll need to modify /etc/openldap/ldap.conf. Please recall that we created /etc/openldap/certs/myldap.field.hortonworks.com.cert in the How to Set Up OpenLDAP article#TLS_CACERTDIR /etc/openldap/certsTLS_CACERT /etc/openldap/certs/myldap.field.hortonworks.com.certURI ldaps://myldap.field.hortonworks.com ldap://myldap.field.hortonworks.comBASE dc=field,dc=hortonwor
Auto-recovery in Ambari is a useful way of getting cluster components restarted automatically in the event that a component fails (without the need for human intervention).Ambari 2.4.0 introduced dynamic auto-recovery, which allows auto-start properties to be configured without needing an ambari-agent / ambari-server restart. Currently, the simplest way to manage the auto-recovery features within Ambari is via the REST API (documented within this article), although on-going work in the community will bring the feature to the UI: https://issues.apache.org/jira/browse/AMBARI-2330Check Auto-Recovery SettingsTo check if auto-recovery is enabled for all components, run the following command on the Ambari server node:curl -u admin:<password> -i -H 'X-Requested-By: ambari' -X GET http://localhost:8080/api/v1/clusters/<cluster_name>/components?fields=ServiceComponentInfo/component_name,ServiceComponentInfo/service_name,ServiceComponentInfo/category,ServiceComponentInfo/recovery_ena
Whether you're creating an Ambari cluster from scratch, taking over an existing cluster, or growing your cluster over time, it is imperative to tune Ambari and MySQL to work at a large scale of 1000-3000 Ambari Agents.Ambari Server Configs First, increase the memory used by Ambari. For large clusters, 8 GB of memory should be sufficient. If you have more than 10 concurrent users, increase it to 16 GB. Edit /var/lib/ambari-server/ambari-env.sh and change the -Xmn setting. export AMBARI_JVM_ARGS=$AMBARI_JVM_ARGS' -Xms2048m -Xmx8192m Edit /etc/ambari-server/conf/ambari.properties with the following configs # The size of the Jetty connection pool used for handling incoming Ambari Agent requests.# 10 hosts => 25# 50 hosts => 35# 100 hosts => 75# 500 hosts => 100 agent.threadpool.size.max=100# Determines whether current alerts should be cached.# Enabling this can increase performance on large cluster, but can also result in lost alert data# if the cache is not flushed freque
Here is a high level overview of how to deploy Solr if approached cautiously.RequirementsInstallEdit Configuration files to work with HDFSChanging to ‘Solr’ userAdding NodesStarting SolrCloudCreating a collectionVerify & Enjoy#Requirements for this guideInstallation on a Linux server.Solr 5.5.0 requires Java 1.7 and higher.HDP 2.3 or 2.4Apache ZooKeeper — HDP 2.3 or 2.4 and Solr both use Apache ZooKeeper to manage services for the cluster. The ZooKeeper ensemble that you are using for HDP 2.3 or 2.4 can also be used by Solr.This guide doesn’t include Kerberos requirements.#Install Lucidworks-HDPsearch packageyum install lucidworks-hdpsearchAfter installation, the HDPSearch files will be found in this directory./opt/lucidworks-hdpsearch Install only — DO NOT START SOLR SERVICE YETThe Lucidworks HDP Search package should be installed manually on each node of the cluster. Follow this guide on 1 machine first. Then go and start service on each node in cluster (See Adding nodes section
SYMPTOM: HDP upgrade failed on "Finalize". Tried setting the version manually using below command which was failing -ambari-server set-current --cluster-name=<ClusterName> --version-display-name=HDP-2.5.3.0ERROR: Please find error screenshot below - ROOT CAUSE: There was issue with the last "request_id" which was run by Express upgrade process. you can check the last request_id from ambari DB from table name "host_role_command" RESOLUTION:1. Backup the ambari DB2. Find the last "request_id" from table "host_role_command" and check the status of the request_id.3. In my case the status was "Failed"4. Modifying the status of the request_id from "FAILED" to "COMPLETED" and restart ambari server.5. Try running the command againambari-server set-current --cluster-name=<ClusterName> --version-display-name=HDP-2.5.3.0
Preparing a Raspberry PI to Run TensorFlow Image RecognitionI can easily have a Python script that polls my webcam (use official Raspberry Pi webcam) , calls TensorFlow and then sends the results to NiFi via MQTT.You need to install Python MQTT Library (https://pypi.python.org/pypi/paho-mqtt/1.1)For setting up Python, Raspberry PI with Camera, see https://dzone.com/articles/picamera-ingest-real-timeRaspberry Pi 3 B+ preparationBuy a good quality 16 GIG SD Card and from OSX, Run SD Formatter to Overwrite Format the device at FAT, download here: https://www.sdcard.org/downloads/formatter_4/. Download the BerryBoot image from here. Unzip it and then copy it to your complete SD card.For examples of RPi TensorFlow You Can Run:https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/pi_examples/You need to build tensorflow for pi, which took me over 4 hours.See:https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/makefilehttps://github.com/tensorflow/ten
Ensure yarn container size is optimized for spark. No more than 1-2 containers per CPU core.Minimize the use of <operation>ByKey (other than reduceByKey, which is recommended). These functions have a lot of overhead shuffling data via the internal hashtables. While they are useful, they should be utilized sparingly to get the best performance.Don't always rely on the default rdd partitioning. It will generally always split things into 100 pieces unless otherwise defined. Redefining that default in a way that makes sense for dataset sizes and number of containers will get better performance. If there isn't a fixed number that works across the board, manually repartitioning early in jobs can help to speed things up.Use the G1 garbage collector instead of the parallel garbage collector. It takes a little fine tuning with memory, but it performs better.Use dataframes where possible. As progressive versions of spark roll out, there is a lot of performance optimization of dataframes op
How to use Ambari View for HAWQ Query Monitoring? This beta version of Ambari HAWQ View provides live query monitoring directly in Ambari UI, displaying a list of queries running in a HAWQ cluster. This allows admins to see the database activity on the UI in a user-friendly interface. The view front-end is based on EmberJS framework. The Java backend extends the framework provided by the ambari-views project. The front-end polls the REST API every 5 seconds, querying the pg_stat_activity view and rendering reformatted data on the UI.How to Deploy: Deployment simply requires copying the hawq-view jar to the ambari-server host and restarting ambari-server. ssh into ambari_server_host $ cd /var/lib/ambari-server/resources/views/$ curl -O https://s3-us-west-2.amazonaws.com/pivotal-ambari/stable/hawq-view/hawq-view-1.0.0.0-1.jar$ ambari-server restartCreating an Instance of HAWQ View: a) The HAWQ View instance connects to the HAWQ Master through JDBC. Ensure that HAWQ pg_hba.conf is upd
Livy: Livy is an open source REST interface for interacting with Spark. Authorized users can launch a Spark session and submit code. Two different users can access their own private data and session, and they can collaborate on a notebook. Only the Livy server can submit a job securely to a Spark session.Steps to follow to configure livy interpreter to work with secure HDP cluster:Setup proxy for livy interpreter in core-site.xmlGo to Ambari->HDFS->config->customer-core-site and add below properties: hadoop.proxyuser.livy.groups=* hadoop.proxyuser.livy.hosts=*2. Configure livy interpreter in Zeppelin and add below configurations:livy.superusers=zeppelin-spark Note - The value for livy.superusers should be your zeppelin principal. That would be zeppelin-{$Cluster_name} For example, in this case you can find it by running below command: klist -kt /etc/security/keytabs/zeppelin.server.kerberos.keytabKeytab name: FILE:/etc/security/keytabs/zeppelin.server.kerberos.keytabKVNO Times
Apache Ranger uses an embedded Tomcat server to provide the Web UI functionality for administration of Ranger. A previous HCC article provided details on maintenance of the log files that are managed by the log4j configuration, including xa_portal.log, ranger_admin_perf.log, xa_portal_sql.log. We're going to focus on maintenance of the access_log* logs that get automatically generated by Tomcat, but which are not managed by this log4j configuration. With embedded Tomcat, the configuration is contained within the code for the AccessLogValve (as you can see, it uses an hourly rotation pattern unless overridden by ranger.accesslog.dateformat). We'll use the logrotate application in CentOS/RHEL to manage these access_log* logs as the number of files can grow large without rotation and removal in place. You can check to see how many of these files you have on your Ranger Admin node by running (there would be one access_log* file per hour for each day during which the service has ran con
This is the first of a series of short articles on using Apache Spark with Hortonworks HDP for beginners. If you’re reading this, you don’t need need me to define what Spark is, there are numerous references on the web that can speak about that its API, being data structure centric and in my opinion one of the most important Open Source projects. The intent of this article is let you know what helped me get started using Spark on the Hortonworks Data Platform. This is not a tutorial.I’m assuming you have access to a an HDP 2.5.3 cluster or to the Hortonworks Sandbox for HDP 2.5.3 or above. Also, I’m going to assume that you are familiar with SQL, Apache Hive, and using the Linux/Unix Bourne Shell. The problem I was having, which pushed me to use Spark was that using Hive for data processing was limiting. There were things I was used to using in my past life as an Oracle DBA that were not available. Hive is a fantastic product, but Hive SQL didn’t give me all the bells and whist
Just some clarifications to the instructions provided in this article. Hopefully, it will save you time to get you up and running faster.1) Nifi 401:Unauthorized ErrorIf you see a similar error message in the Nifi console:ERROR [Timer-Driven Process Thread-6] o.a.nifi.processors.standard.PostHTTP PostHTTP[id=834bb9f9-a15d-42bd-8d7a-3f00c810d729] Failed to Post StandardFlowFileRecord[uuid=bc74e1c5-12e7-4da2-93b4-a3dc624218ac,claim=StandardContentClaim [resourceClaim=StandardResourceClaim[id=1471370511531-1, container=default, section=1], offset=11780, length=407],offset=0,name=12406098021784,size=407] to http://gcm-http.googleapis.com/gcm/send: response code was 401:Unauthorizedand when you click "Notify Customer" in the Analyst's console and no event is updated on the Android emulator in Android Studio.Resolution 401:Unauthorized ErrorOpen open the UpdateAttribute processor and add a new property called Authorization and set its value to key=your google browser key2) Wrong Google API n
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.