Hortonworks Data Platform Storm Guide (June 28, 2016)
Total Page:16
File Type:pdf, Size:1020Kb
Hortonworks Data Platform Storm Guide (June 28, 2016) docs.cloudera.com Hortonworks Data Platform June 28, 2016 Hortonworks Data Platform: Storm Guide Copyright © 2012-2016 Hortonworks, Inc. Some rights reserved. The Hortonworks Data Platform, powered by Apache Hadoop, is a massively scalable and 100% open source platform for storing, processing and analyzing large volumes of data. It is designed to deal with data from many sources and formats in a very quick, easy and cost-effective manner. The Hortonworks Data Platform consists of the essential set of Apache Hadoop projects including MapReduce, Hadoop Distributed File System (HDFS), HCatalog, Pig, Hive, HBase, ZooKeeper and Ambari. Hortonworks is the major contributor of code and patches to many of these projects. These projects have been integrated and tested as part of the Hortonworks Data Platform release process and installation and configuration tools have also been included. Unlike other providers of platforms built using Apache Hadoop, Hortonworks contributes 100% of our code back to the Apache Software Foundation. The Hortonworks Data Platform is Apache-licensed and completely open source. We sell only expert technical support, training and partner-enablement services. All of our technology is, and will remain, free and open source. Please visit the Hortonworks Data Platform page for more information on Hortonworks technology. For more information on Hortonworks services, please visit either the Support or Training page. Feel free to contact us directly to discuss your specific needs. Except where otherwise noted, this document is licensed under Creative Commons Attribution ShareAlike 4.0 License. http://creativecommons.org/licenses/by-sa/4.0/legalcode ii Hortonworks Data Platform June 28, 2016 Table of Contents 1. Using Apache Storm .................................................................................................... 1 1.1. Basic Storm Concepts ........................................................................................ 1 1.1.1. Spouts .................................................................................................... 2 1.1.2. Bolts ....................................................................................................... 3 1.1.3. Stream Groupings .................................................................................. 4 1.1.4. Topologies .............................................................................................. 4 1.1.5. Processing Reliability ............................................................................... 5 1.1.6. Workers, Executors, and Tasks ................................................................ 6 1.1.7. Parallelism .............................................................................................. 6 2. Installing and Configuring Storm ................................................................................ 12 2.1. Configuring Storm for Supervision ................................................................... 12 2.2. Saving Storm Audits to HDFS .......................................................................... 12 3. Topology Development Guidelines ............................................................................. 13 3.1. Debugging Topologies .................................................................................... 13 3.2. Determining Topology Parallelism Units ........................................................... 15 4. Streaming Data to Hive ............................................................................................. 16 5. Ingesting Data with the Apache Kafka Spout Connector ............................................ 19 5.1. KafkaSpout and OpaqueTridentKafkaSpout Examples ..................................... 19 5.2. Storm-Kafka API Reference ............................................................................. 20 5.3. KafkaSpout Limitations ................................................................................... 22 5.4. Configuring Kafka for Use with the Storm-Kafka Connector ............................. 23 5.5. Configuring KafkaSpout to Connect to a Secure Kafka Cluster ......................... 23 5.6. Configuring KafkaSpout to Connect to HBase or Hive ...................................... 24 6. Ingesting Data from HDFS ......................................................................................... 25 6.1. Configuring HDFS Spout .................................................................................. 26 6.2. HDFS Spout Example ....................................................................................... 26 7. Writing Data with Storm ............................................................................................ 28 7.1. Writing Data to HDFS ..................................................................................... 28 7.1.1. Storm-HDFS: Core Storm APIs ............................................................... 28 7.1.2. Storm-HDFS: Trident APIs ..................................................................... 30 7.2. Writing Data to HBase .................................................................................... 30 7.3. Writing Data to Kafka ..................................................................................... 32 7.4. Configuring Connectors for a Secure Cluster .................................................... 34 8. Packaging Storm Topologies ...................................................................................... 39 9. Deploying and Managing Apache Storm Topologies .................................................. 41 10. Example: RollingTopWords Topology ....................................................................... 43 iii Hortonworks Data Platform June 28, 2016 List of Tables 1.1. Storm Concepts ......................................................................................................... 1 1.2. Stream Groupings ..................................................................................................... 4 1.3. Processing Guarantees .............................................................................................. 5 3.1. Storm Topology Guidelines ...................................................................................... 13 4.1. HiveMapper Arguments .......................................................................................... 16 4.2. HiveOptions Class Configuration Properties ............................................................. 17 5.1. KafkaConfig Parameters .......................................................................................... 20 5.2. SpoutConfig Parameters .......................................................................................... 21 5.3. TridentKafkaConfig Parameters ............................................................................... 21 5.4. KafkaConfig Fields .................................................................................................. 21 5.5. SpoutConfig Parameters .......................................................................................... 22 5.6. TridentKafkaConfig Parameters ............................................................................... 23 7.1. SimpleHBaseMapper Methods ................................................................................. 31 8.1. Topology Packing Errors .......................................................................................... 40 9.1. Topology Administrative Actions ............................................................................. 41 iv Hortonworks Data Platform June 28, 2016 1. Using Apache Storm The exponential increase in data from real-time sources such as machine sensors creates a need for data processing systems that can ingest this data, process it, and respond in real time. A typical use case involves an automated system that responds to sensor data by sending email to support staff or placing an advertisement on a consumer's smart phone. Apache Storm enables such data-driven and automated activity by providing a realtime, scalable, and distributed solution for streaming data. Apache Storm can be used with any programming language, and guarantees that data streams are processed without data loss. Storm is datatype-agnostic; it processes data streams of any data type. A complete introduction to the Storm API is beyond the scope of this documentation. However, the next section, Basic Storm Concepts, provides a brief overview of the most essential concepts. See the Apache Storm documentation for a more thorough discussion of Apache Storm concepts. Experienced Storm developers may want to skip to later sections for information about streaming data to Hive; ingesting data with the Apache Kafka spout; writing data to HDFS, HBase, and Kafka; and deploying Storm topologies. The last section, RollingTopWords Topology, lists the source code for a sample application included with the storm-starter.jar. 1.1. Basic Storm Concepts Writing Storm applications requires an understanding of the following basic concepts. Table 1.1. Storm Concepts Storm Concept Description Tuple A named list of values of any data type. The native data structure used by Storm. Stream An unbounded sequence of tuples. Spout Generates a stream from a realtime data source. Bolt Contains data processing, persistence, and messaging alert logic. Can also emit tuples for downstream bolts. Stream Grouping Controls the routing of tuples to bolts