当前位置:网站首页>Efficient NoSQL database service Amazon dynamodb experience sharing
Efficient NoSQL database service Amazon dynamodb experience sharing
2022-06-25 04:41:00 【Songbird】
One 、 Preface
Amazon has always been very active , So it gave me a chance to experience Amozon DynamoDB This fully managed distributed NoSQL Database services . in addition , Amazon cloud technology provides 100 Free packages for more than products . among , Computing resources Amazon EC2 First year 12 It's free for three months ,750 Hours / month ; Storage resources Amazon S3 First year 12 It's free for three months ,5GB Standard storage capacity ; Database resources Amazon RDS First year 12 It's free for three months ,750 Hours ;Amazon Dynamo DB 25GB storage capacity Free forever . Active address
Amozon DynamoDB What is it? ?
Amazon DynamoDB It's a fully managed NoSQL Database services , Equivalent to the NoSQL On the basis of a lot of expansion , Many functions of cost reduction and efficiency increase are added , So that developers don't need to maintain anything extra , Open the box . Its main services are : Seamless expansion , Fast and predictable performance , Reduce the tedious workload of managing distributed databases , Provide static encryption 、 Backup on demand 、 Automatically maintain expired items, etc . It can greatly reduce the time cost of developers and improve the construction efficiency .
Maybe some little friends are not clear NoSQL Difference from traditional relational database , Here is a brief introduction :
| database | Data sets | structure | advantage |
|---|---|---|---|
| Relational database | form / Row and column storage | The structure of a relational database is predefined , Tables can be related to each other 、 Constraints etc. . | It can guarantee the security and integrity of data |
| NoSQL | Key value pair ( Dictionaries ) structure | In a non relational database , Data can be added at any time and anywhere . There's no need to predefine . | High expansibility 、 A smaller 、 Faster . |
therefore , If the business relationship is not copied 、 The dependency is simple and the fields need to be modified frequently , High performance requirements but low security requirements , Use DynamoDB It's a very good choice . On the contrary, it is recommended to use such as mysql This kind of traditional relational database .
List of articles
Two 、Amozon DynamoDB Hands on Tutorial
1) Account registration
No, AWS Account partners need to register their accounts first : Registration and trial address ( Domestic credit cards can be used on the bill registration page )
2) Create and query NoSQL surface
2.1 Build table
After setting up an account , According to the official DynamoDB Use the tutorial You can quickly create NoSQL surface :

2.2 Add data
There is a slight discrepancy with the official documents , You can actually do this by clicking on the name of the table in the list - Browse the project - Create a project to create , As shown in the figure below :

2.3 Query data
Then click the run button ( You can also set filter criteria ) You can query the data we just added :

2.4 Delete / Modifying data
Select any data in the list , It can be in the upper right corner “ operation ” Button to modify or delete data :

If you need to delete the table , Select the corresponding table data in the outer table list , Click the delete button :

3) Use Python management DynamoDB
We can also use Python To manage DynamoDB, Official documents There are detailed tutorials , No more details here .
4) Record on pit
stay 《 Use Amazon DynamoDB and Amazon SNS Build turn based games 》 tutorial , Follow the steps to application deployment , perform :bash scripts/create-lambda.sh The command displays the error message in the following figure :

Follow the prompts to execute create-lambda.sh The file execution command is changed to nodejs14.x after , After deleting the newly created resource, the operation will be successful :

There is also a green light behind , Completed the construction of turn based game .
3、 ... and 、Amozon DynamoDB Description of characteristics
1)DynamoDB The partitioning key 、 Understanding of sorting keys
1.1 The partitioning key
When we build tables , Will let us designate zones to build :

What is the function of the partitioning key ? Here is an example to illustrate :
For example, there is such a ID number :210122199206140257, From this ID number, you can quickly know that this is a person from Liaoning Province 、 Shenyang .、 A member of Liaozhong County 29 Year old boy .
Description of ID card format rules : front 1-6 Bit is the administrative division code, i.e. the place of ownership , The first 7-14 Date of birth , The first 15-17 Bit is sequence code , People born in the same area are distinguished by serial numbers , The first 17 Odd number means male , Even numbers for women , The first 18 Bit is check code , Used to verify whether the ID card number is legal .
and DynamoDB The partitioning key of has the same function , Partition the data by specifying the identity , In this way, the query data will be significantly improved .
1.2 Sort key
The sort key allows us to store our data in a specified sort , In the subsequent data acquisition, the time complexity of the query can be reduced by means of binary search .
2)DynamoDB Secondary index of
In such as Mysql In relational databases such as , Indexing allows us to look up the data we want , Instead of scanning the entire table, query the data of the specified row range through the index , It's faster . After index creation , Let's modify the data of the table , The database automatically changes the index to map changes to the table , No need for us to operate it manually .
stay dynamodb How to implement similar operations in ?
We can create a secondary index to achieve a similar purpose ,DynamoDB Index and oracle,mysql The indexes of these relational databases are very different .DynamoDB The secondary index of is composed of a hash Keys and multiple range Key , It is essential to support the query patterns required by the application , About DynamoDB The use and introduction of the index can be accessed Manage index Document learning .
3)DynamoDB Backup and restore of
Data backup and rollback recovery are critical ,DynamoDB Fully automated on-demand backup 、 Restore and point in time recovery capabilities :

in addition , At the same time of backup , It also encrypts the data automatically , Cataloguing , To improve the efficiency of management , We can perform backup settings in the backup tab of the table details page :
You can also create one-time backups on demand :

You can also visit Cloud native database online conference Understand the history of database development , And the future development direction .
Four 、 summary
DynamoDB In addition to providing data access management functions , In high availability ( Expand 、 Backup, etc ) We have also made a lot of efforts , There are also many out of the box services . therefore , It can not only ensure high-performance data access in the case of large-scale data , It can also reduce the construction, operation and maintenance costs of developers .
In game applications , news 、 It is necessary to send and receive notices , In addition, the performance requirements of game applications are much higher than those of traditional front and back-end applications , adopt Amazon DynamoDB and Amazon SNS The combination of , Can easily solve these two problems :

Of course DynamoDB There are also scenarios that do not apply : In the early stages of product development , If there is no perfect and clear design scheme , Especially under the agile development mode of "step by step" , Not recommended DynamoDB, Because the DynamoDB Understanding of the document : Only when you are familiar with the product itself , To design its partition 、 Sort key and so on . In other words , When the product is in a mature stage , Or you are familiar with the product , Use DynamoDB It can definitely get twice the result with half the effort .
Amazon cloud technology has created a variety of learning platforms for developers :
- Getting started Resource Center : from 0 To 1 Easy to get started with cloud services , Content covered : Cost management , Start training , Development resources : Point me to visit
- Architecture Center : Amazon cloud Technology Architecture Center provides cloud platform reference architecture chart 、 Reviewed architectural solutions 、Well-Architected Best practices 、 Pattern 、 Icon, etc : Point me to visit
- Builder Library : Learn how Amazon cloud builds and operates software : Point me to visit
- Toolkit for developing and managing applications on Amazon cloud technology platform :: Point me to visit
边栏推荐
- OOP栈类模板(模板+DS)
- CTF_ Web: file contains pseudo protocol with PHP
- php封装curl发送get、post请求方法,并使用
- 515. find the maximum value / Sword finger offer II 095 in each tree row Longest common subsequence
- mongodb集群
- 515. 在每个树行中找最大值 / 剑指 Offer II 095. 最长公共子序列
- CTF_ Web: Advanced questions of attack and defense world expert zone WP (15-18)
- CTF_ Web:8-bit controllable character getshell
- GBASE 8s存储过程流程控制
- Machine learning deep learning -- Vectorization
猜你喜欢

冰冰学习笔记:循环队列的实现

CTF_ Web:php weak type bypass and MD5 collision

JS arguments

js中的concat()

Unity Quad culls shaders with back faces and transparent parts

Simple text analysis of malicious samples - Introduction

2.0springmvc uses restful

A detailed summary of TCP connection triple handshake

微信小程序父子组件之间传值

CTF_ Web: deserialization of learning notes (II) CTF classic test questions from shallow to deep
随机推荐
i. Max development board learning record
What is the storage engine and the three common database storage engines for MySQL
Gbase 8s parallel operation problem scenario description
GBASE 8s存储过程语法结构
The consciousness of a programmer
CTF_ Web: file contains pseudo protocol with PHP
在 .NET 6 中使用 dotnet format 格式化代码
Unit test coverage
使用文本分析识别一段文本中的主要性别
GBase 8s的封锁技术的基本介绍
GBASE 8s的触发器
JS call() and apply()
第二十五周记录
JS' sort() function
坐标系左乘右乘
The solution of wechat applet switchtab unable to take parameters
[untitled]
Gbase 8s index R tree
js的arguments
Codeforces Round #802 (Div. 2) C D