Book Image

Building Python Real time Applications with Storm

Book Image

Building Python Real time Applications with Storm

Overview of this book

Big data is a trending concept that everyone wants to learn about. With its ability to process all kinds of data in real time, Storm is an important addition to your big data “bag of tricks.” At the same time, Python is one of the fastest-growing programming languages today. It has become a top choice for both data science and everyday application development. Together, Storm and Python enable you to build and deploy real-time big data applications quickly and easily. You will begin with some basic command tutorials to set up storm and learn about its configurations in detail. You will then go through the requirement scenarios to create a Storm cluster. Next, you’ll be provided with an overview of Petrel, followed by an example of Twitter topology and persistence using Redis and MongoDB. Finally, you will build a production-quality Storm topology using development best practices.
Table of Contents (14 chapters)

Running the topology – the MongoDB case


We have a few more small things to address before we run the topology:

  1. Copy the logconfig.ini file from the second example in Chapter 3, Introducing Petrel to this topology's directory.

  2. Create a file called setup.sh:

    pip install -U pip
    pip install nltk==3.0.1 oauthlib==0.7.2 tweepy==3.2.0 geotext==0.1.0 pymongo==3.0.3
  3. Next, create a file called manifest.txt. This is identical to the Redis example.

    Install the MongoDB server. On Ubuntu, you can use the instructions given at http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/.

  4. Install the Python MongoDB client on all Storm worker machines:

    pip install pymongo==3.0.3
  5. To verify that pymongo is installed and the index is created correctly, start an interactive Python session by running python. Then use this code:

    import pymongo
    from pymongo import MongoClient
    db = MongoClient()
    for index in db.cities.minute.list_indexes():
        print index

    You should see the following output. The second line is the...