Amazon DynamoDB Overview

 1. What is Amazon DynamoDB

DynamoDB is a fast, fully managed NoSQL database service, which allows users in a simple and cost-effective way to store and retrieve any amount of data, while serving in any level of request traffic. All items are stored in the solid-state drive (SSD), while replicated among three available area, to achieve higher availability and ensure durability.

By DynamoDB, you can remove due to the operation and expansion of high-availability distributed cluster administrative burden brought about, and the only part of the payment at a lower price for your use.

 

Service Highlights

Scalable - Amazon DynamoDB throughput and storage capacity designed to achieve efficient, seamless extension.

  • Configuration Throughput - table creation request capacity can simply specify the desired. DynamoDB allocates dedicated resources for your table to meet the performance requirements, and automatically partitions the data to server enough capacity to satisfy the request. If your application throughput needs change, simply use the request capacity to the AWS Management Console or Amazon DynamoDB API call to update the table. Throughput levels before the expansion process, still can not guarantee the fall.
  • Automatic storage expansion - You can not limit the amount of data stored in DynamoDB table, and as you write using DynamoDB API to increase the amount of data stored, the service will automatically allocate more memory. 
  • Fully distributed shared-nothing architecture - Amazon DynamoDB horizontally scalable and seamlessly expand a single table in hundreds of servers.

Fast, predictable performance - Amazon DynamoDB average delay of the server generally does not exceed ten milliseconds. The service runs in the solid state hard drive, which aims to build a manner of any size can ensure continued excellent service performance and reduce latency.

Easily manage - Amazon DynamoDB is a fully managed service, you only need to create a database table, the rest of things are handed over to the service to do the job. You do not need to worry about hardware or software configuration, create settings and configuration, software updates, and reliable operation of the distributed database cluster, or with the expansion of the data needs to be partitioned among multiple instances of other issues, you can simply enjoy the services of Amazon DynamoDB Dacheng.

Built-in fault tolerance - Amazon DynamoDB built-in fault tolerance, backup data can be automatically synchronized between an area of the three available areas to enable efficient accessibility, even if a single machine or even crashes facilities, protective measures to ensure data foolproof.

Flexible - Amazon DynamoDB is no fixed pattern. Instead, each data item may have a different number of attributes. Multiple data type (string, numeric, and binary data set) so that the data model richer .

Strong Consistency, Atomic Counters - Unlike many non-relational database, Amazon DynamoDB allows you to use strong consistency checks of the read operation to ensure that always reads the latest value, enabling developers easier. Amazon DynamoDB supports multiple native data type (numeric, string, binary data and multivalued attributes). The service also supports local atomic counter, allows you to call a single API call is automatically incremented or decremented value property.

Cost-effective - Amazon DynamoDB can easily cope with the workload intensity of any size, low cost, cost-effective. You can also start using the free package that allows you to perform database operations 4 000 million times a month, and for a small hourly rate for the resources used in the post beyond that limit. Cost (TCO) with convenient and efficient management request pricing, compared to the parental force for the management of the relationship or non-relationship database, DynamoDB total workload has greatly reduced.

Security - Amazon DynamoDB using encrypted authentication method to authenticate users to prevent unauthorized data access. In addition, it can also be integrated with AWS Identity and Access Management (IAM)to achieve fine control over user access within the organization.

Integrated Monitoring - Amazon DynamoDB displays key operating metrics for your table in the AWS Management Console. The service can also be used in conjunction with Amazon CloudWatch, so you can view request throughput and latency for each Amazon DynamoDB table, and easily track your resource overhead.

Elastic MapReduce Integration - Amazon DynamoDB and Amazon Elastic MapReduce (Amazon EMR) seamless integration. Amazon EMR allows businesses to use the hosted on AWS i.e. perform complex analysis of the large data sets you-go charging Hadoop framework. Amazon DynamoDB dependent on strong service capabilities, customers can easily use Amazon EMR to analyze datasets stored in DynamoDB and archived in the Amazon Simple Storage Service (Amazon S3) results, while preserving the integrity of the original data set in DynamoDB. In addition, companies may use Amazon EMR to access a plurality of memory (i.e. Amazon DynamoDB, Amazon RDS and Amazon S3) data, perform complex analysis of the combined data sets, and stores the results of the work in the Amazon S3.

 

2. Data Model Overview

Amazon DynamoDB organizes data into a table containing items, each item has one or more attributes.

Attributes

Property is a name - value pair. The name must be a string, but it may be a string, a number, binary data, a set of strings, numbers, or sets of binary data set. The following are examples of attributes:

        "ImageID" = 1
        "Title" = "flower"
        "Tags" = "flower", "jasmine", "white"
        "Ratings" = 3, 4, 2

project

Properties of a collection of items, items identified by its primary key. Properties of the project is the name - value pairs set, in any order. Item attribute may be sparse, regardless of the properties of other items in the same table, and (with the exception primary key attribute) optional. Unlike a traditional database, in addition to the table is dependent on the primary key is not outside the other modes. Items stored in the table. To project into a table, you must specify at least one primary key attribute. Primary key that uniquely identifies an item DynamoDB table. In the chart below, ImageID is to specify the attributes of the primary key:

 

 There are table name "my table", but the project has no name. Primary key definition items; primary key "ImageID" = item 1

table

Table contains the project, and the information is organized into discrete areas. All items in the table have the same primary key mode. When creating the table, are required for the primary key or a plurality of attribute names, and requires each item in the table has a unique primary key values. To DynamoDB write data, the first step is to create the tables and use the specified primary key table name. The following table is a larger, it also uses as the primary key identifier ImageID project.

Table: My Images    
Primary key Other properties  
ImageID = 1 ImageLocation = https://s3.amazonaws.com/bucket/img_1.jpg Date = 1260653179 Title = flower Tags = Flower, Jasmine Width = 1024 Depth = 768  
ImageID = 2 ImageLocation = https://s3.amazonaws.com/bucket/img_2.jpg Date = 1252617979 Rated = 3, 4, 2 Tags = Work, Seattle, Office Width = 1024 Depth = 768  
ImageID = 3 ImageLocation = https://s3.amazonaws.com/bucket/img_3.jpg Date = 1285277179 Price = 10.25 Tags = Seattle, Grocery, Store Author = you Camera = phone  
ImageID = 4 ImageLocation = https://s3.amazonaws.com/bucket/img_4.jpg Date = 1282598779 Title = Hawaii Author = Joe Colors = orange, blue, yellow Tags = beach, blanket, ball

 

3. Access Model and API Overview

Primary key

DynamoDB requires that each table has a defined primary key to access the data.

Primary key that uniquely identifies each item (e.g., ID = 1, ID = 2, ID = 3, etc.).

A primary key is the only table indexed portion is also used to hash partitioning data across multiple servers . You specify the primary key when creating a table.

In other words, all / set of values ​​for the name of each item. When you create a list of items, you need to specify a name / value pair as the primary key. All items in the table must have a primary key attribute values, Amazon DynamoDB will ensure the uniqueness of the name value, and creates an index based on the primary key.

Range queries using composite keys

A composite primary key of the table specifies two properties, constitute a unique primary index . All items in the table must have these two properties. As a "hash-partitioned Properties", the other as the "range of properties." For example, you might have a "Status Updates" table, a composite primary key "UserID" (hash attribute is used to partition the workload across multiple servers) and constituting the "Time" (the range of properties). Then, you can run queries to extract: 1) a combination of a specific UserID and Time values uniquely identified items; 2) the particular hash "buckets" (UserID in this example) all of the items; or 3) within a certain timeframe UserID of all project-specific. Only in specified circumstances UserID hash bucket, the only support for a range of "Time" query.

 

DynamoDB API

  • The CreateTable - create a table and specify the primary key for data access .
  • UpdateTable - update a particular throughput value table configuration .
  • DeleteTable - delete the table.
  • DescribeTable - Returns table size, status and index information.
  • Putltem - Create a new project, or to replace old items for new projects (including all attributes). If an item is present in the specified table with the same primary key, the new program will completely replace the existing items. You can also use conditional operators to achieve the replacement condition, that is, only if the replacement project meets the specific conditions in the property value of the item or insert a new project only if the project does not yet exist.
  • BatchWriteItem - a single request (instead of a single transaction) insert, replace and delete multiple items of the plurality of tables. Support for up to 25 projects batch execution Put or Delete operation, maximum total request size of 1 MB.
  • UpdateItem - Edit the properties of an existing project . You can also use conditional operators to achieve conditions update, that is, only if certain conditions are updated in line with the property value of the item.
  • DeleteItem - the primary key to delete individual items in the table . You can also use conditional operators to achieve excellent conditions, that is, only in property values in line with the project if certain conditions remove items.
  • The GetItem - the GetItem operator may return a set of attributes to match the primary key of the item. By default, GetItem operation provides eventually consistent read. If eventually consistent read does not apply to your application, use ConsistentRead.
  • BatchGetItem - BatchGetItem operation returns the properties for a plurality of the primary key table using a plurality of items. Single response size limit of 1 MB, and returns a maximum of 100 items. Support strong consistency and eventual consistency.
  • Query - get one or more based on the primary key of the project . Support strong consistency and eventual consistency. This API having a composite hash - the key range using the table.
  • Scan - by performing a full scan table, acquire one or more items and attribute . By specifying filter criteria for one or more attributes, restricted items returned. You can then use this API, not the table for the primary key attribute, to enable ad hoc query table. However, because it is not indexed full table scan, and therefore not suitable for any application that requires predictable performance query use cases. Scan API request final result set is the same. You can Scan API regarded as iterators. Once the total size of a particular item scan Scan API request exceeds 1 MB limit, then that particular request will be terminated, the extracted result is returned together with a LastEvaluatedKey (to continue scanning in a subsequent operation).

 

4. Amazon Elastic MapReduce 集成

Amazon DynamoDB also with Amazon Elastic MapReduce (Amazon EMR) integration. Amazon EMR allows businesses on AWS using managed-you-go Hadoop aircraft purchase to perform complex analysis of large data sets . EMR employed in some manner as shown in conjunction with DynamoDB:

  1. Customers can use DynamoDB EMR data stored in the analysis, the analysis result is stored in S3 , while preserving the original data in DynamoDB.

    For example, if you use Amazon DynamoDB to store customer orders, you can create a new monthly orders table, and use EMR multi-table queries, you can join different tables in DynamoDB to answer "a specific customer places in the past three months What issues orders "like the. You can then use EMR store query results to these questions in S3 for later retrieval, and data intact monthly customer order tables in DynamoDB in.

  2. Customers can use the EMR to back up data from DynamoDB to S3.

    Borrowing the above example about customer orders, once you are no longer frequently write data to monthly orders table, you can back up this table to S3, and delete this table from DynamoDB in order to enjoy lower S3 storage costs. Still stored data S3 can be easily used in the following analysis.

  3. Moreover, customers can access a plurality of memory use Amazon EMR (i.e. Amazon DynamoDB, Amazon RDS and Amazon S3) data, perform complex analysis of the combined data sets, and the results of this work are stored in the Amazon S3.

    For example, if you use Amazon DynamoDB to store customer orders, you can create a new monthly orders table, and use Amazon EMR at the end of the month archive more than six months old orders in Amazon S3. This allows you to archive infrequently accessed orders in Amazon S3 to reduce costs and save only frequently accessed orders in DynamoDB in. You can use the EMR across DynamoDB stored in the current order and Amazon S3 stored in the archive orders table to perform analysis to answer the query "Customer Y in the past 48 months the product widget X issued a number of orders," and the like.

 

Reproduced in: https: //www.cnblogs.com/davidgu/p/3364773.html

Guess you like

Origin blog.csdn.net/weixin_33898233/article/details/93802642