Dive into the community: get started with the basics, connect with peers, share your feedback, and discover helpful technical articles.
Recently active
In this article, I'll show how to analyze a real-time data stream using Spark Structured Streaming. I wanted to provide a quick Structured Streaming example that shows an end-to-end flow from source (Twitter), through Kafka, and then data processing using Spark. To accomplish this, I used Apache NiFi (part of Hortonworks HDF) to capture the Twitter data and send it to Apache Kafka. From here, Spark was used to consume each Twitter payload (as JSON), parse, and analyze the data in real-time. Before I jump into the technical details, it's good to understand some of the business value of this process. There are many practical applications based on this technology stack as well as the code that I describe below. Here are a few of the business applications that can be implemented using this technology: Security: Real-time log analysis allows organizations to extract IP addresses, ports, services and events. This data can then be aggregated based on a time window, analyzed, and monitored for
PROBLEM:Changed Ambari from root to non-root user and hiveview doesn't work. Ambari hive view fails with Usernames not matched error. ERROR: Service 'userhome' check failed:java.io.IOException: Usernames not matched: name=ambari-server-<cluster_name> != expected=<custom_user> at sun.reflect.GeneratedConstructorAccessor243.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at org.apache.hadoop.ipc.RemoteException.instantiateException(RemoteException.java:106)ROOT CAUSE: Configuration issue on Ambari Hive view definition as username doesn't match.SOLUTION: Navigate to Hive and YARN Configs in Ambari UI and change as below and restart respective services. A) Custom webhcat-site webhcat.proxyuser.<AMBARI_SERVER_PRINCIPAL_USER>.groups=*webhcat.proxyuser.<AMBARI_SERVER_PRINCIPAL_USER>.hosts=* B) Custom yarn-sit
###Finding Stale Configs- We can use the Ambari APIs to find the stale configurations. (Notice: ?HostRoles/stale_configs=true)http://erie1.example.com:8080/api/v1/clusters/ErieCluster/host_components?HostRoles/stale_configs=true- If there is no stale configuration present in the cluster then we might see the items as empty "[]". Output may be as following:{ "href" : "http://erie1.example.com:8080/api/v1/clusters/ErieCluster/host_components?HostRoles/stale_configs=true", "items" : [ ]}.- Now i intentionally made some changes to the "Advanced core-site.xml" from ambari and added the following properties to it, Just to see if it changes the stale configuration list.hadoop.proxyuser.joy.hosts=*hadoop.proxyuser.joy.groups=*.- As we made some changes and the affected components are not yet restarted hence we will see that there are few stale configuration present in the cluster then we might see the output something like following (Notice: "stale_configs" : true ){ "href" : "http://erie1
In Zeppelin 0.7.0 Document, it is said that library should use 0.13.Reference : How to execute HIVE LLAP queries from Zeppelin in HDP 2.6.1Hive Interpreter for Apache ZeppelinHowever it is too old.For LLAP, it need to be newer one.Properties : hive2.driver = org.apache.hive.jdbc.HiveDriverhive2.url = < can be obtained from ambari. check HiveServer2 Interactive JDBC URL >eg.hive2.url = jdbc:hive2://zzeng-hdp-3.example.com:2181,zzeng-hdp-1.example.com:2181,zzeng-hdp-2.example.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2-hive2Dependencies : org.apache.hive:hive-jdbc:2.2.0 org.apache.hadoop:hadoop-common:2.6.0 With this setting, I can access Hive LLAP now:
Integrating lucene-geo-gazetteer For Geo Parsing with Apache NiFi lucene-geo-gazetteer is a very cool Apache Tika, Apache Lucene and Apache OpenNLP tool that builds a fast index of geo data built from a large list of all countries data. It then provides a REST API that we can easily integrate into a flow. So I have connected this to a NiFi flow for enhancing and enriching Twitter data with Geo data. Example NiFi Flow To Convert Twitter Locations Into Geo Information Downloading the Countries Data and Building the Geo Indexes Calling the Local Geo Server Example JSON Data Returned Let's Pull out the fields we want after the split Let's build a new JSON file of just the fields we like including the new geo ones. Example JSON Processed {"msg":"RT @pauljauregui: Cybersecurity Startups Struggle - https://t.co/wADHLyUEEB #CyberSecurity #AI #IoT #IIoT #IndustrialIoT #DataSecurity #Sec…","unixtime":"1516754942404","friends_count":"4293","sentiment":"NEGATIVE","geolongitude"
There are several areas where a traditional RDBMS platform is used within an HDP environment, Ambari uses one to store the cluster configuration, Hive stores it's metastore information, Oozie stores its jobs and config and Ranger stores its policies.There are a range of DB options you can choose from for many different components, an example compatibility matrix is shown here: https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.6.0/bk_support-matrices/content/ch_matrices-ambari.html#ambari_database One element that is not very well documented is how much space may be required if you're starting down the path of building a fairly large cluster. There are a number of reasons for this, the main one being that it does actually vary with how the cluster is used.However that being said I've gathered some database, cluster and time metrics from a number of production environments used by Hortonworks customers and come up with a simple formula that may at least get you a rough order of magnit
This article provides an overview of various aspects of Monitoring Hive LLAP key metrics like Hive LLAP Configurations, YARN Queue setup, YARN containers, LLAP cache hit ratio, executors, IO elevator metrics, JVM Heap usage and non-heap usage… etcExecution EngineLLAP is not an execution engine (like MapReduce or Tez). Overall execution is scheduled and monitored by an existing Hive execution engine (such as Tez) transparently over both LLAP nodes, as well as regular containers. Obviously, LLAP level of support depends on each individual execution engine (starting with Tez).MapReduce support is not planned, but other engines may be added later. Other frameworks like Pig and Spark also have the choice of using LLAP daemons.Enabling LLAP, Setting up Memory per daemon, In-Memory cache per Daemon, Number of Node(s) for running Hive LLAP daemon (num_llap_nodes_for_llap_daemons) and Number of executors per LLAP daemon in Advanced Hive Interactive-site:Cache BasicsThe daemon caches metadata fo
One task everybody faces when setting up a new Hadoop cluster, is the allocation of services. Administrators of a cluster on the other hand might ask themselves, how are my services allocated? I have discussed the visualization of HDP clusters and services more often recently and therefore decided to share my application to visualize the current and future state of a cluster. (see link to hosted app at the end of the article)What does Service Allocation mean? Planning a Hadoop cluster involves many steps and tasks that need to be considered. Almost no setup is the same (although there are some similarities). The service allocation is the part that basically tells you what services and what components will be on which node and how many nodes you have or need. This can be quiet tedious and difficult, since not all services play along well with each other, every service has different hardware/setup requirements and adding many services can get confusing. This makes it even more important
Introduction and motivation Web scraping is a technique used often times to extract data from websites for further processing. Many use cases involve data extraction from web sites as a prerequisite; the following are some examples: Data mining Online price change monitoring and price comparison Website change detection Web data integration Web scraping presents many challenges, and the complexity of the process to extract data from websites depends on the complexity of the website itself (ie. website structure, client-side frameworks, etcetera). I tend to think of web scraping as a three-stage process: Fetching and extracting web pages containing relevant data. This step is also known as web crawling. Raw data refinement, which is all about parsing, filtering, formatting and enriching the data extracted previously. More often than not, the goal of this step is to give some format to semi-structured data coming from websites. Outcome dispatching. Based on what I’ve seen in the field
If Ranger is setup to use Solr to store audits, it is necessary to configure Solr and Ranger Solr collection properly in order to keep our system stable. Here, there is no any magic number about the number of Solr nodes/shards, because with Ranger the required numbers are based on the load (generated by master components). If there are lots of ongoing jobs on your cluster, obviously it will generate more audits. (It matters more how busy is your cluster than how many machines do you have – of course, if you have more resources, then your system can handle more load)Ambari Infra Solr load test on Ranger Solr collectionIn order to get the proper (approximate) Solr settings with Ranger audits, we had to do some scale/load testing. For this purpose we also need something to visualize the results, because we need to understand what happened during the load. Here we can use AMS + Grafana. As Ambari Infra uses Solr 5.5.2, it has no Solr Metrics API in that Solr release, so we need a compone
Apache NiFi 1.0.0 has a lot of cool features, but no JSON-to-CSV converter yet.For my use case, I wanted to split one JSON file that had 5,000 records into 5,000 CSVs. You could also through a MergeContent processor in there and make one file. My data came from the excellent test data source, RandomUser. They provide a free API to pull down data, https://api.randomuser.me/?results=5000&format=pretty. I chose pretty to get formatted JSON with multiple lines which is easier to parse.This is an example of JSON returned from that service:{"results":[{"gender":"male","name":{"title":"monsieur","first":"lohan","last":"marchand"},"location":{"street":"6684 rue jean-baldassini","city":"auboranges","state":"schwyz","postcode":9591},"email":"lohan.marchand@example.com","login":{"username":"biggoose202","password":"esther","salt":"QIU1HBsr","md5":"9e60da6d4490cd6d102e8010ac98f283","sha1":"3de3ea419da1afe5c83518f8b46f157895266d17","sha256":"c6750c1a5bd18cac01c63d9e58a57d75520861733666ddb
Quick command to find the total number of partitions in a Kafka cluster, it could help for example in Mirror Maker sizing.Please replace ZK_SERVER values with your cluster details.cd /tmpzookeeper="ZK_SERVER1:2181,ZK_SERVER2:2181,ZK_SERVER3:2181"sum=0for i in $(/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --list --zookeeper $zookeeper ); do count=$(/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --describe --zookeeper $zookeeper --topic $i |grep Leader | wc -l); sum=`expr $sum + $count` ; echo 'total partitions is ' $sum; doneIf you want to count partitions with specific filter on the name for Topicszookeeper="ZK_SERVER1:2181,ZK_SERVER2:2181,ZK_SERVER3:2181"sum=0for i in $(/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --list --zookeeper $zookeeper | grep 'FILTER'); do count=$(/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --describe --zookeeper $zookeeper --topic $i |grep Leader | wc -l); sum=`expr $sum + $count` ; echo 'total partitions is ' $sum; done
Create a Falcon ClusterIntroductionApache Falcon is a framework to simplify data pipeline processing and management on Hadoop clusters.It makes it much simpler to onboard new workflows/pipelines, with support for late data handling and retry policies. It allows you to easily define relationship between various data and processing elements and integrate with metastore/catalog such as Hive/HCatalog. Finally it also lets you capture lineage information for feeds and processes. In this tutorial, we are going to create a Falcon cluster by : Preparing up HDFS directories Creating two cluster entities (primaryCluster and backupCluster)Prerequisite Download Hortonworks Sandbox 2.5 Complete the Learning the Ropes of the Hortonworks Sandbox tutorial, you will need it for logging into Ambari as an administrator user.Once you have downloaded the Hortonworks Sandbox and run the VM, navigate to the Ambari interface on the port 8080 of the IP address of your Sandbox VM. Login with the usern
What: Executing Scala Apache Spark Code in JARS from Apache NiFiWhy: You don't want all of your scala code in a continuous block like Apache ZeppelinTools: Apache NiFi - Apache Livy - Apache Spark - ScalaFlows:Option 1: Inline Scala CodeApache Zeppelin Running the Same Scala Job (have to add the jar to interpreter for Spark and restart)Grafana Charts of Apache NiFi RunLog Search Helps You Find ErrorsRun Code For Your Spark ClassSetting up Your ExecuteSparkInteractive ProcessorSetting Up Your Spark Service for ScalaTracking the Job in Livy UITracking the Job in Spark UII was looking at doing this: Pull code from Git and put into a NiFi attribute, run directly. For bigger projects, you will have many classes and dependencies that may require a full IDE and SBT build cycle. Once I build a Scala jar I want to run against that.Example Codepackage com.dataflowdeveloper.exampleimport org.apache.spark.sql.SparkSessionclass Example () { def run( spark: SparkSession) { try {
Background:When installing HDF only, there used to be a default Grafana dashboard for NiFi with the general metrics of NiFi available. When installing HDF on top of an existing HDP cluster (with latest versions of stacks), there is no default dashboard for NiFi even though there are some for Storm and Kafka. This should be fixed for the next version.Problem Summary:Nifi dashboard not visible in Grafana after installing HDF over HDP.Root cause: json file is missing in the grafana directoryResolution: 2 Options 1. Import Json files using grafana dashboard (HDP) or 2. Copy json file as below cp /var/lib/ambari-server/resources/common-services/AMBARI_METRICS/0.1.0/package/files/grafana-dashboards/HDF/grafana-nifi-ho* /var/lib/ambari-server/resources/common-services/AMBARI_METRICS/0.1.0/package/files/grafana-dashboards/HDP/
The article describes how to install and configure Sparkmagic to run in HDP2.5 against Livy Server and Spark 1.6.2Reference:Using Jupyter with Sparkmagic and Livy Server on HDP 2.5 in HCC 1) Install Jupyter http://jupyter.org/install ###### Init venv## Just first timesudo yum install python-pip python-dev python-virtualenv -ymkdir ~/jupyter_env## After 2ndvirtualenv --system-site-packages ~/jupyter_envsource ~/jupyter_env/bin/activatecurl -O https://bootstrap.pypa.io/get-pip.pysudo python get-pip.pysudo easy_install -U pippython -m pip install --upgrade pip# for jupyter, it need gccsudo yum install gcc -ysudo pip install jupyter notebook ipython http://zzeng-hdp-ambari:8888/tree?token=17dfdcb7525ff7470a637752450bbd586f607eddccc86a7f 2) Use Jupyter to connect Spark Livy https://community.hortonworks.com/articles/70501/using-jupyter-with-sparkmagic-and-livy-server-on-h.html # Failed building wheel for pykerberos sudo yum install krb5-devel -ysudo -H pip install sparkmagicsudo pi
prerequisites: 1) You must have an MySQL Server database instance running to be used by Ranger. 2) Execute the following command on the Ambari Server host. Replace database-type with mysql|oracle|postgres|mssql|sqlanywhere and /jdbc/driver/path based on the location of corresponding JDBC driver: ambari-server setup --jdbc-db={database-type} --jdbc-driver={/jdbc/driver/path} 3) make sure root user have access to the db from ranger host and ranger kms host. eg: your ranger host is ranger.host.com & ranger kms host is ranger.kms.host.com then you should run following command on the mysql database: GRANT ALL ON *.* TO 'root'@'ranger.host.com' IDENTIFIED BY '<root_password>' WITH GRANT OPTION; GRANT ALL ON *.* TO 'root'@'ranger.kms.host.com' IDENTIFIED BY '<root_password>' WITH GRANT OPTION; flush privileges;Steps:1) go to the ambari and go to the add service wizard 2) select the ranger and ranger kms host 3) make sure you fill following properties carefully in Ranger &am
Another of people have asked at the Future of Data Meetup (https://www.meetup.com/futureofdata-princeton/) how they can automate the deployment, versioning and other operations around Apache NiFi. Fortunately, there is a project that is current, very easy to use and now available in version 0.8. That tool that you need is here: https://github.com/Chaffelson/nipyapi The nipyapi does it all. As you can see in the screenshot above, you can even run it in Apache Zeppelin if it's installed on your HDP cluster.Installation and SetupThis is very simple. I have installed in on HDP and HDF nodes in Centos 7 and on my Mac in both version 2.7 and 3.x. You will need Python and PiP to get started.For most people you can quickly install via:pip install nipyapiIf not, you can clone the repo and then:pip install -r requirements.txt && pip install -r requirements_dev.txtTo quote, @Dan Chaffelson NiPyApi v0.8.0 released!The#Python Client for@apachenifi now supports secured environm
Goals Get basic understanding on how variables are set at HiveCLI and Beeline utilitiesRetrieving values from table based on variabelsCreating views based on variablesExecuting multiple statements using session variables via HiveCLI and Beeline Manipulating variables at runtime within one session (possible only at hiveCLI)HiveCLIVariables can be set at the session level or while launching the hive shell.Setting session variable while launching hive shell[hive@sandbox ~]$ hive -hiveconf myvar=2016-01-01Logging initialized using configuration in file:/etc/hive/2.3.2.0-2950/0/hive-log4j.propertieshive> set myvar;myvar=2016-01-01hive>OR Setting the variable at the runtime within Hive CLIhive> set myvar=2061-01-20 > ;hive> set myvar;myvar=2061-01-20hive>Performing SELECTs based on variable to retrieve datahive> select * from t_t1 limit 2;OKstring_1 2016-01-01string_2 2016-01-02Time taken: 4.904 seconds, Fetched: 2 row(s)hive> describe t_t1;OKf1
Objective This tutorial walks you through a NiFi flow that utilizes the PublishKafkaRecord_0_10 processor to easily convert a CVS file into JSON and then publish to Kafka. The tutorial is based on the blog "Integrating Apache Nifi with Apache Kafka", updated with the more recent record-oriented processors and controller services available in NiFi. Note: The record-oriented processors and controller services were introduced in NiFi 1.2.0. As such, the tutorial needs to be done running Version 1.2.0 or later.Environment This tutorial was tested using the following environment and components: Mac OS X 10.11.6 Apache NiFi 1.3.0 Apache Kafka 0.10.2.1PublishKafkaRecord_0_10 (CSV to JSON)Support Files Here is a template of the flow discussed in this tutorial: publishkafkarecord.xmlDemo ConfigurationKafka Download & Install The flow in this demo utilizes the PublishKafkaRecord_0_10 processor, which as the name implies, utilizes the Kafka 0.10.x Producer API. As a result, a
While enabling SSL for Ranger (I am writing for Ranger 0.4 from HDP2.2.4, configured by Ambari) I ran into issues loosing some days. The critical points areverify that property "Common Name For Certificate" in Ranger policy definition AND in Plugin configuration is matching the DN of your used certificateif you use HA enabled services like Namenode-HA, you have to use the same cert (at least) throughout both Namenodes to match the "Common Name for Certificate". !! Do not use the servers FQDN for the DN property at certification creation time !!This is the step-by-step instruction what I did to make it work. Please keep in mind that I will use ONE certificate throughout all nodes. If that does not match your security criteria, you have to adapt the steps accordinglycreate Ranger-admin keystore cd /etc/ranger/admin/conf/ sudo /usr/java/jdk1.7.0_79/bin/keytool -genkey -keyalg RSA -alias ranger-admin -keystore ranger-admin-keystore.jks -validity 360 -keysize 2048 -storepass <password
BackgroundStarting with Ambari-2.6.1 release, a new repository has been introduced called HDP-GPL. This article covers FAQs related to the purpose of this repository, when it takes effect and the impact it can have on your cluster esp. when dealing with LZO compression libraries. FAQsWhat is the need for a new GPL repo?LZO compression libraries use a GPL license, which differs from rest of the packages in Ambari/HDP which are Apache licensed. Hence, the need for a separate repo which is named ‘HDP-<version_number>-GPL’. The Version Definition File (VDF) starting HDP-2.6.4.0 release has been updated to include the new ‘HDP-2.6-GPL’ repo. Refer the sample VDF file for CentOS7 here. Here is a snippet from Ambari web UI for the new 'HDP-2.6-GPL' field:What are the exact contents of HDP-GPL repo?As of HDP-2.6.4.0 release, the repo contains hadooplzo package files as follows:hadooplzo_2_6_4_0_91-0.6.0.2.6.4.0-91.x86_64.rpmhadooplzo_2_6_4_0_91-native-0.6.0.2.6.4.0-91.x86_64.rpmHow is Am
Extracting Text or HTML from PDF, Excel and Word Documents via Apache NiFiThis version has been tested with HDF 3.1 and Apache NiFi 1.5. This processor is using Apache Tika 1.17 and is a non-supported Open Source Community processor that I have written.A user posted asking about HTML output, I took a look and it was easy so I added an option for that.Apache NiFi FlowYou must download or build the nifi-extracttextprocessor nar and put in your lib, then you can add the processor.Select html or textHere's is the autogenerate documentation:You can see we set the output mime.type to text/html.Apache NiFi Example Flow to Read a File and Convert to HTMLSource and Junit in EclipseExample Output HTML<html xmlns="http://www.w3.org/1999/xhtml"><head><meta name="pdf:PDFVersion" content="1.3"/><meta name="X-Parsed-By" content="org.apache.tika.parser.DefaultParser"/><meta name="X-Parsed-By" content="org.apache.tika.parser.pdf.PDFParser"/><meta name="xmp:CreatorTool"
Big Data DevOps: Part 2: Schemas, Schemas, Schemas. Know Your Records, Know Your DataTypes, Know Your Fields, Know Your Data.Since we can do process records in Apache NiFi, Streaming Analytics Manager, Apache Kafka and any tool that can work with a schema, we have a real need to use a Schema Registry. I have mentioned them before. One thing that is important is to be able to automate the management of schemas. Today we will be listing and exporting them for backup and migration purposes. We will also cover how to upload new schemas and version of schemas.The steps to backup schemas with Apache NiFi 1.5+ is easy.Backup All Schemas GetHTTP: Get the List of Schemas for SR via GET SplitJson to turn list into individual recordsEvaluateJsonPath: get the schema name.InvokeHTTP: get the schema bodyEvaluateJsonPath: turn the schema text into a separate flow fileRename and save both the full JSON record from the registry and the schema only.NiFi FlowInitial Call to List All Sche
This article discusses prerequisites required for Cloudbreak credential and addresses common issues. This article applies to Cloudbreak 2.4.0. When getting started with Cloudbreak, the most common pain point is creating the Cloudbreak credential, or - more precisely - meeting the prerequisites for the Cloudbreak credential. Why do you even need this Cloudbreak credential? Cloudbreak not only runs on your cloud provider account, but once you start using, it provisions resources (such as VMs) that run as part of your account and that you or your organization must pay for. Cloudbreak credential provides the means for Cloudbreak to authenticate with your cloud provider account and provision such resources. The exact details vary depending on the cloud provider: On Azure this is typically done by creating an app registration in Azure Active Directory and providing its details to Cloudbreak. On AWS this typically happens by assigning a proper IAM role to Cloudbreak. Cloudbreak can assu
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.