Book Image

Real-time Analytics with Storm and Cassandra

By : Shilpi Saxena
Book Image

Real-time Analytics with Storm and Cassandra

By: Shilpi Saxena

Overview of this book

Table of Contents (19 chapters)
Real-time Analytics with Storm and Cassandra
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

Storm, initially a project from the house of Twitter, has graduated to the league of Apache and thus rechristened from Twitter Storm. It is the brainchild of Nathan Marz that's now adopted by leagues of Cloudera's Distribution Including Apache Hadoop (CDH) and the Hortonworks Data Platform (HDP), and so on.

Apache Storm is a highly scalable, distributed, fast, and reliable real-time computing system designed to process very high velocity data. Cassandra complements the computing capability by providing lightning-fast read and writes, and this is the best combination currently available for data storage with Storm.

The combination of the Storm computing and Cassandra storage is helping technology evangelists to solve various business problems involving complex and high data volume situations such as real-time customer service, dashboards, security, sensor data analysis, data monetization, and so on.

This book will equip users with the capability to harness the processing power of Storm in combination with the speed and reliability of Cassandra to develop production-grade enterprise solutions on real-time use cases.

What this book covers

Chapter 1, Let's Understand Storm, gets you acquainted with the problems that need distributed computing solutions. It will take you through the journey of Storm and its advent.

Chapter 2, Getting Started with Your First Topology, teaches you to set up the developer's environment—sandbox and execute some of the code samples.

Chapter 3, Understanding Storm Internals by Examples, teaches you how to prepare Storm spouts and custom spouts. You will understand various kinds of groupings provided by Storm and their application to practical problems.

Chapter 4, Storm in a Clustered Mode, teaches you how to set up a multi-node Storm cluster to get the user acquainted with the distributed Storm setup and its components. This chapter will also get your acquainted with the Storm UI and various monitoring tools for Storm.

Chapter 5, Storm High Availability and Failover, conjugates the Storm topology with the RabbitMQ broker service and explores the high availability and failover scenarios of Storm with the help of various practical examples.

Chapter 6, Adding NoSQL Persistence to Storm, introduces you to Cassandra and explores various wrapper API's available to work with Cassandra. We will use the Hector API to connect Storm and Cassandra.

Chapter 7, Cassandra Partitioning, High Availability, and Consistency, walks you through the Cassandra internals. You will understand and apply the concepts of high availability, hinted handoff, and eventual consistency in context to Cassandra.

Chapter 8, Cassandra Management and Maintenance, gets you acquainted with the management aspects of Cassandra, such as scaling the cluster, node replacement, and so on, thus equipping you with all the experience required to handle real-life situations with Cassandra.

Chapter 9, Storm Management and Maintenance, gets you acquainted with the management aspects of Storm, such as scaling the cluster, setting up parallelism, and troubleshooting Storm.

Chapter 10, Advance Concepts in Storm, gives you an understanding of the Trident API. You will be building the Trident API with certain examples and illustrations around Trident.

Chapter 11, Distributed Cache and CEP with Storm, gets you acquainted with distributed cache, its need, and applicability to solve real-life use cases with Storm. It will also educate you about Esper as a CEP in combination with Storm.

Appendix, Quiz Answers, contains all the answers to the questions of the true or false statements and the fill in the blanks section.

Bonus Chapter, Using Storm and Cassandra for Real Life Use Cases, explains a few real-life use cases and blueprints to solve these cases using the technologies such as Storm and Cassandra. This chapter can be found online at https://www.packtpub.com/sites/default/files/downloads/Bonus_Chapter.pdf.

What you need for this book

For this book, you will require a Linux/Ubuntu OS, Eclipse, and 8 GB of RAM. The steps to set up other components such as Storm, RabbitMQ, Cassandra, memcache, Esper, and so on are covered in chapters corresponding to the said topics.

Who this book is for

This book is intended for Java developers who wish to get started on near real-time analytics track using Storm. This will serve as an expert's guide to developing highly available and scalable solutions to complex real-time problems. Apart from development, this book also covers the management and maintenance aspects of Storm and Cassandra, which is a mandatory requirement for productionizing any solution.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The NumWorker configuration or TOPOLOGY_WORKERS configuration defined in Storm."

A block of code is set as follows:

// instantiates the new builder object
TopologyBuilder builder = new TopologyBuilder();
// Adds a new spout of type "RandomSentenceSpout" with a  parallelism hint of 5
builder.setSpout("spout", new RandomSentenceSpout(), 5);

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are highlighted:

  public void execute(Tuple tuple) {
      String sentence = tuple.getString(0);
      for(String word: sentence.split(" ")) {
          _collector.emit(tuple, new Values(word)); //1
      }
      _collector.ack(tuple); //2
  }
  public void declareOutputFields(OutputFieldsDeclarer  declarer) {
      declarer.declare(new Fields("word")); //3
  }
}

Any command-line input or output is written as follows:

sudo apt-get -qy install rabbitmq-server

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: " Go to the Admin tab and select Policies and click on Add policy".

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.