当前位置:网站首页>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
边栏推荐
- Cnpm: unable to load file c:\users\administrator\appdata\roaming\npm\cnpm PS1 because running scripts is prohibited on this system.
- 哪个编程语言实现hello world最烦琐?
- PHP encapsulates curl to send get and post request methods, and uses
- CTF_ Web: file contains pseudo protocol with PHP
- STM32的DMA双缓冲模式详解
- Excel exports data to SQL and pictures to folder through macro | VBA
- GBASE 8s存储过程流程控制
- mongodb集群
- CTF_ Web: Advanced questions of attack and defense world expert zone WP (9-14)
- Structure syntaxique des procédures stockées gbase 8S
猜你喜欢

CTF_ Web: Advanced questions of attack and defense world expert zone WP (9-14)
![[esp32 learning path 6 - Flash encryption]](/img/4c/f317ca4823dca50a9bccd285967ab0.png)
[esp32 learning path 6 - Flash encryption]

mongodb集群

Paper notes: multi label learning ESMC (I don't understand it, but I haven't written it yet, so I'll put it here for a place temporarily)

论文笔记: 多标签学习 ESMC (没看懂, 还没写出来, 暂时放这里占个位置)

在 .NET 6 中使用 dotnet format 格式化代码

Php7.2 add JPEG extension

CTF_ Web: deserialization of learning notes (II) CTF classic test questions from shallow to deep

Record the problem of C # print size once

Kotlin Compose 监听软键盘 点击enter提交事件
随机推荐
Classification of gbase 8s locks
第二十五周记录
《牛客刷verilog》Part I Verilog快速入门
Value transfer between parent and child components of wechat applet
Coordinate system left multiply right multiply
三角形类(构造与析构)
CTF_ Web:8-bit controllable character getshell
Introduction to the isolation level of gbase 8s
mongodb集群
File upload vulnerability shooting range upload labs learning (pass1-pass5)
GBASE 8s存储过程流程控制
Use of deferred environment variable in gbase 8s
cnpm : 无法加载文件 C:\Users\Administrator\AppData\Roaming\npm\cnpm.ps1,因为在此系统上禁止运行脚本。
GBASE 8s 总体架构
华为鸿蒙开发第四课
GBASE 8s的数据导入和导出
2021.8.29 notes: register, bit operation, pointer, structure
The solution of wechat applet switchtab unable to take parameters
WPF 使用 MAUI 的自绘制逻辑
Unit test coverage