万本电子书0元读

万本电子书0元读

顶部广告

Learning Apache Cassandra电子书

售       价:¥

2人正在读 | 0人评论 9.8

作       者:Mat Brown

出  版  社:Packt Publishing

出版时间:2015-02-25

字       数:161.5万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
If you're an application developer familiar with SQL databases such as MySQL or Postgres, and you want to explore distributed databases such as Cassandra, this is the perfect guide for you. Even if you've never worked with a distributed database before, Cassandra's intuitive programming interface coupled with the step-by-step examples in this book will have you building highly scalable persistence layers for your applications in no time.
目录展开

Learning Apache Cassandra

Table of Contents

Learning Apache Cassandra

Credits

About the Author

About the Reviewers

www.PacktPub.com

Support files, eBooks, discount offers, and more

Why subscribe?

Free access for Packt account holders

Preface

What this book covers

What you need for this book

Who this book is for

Conventions

Reader feedback

Customer support

Downloading the example code

Errata

Piracy

Questions

1. Getting Up and Running with Cassandra

What Cassandra offers, and what it doesn't

Horizontal scalability

High availability

Write optimization

Structured records

Secondary indexes

Efficient result ordering

Immediate consistency

Discretely writable collections

Relational joins

MapReduce

Comparing Cassandra to the alternatives

Installing Cassandra

Installing on Mac OS X

Installing on Ubuntu

Installing on Windows

Bootstrapping the project

CQL – the Cassandra Query Language

Interacting with Cassandra

Creating a keyspace

Selecting a keyspace

Summary

2. The First Table

Creating the users table

Structuring of tables

Table and column options

The type system

Strings

Integers

Floating point and decimal numbers

Dates and times

UUIDs

Booleans

Blobs

The purpose of types

Inserting data

Writing data does not yield feedback

Partial inserts

Selecting data

Missing rows

Selecting more than one row

Retrieving all the rows

Paginating through results

Developing a mental model for Cassandra

Summary

3. Organizing Related Data

A table for status updates

Creating a table with a compound primary key

The structure of the status updates table

UUIDs and timestamps

Working with status updates

Extracting timestamps

Looking up a specific status update

Automatically generating UUIDs

Anatomy of a compound primary key

Anatomy of a single-column primary key

Beyond two columns

Compound keys represent parent-child relationships

Coupling parents and children using static columns

Defining static columns

Working with static columns

Interacting only with the static columns

Static-only inserts

Static columns act like predefined joins

When to use static columns

Refining our mental model

Summary

4. Beyond Key-Value Lookup

Looking up rows by partition

The limits of the WHERE keyword

Restricting by clustering column

Restricting by part of a partition key

Retrieving status updates for a specific time range

Creating time UUID ranges

Selecting a slice of a partition

Paginating over rows in a partition

Counting rows

Reversing the order of rows

Reversing clustering order at query time

Reversing clustering order in the schema

Paginating over multiple partitions

Building an autocomplete function

Summary

5. Establishing Relationships

Modeling follow relationships

Outbound follows

Inbound follows

Storing follow relationships

Designing around queries

Denormalization

Looking up follow relationships

Unfollowing users

Using secondary indexes to avoid denormalization

The form of the single table

Adding a secondary index

Other uses of secondary indexes

Limitations of secondary indexes

Secondary indexes can only have one column

Secondary indexes can only be tested for equality

Secondary index lookup is not as efficient as primary key lookup

Summary

6. Denormalizing Data for Maximum Performance

A normalized approach

Generating the timeline

Ordering and pagination

Multiple partitions and read efficiency

Partial denormalization

Displaying the home timeline

Read performance and write complexity

Fully denormalizing the home timeline

Creating a status update

Displaying the home timeline

Write complexity and data integrity

Summary

7. Expanding Your Data Model

Viewing a table schema in cqlsh

Adding columns to tables

Deleting columns

Updating the existing rows

Updating multiple columns

Updating multiple rows

Removing a value from a column

Missing columns in Cassandra

Deleting specific columns

Syntactic sugar for deletion

Inserts, updates, and upserts

Inserts can overwrite existing data

Checking before inserting isn't enough

Another advantage of UUIDs

Conditional inserts and lightweight transactions

Updates can create new rows

Optimistic locking with conditional updates

Optimistic locking in action

Optimistic locking and accidental updates

Lightweight transactions have a cost

When lightweight transactions aren't necessary

Summary

8. Collections, Tuples, and User-defined Types

The problem with concurrent updates

Serializing the collection

Introducing concurrency

Collection columns and concurrent updates

Defining collection columns

Reading and writing sets

Advanced set manipulation

Removing values from a set

Sets and uniqueness

Collections and upserts

Using lists for ordered, nonunique values

Defining a list column

Writing a list

Discrete list manipulation

Writing data at a specific index

Removing elements from the list

Using maps to store key-value pairs

Writing a map

Updating discrete values in a map

Removing values from maps

Collections in inserts

Collections and secondary indexes

Secondary indexes on map columns

The limitations of collections

Reading discrete values from collections

Collection size limit

Reading a collection column from multiple rows

Performance of collection operations

Working with tuples

Creating a tuple column

Writing to tuples

Indexing tuples

User-defined types

Creating a user-defined type

Assigning a user-defined type to a column

Adding data to a user-defined column

Indexing and querying user-defined types

Partial selection of user-defined types

Choosing between tuples and user-defined types

Comparing data structures

Summary

9. Aggregating Time-Series Data

Recording discrete analytics observations

Using discrete analytics observations

Slicing and dicing our data

Recording aggregate analytics observations

Answering the right question

Precomputation versus read-time aggregation

The many possibilities for aggregation

The role of discrete observations

Recording analytics observations

Updating a counter column

Counters and upserts

Setting and resetting counter columns

Counter columns and deletion

Counter columns need their own table

Summary

10. How Cassandra Distributes Data

Data distribution in Cassandra

Cassandra's partitioning strategy: partition key tokens

Distributing partition tokens

Partition keys group data on the same node

Virtual nodes

Virtual nodes facilitate redistribution

Data replication in Cassandra

Masterless replication

Replication without a master

Consistency

Immediate and eventual consistency

Consistency in Cassandra

The anatomy of a successful request

Tuning consistency

Eventual consistency with ONE

Immediate consistency with ALL

Fault-tolerant immediate consistency with QUORUM

Comparing consistency levels

Choosing the right consistency level

The CAP theorem

Handling conflicting data

Last-write-wins conflict resolution

Introspecting write timestamps

Overriding write timestamps

Distributed deletion

Stumbling on tombstones

Expiring columns with TTL

Summary

A. Peeking Under the Hood

Using cassandra-cli

The structure of a simple primary key table

Exploring cells

A model of column families: RowKey and cells

Compound primary keys in column families

A complete mapping

The wide row data structure

The empty cell

Collection columns in column families

Set columns in column families

Map columns in column families

List columns in column families

Appending and prepending values to lists

Other list operations

Summary

B. Authentication and Authorization

Enabling authentication and authorization

Authentication, authorization, and fault tolerance

Authentication with cqlsh

Authentication in your application

Setting up a user

Changing a user's password

Viewing user accounts

Controlling access

Viewing permissions

Revoking access

Authorization in action

Authorization as a hedge against mistakes

Security beyond authentication and authorization

Security protects against vulnerabilities

Summary

Wrapping up

Index

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部