O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Learning Azure Cosmos DB

Book Description

Gain an in-depth understanding of Azure Cosmos DB — a multi-model database from Microsoft

About This Book
  • Develop your skills to build and scale applications using the power of Azure CosmosDB.
  • Learn how to store and access data with a variety of APIs including MongoDB, Gremlin, SQL, Azure Tables and much more.
  • Fast paced guide to have a better understanding of the features with the practical approach mentioned.
Who This Book Is For

This book is intended to anyone who wants to get well versed with Microsoft's new NoSQL database called Azure Cosmos DB. Get the database into work with the practical examples mentioned.

What You Will Learn
  • Build highly responsive and mission-critical applications
  • Understand how distributed databases are important for global scale and low latency
  • Understand how to write globally distributed applications the right way
  • Implement comprehensive SLAs for throughput, latency, consistency, and availability
  • Implement multiple data models and popular APIs for accessing and querying data
  • Implement best practices covering data security in order to detect, prevent and respond to database breaches
In Detail

Microsoft has introduced a new globally distributed database, called Azure Cosmos DB. It is a superset of Microsoft's existing NoSQL Document DB service. Azure Cosmos DB enables you to scale throughput and storage elastically and independently across any number of Azure's geographic regions.

This book is a must-have for anyone who wants to get introduced to the world of Cosmos DB. This book will focus on building globally-distributed applications without the hassle of complex, multiple datacenter configurations. This book will shed light on how Cosmos DB offers multimodal NoSQL database capabilities in the cloud at a scale that is one product with different database engines, such as key-value, document, graph, and wide column store. We will cover detailed practical examples on how to create a CRUD application using Cosmos DB with a frontend framework of your choice. This book will empower developers to choose their favorite database engines to perform integration, along with other systems that utilize the most popular languages, such as Node.js. This book will take you through the tips and trick, of Cosmos DB deployment, management, and the security offered by Azure Cosmos DB in order to detect, prevent, and respond to database breaches.

By the end of this book, you will not only be aware of the best capabilities of relational and non-relational databases, but you will also be able to build scalable, globally distributed, and highly responsive applications.

Style and approach

Azure Cosmos DB is the first and only globally distributed database service in the industry today to offer comprehensive Service Level Agreements (SLAs) encompassing all four dimensions of global distributions which our customers care the most: throughput, latency at the 99th percentile, availability, and consistency. As a cloud service, we have carefully designed and engineered Azure Cosmos DB with multi-tenancy and global distribution in mind.

Downloading the example code for this book 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.

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. Learning Azure Cosmos DB
  3. Packt Upsell
    1. Why subscribe?
    2. PacktPub.com
  4. Contributors
    1. About the author
    2. About the reviewer
    3. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  6. Introducing Microsoft Azure Cloud and Cosmos DB
    1. Microsoft Azure Cloud features
    2. Microsoft Azure as an SPI
      1. Azure as PaaS
      2. Azure as IaaS
    3. Azure components
    4. Getting started with Azure
      1. Compute modules
      2. Data management modules
      3. Networking module
      4. Big data modules
      5. Caching module
      6. Messaging module
      7. Identity module
      8. Mobile service module
      9. IoT modules
    5. Azure Cosmos DB
      1. Turnkey global distribution
      2. Multilevel data models
      3. Scale on demand
      4. High response with less latency
      5. Consistency models
      6. Money-back guarantee and SLA
    6. Cosmos DB use cases
      1. IoT
      2. Retail and marketing
      3. Gaming
      4. Web and mobile applications
    7. Summary
  7. Cosmos DB Global Turnkey Distribution
    1. Setting up an Azure subscription
    2. Creating an Azure Cosmos DB database
    3. Adding data in MongoDB
    4. Distributing data using global turnkey distribution
    5. Failover handling
      1. Automatic failover
      2. Manual failover
    6. Summary
  8. Cosmos DB Multi-model Databases
    1. Cosmos DB data models
      1. ARS
      2. DocumentDB API
      3. The MongoDB data model
      4. The tables data model
      5. The graph (Gremlin) data model
      6. Cassandra API
    2. The Cosmos DB consistency levels
    3. Summary
  9. Querying Cosmos DB
    1. Performing CRUD operations in DocumentDB
      1. DocumentDB query basics
      2. Creating data in Cosmos DB
      3. Reading data from DocumentDB
      4. Updating and deleting documents
    2. Performing CRUD operations in MongoDB
    3. Performing CRUD operations in Graph DB
    4. Performing CRUD operations in tables (key value store)
    5. Performing CRUD operations in Cassandra.
    6. Summary
  10. Integrating Cosmos DB with Node.js
    1. Node.js setup
    2. Cosmos DB MongoDB setup
    3. Connecting Cosmos DB with the Node.js app
    4. App data in Cosmos DB
    5. Integrating the DocumentDB API with Node.js
    6. Integrating the Table API with Node.js
    7. Integrating the Graph API with Node.js
    8. Summary
  11. Building a High-Performance Link Shortening and Tracking System Using Cosmos DB
    1. Why do we need URL shortening?
    2. Requirements of the system
    3. Capacity estimation
    4. Database design
    5. Encoding URL algorithms
    6. Node app development
    7. Security and permission
    8. Summary
  12. Building a Highly Available, Real-Time Email Tracking System using Cosmos
    1. Is email tracking legal?
    2. System design and assumptions
    3. Choosing the database API in Cosmos DB
    4. Writing our email sender
    5. Tracking emails and storing tracking data
    6. Summary
  13. Cosmos DB Deployment and Management
    1. Turnkey distribution
    2. Failover handling
      1. Automatic failover
      2. Manual failover
    3. Database deployment
    4. Backup and restore
    5. Deploying a custom app over the Azure network
    6. Monitoring traffic and usage
    7. Database security
    8. Summary
  14. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think