当前位置:网站首页>Overview of new features in mongodb5.0

Overview of new features in mongodb5.0

2022-06-24 06:33:00 phoenix、

The overview

MongoDB It's gone by now 12 A year . Just released today 5.0 edition . Let's take a look at what new features and functions have been released in the new version ~ The official choice is from 4.4 Jump straight to 5.0 It may also be to express that the version changes a lot ( Adjusted the release rhythm ) The meaning of .

mongodb version history.png

From the bold features in the figure above , The main functions include :

  • Time-Series collections Native timeline support
  • Clustered indexes Cluster index
  • Window functions Window function
  • New temporal operators New time-dependent operators
  • Live resharding Real time redistribution
  • Multi-cloud A hybrid cloud

Show more at the press conference , Let's look at the details .


server List of new features

Native Time Series

Local time series , Essentially, Expansion and enhancement MongoDB Ability in temporal data processing .( Maybe it's because I found that many customers put their original existence MongoDB Data migration to ElasticSearch To do time series data analysis, so I want to focus on strengthening the ability of this piece .)

What is a time series set ? Essentially ,MongoDB5.0 A new collection type is introduced ( Think about it , Before a capped collection, Common set , System collections and views based on common collections ), And this set of targeted support and optimization .

What data is suitable for ? Everything related to timing is OK , For example, financial transactions , Various intelligent terminals / Monitoring data of the sensor . The official example is weather data from all over the United States ( temperature 、 Humidity, etc ).

Creating a time series set will create a normal set and an automatically created corresponding writable non materialized view in the background ( non-materialized view ), This view acts as an abstraction layer . This abstraction layer allows the user to always process the data as the original single document , Therefore, users no longer need to know how the time series data is stored and persisted , Just focus on how the business layer should use or analyze these time series data .

How to use ?

The usage is as simple as ever , It's basically no different from using normal sets . It just needs to be added to a specific field timeseries Key words can be used .

Create a file called weather Time series set of :

db.createCollection("weather", {
	timeseries: {
		timeField: "ts",
		metaField: "source",
		granularity: "minutes"
  	},
	expireAfterSeconds: 9000 
}); 

among :

  • timeField Fields are time series fields , The type must be MongoDB Supported time types, such as ISODate("2021-05-20T10:24:51.303Z") .
  • metaField For metadata fields , Can be used to create secondary indexes , For example, mark the source of time series data .MongoDB Will automatically have the same... For a period of time metaField The measurements of are aggregated and done , To eliminate duplication of this field in the storage tier .
  • granularity Is a granularity field , Update frequency of real-time sequence data , The default is seconds ( seconds ).
  • expireAfterSeconds Overdue fields , Not a new field . Time series data with TTL Indexes , So that time series data can be eliminated automatically .

If the time table is created with expireAfterSeconds , There is no need to create TTL Index . After that, you need to use collMod command . In the future, we can cooperate Atlas Online archiving ( Online Archive ) Function to use .

As an early version , There are some more in the timeline Limit , such as :

  • append only, Update not supported / Delete
  • I won't support it Change Streams,Realm Sync or Atlas Search
  • Only in metaField Create a secondary index on
  • wait

Versioned API

Mainly to solve the problem of version update .

Many online businesses want to use the new features of the new version , But for various reasons , Generally, they don't dare to upgrade online databases . Database upgrade is also a big challenge for O & M colleagues . Code changes involved in the process , Driver upgrade , Comprehensive compatibility testing and so on have brought a lot of workload .Versioned API Can play a role in such a scenario , That is to say, the database has been upgraded to a newer version , But the stock business will still use the old version API To visit . There will be no incompatibilities . let me put it another way , This function Completely decouple the application lifecycle from database updates .

versioned API.png

Live Resharding

Try to completely solve the problem of unreasonable initial database modeling .

stay 4.4 Previous versions ,shard key Once defined, it cannot be changed . Many businesses have been running for a long time , After accumulating a lot of data, I found my own shard key unreasonable , It is difficult to change . There are generally only two ways :1) Remove from service (dump&load);2) Online migration (live migration). The former requires long downtime for maintenance , The latter takes a long time and requires the business to handle all kinds of complex logic by itself (DDL, Orphan documents , Data consistency and so on ), Are not optimal solutions .

We see in the 4.4 The version is officially launched refinable shard keys. But only through shard key To adjust the data distribution by adding suffixes to the . As its name shows , This is just refine, It can't be completely solved shard key Unreasonable questions .

Live Resharding It can be understood that the official himself is MongoDB Internally implemented live migration And deal with various complex situations and consistency problems , For those initial shard key Businesses that are unreasonable but have a huge amount of data are very friendly .

It's also easy to use , It's just a mongos Performed on command nothing more :

db.adminCommand({
  reshardCollection: "<database>.<collection>",
  key: <shardkey>
})

Of course , This feature also has some limitations , Just a few , Please refer to the official documents for details :

  • At the same time, there can only be one partition table in resharding
  • Tables with unique restrictions are not supported
  • resharding During this period, you cannot do some operations , For example, cluster level addShard And table level createIndexes/renameCollection etc.

Atlas to update

MongoDB Ops Manager 5.0

  • Support MongoDB 5.0 Automation of deployment 、 Monitoring and backup / recovery .
  • Improve load performance by parallelizing client restore .
  • Use Ops Manager stay Kubernetes Deployment in China MongoDB Quick Start experience for .
  • Guide the user to complete Atlas Migration experience , Guide the user to configure the migration host , Push data from their existing environment to a fully managed Atlas The cloud service .

Online Archive

Online archiving , The purpose is to solve Data cooling The needs of .

  • Effectively reduce data storage costs ;
  • Automated data tiering , No need to manually migrate or delete valuable data ;
  • Searchable archive data , Support joint query of business data and archived data ;
online archive.png
Online-Archive-Animation.gif

Serverless Model (preview)

be based on serverless Server free instance of the concept , It hasn't been officially launched yet Atlas platform . There may be two main products : elastic database model & serverless model .

And others serverless Products ( such as LambdaDynamoDBcloud function ) similar , Support the following capabilities :

  • Easy to use , Just select the managed cloud region
  • No need to worry about back-end infrastructure
  • Stretch and stretch
  • Pay as you go
  • Auto update server edition , Make use of Versioned API The ability of

You may see other cloud service providers based on MongoDB Doing something similar , The authorities decided to do it themselves , Let's look forward to .

serverless.png

Atlas Data Lake & Charts

The two capabilities are integrated . Can be based on data lake Quickly create and share visual charts with data in .

datalake.png
charts.png

Bottom based lucene, Support full-text search .

Added support for function scoring , Allows you to apply mathematical formulas to document fields to calculate dependencies , Such as popularity or distance —— for example , Nearby restaurants with more or better comments will be higher in the search results list . In addition, new support Custom search synonyms collection To support more general user queries .

atlas search.png

Realm SDK

Realm Let users on their mobile phones 、 Simple on IOT devices like tablets and raspberry pies 、 Strong local persistence . Its essence is to solve the problem of terminal data synchronization . Allow developers to interact directly with storage objects , Without thinking about ORM Or database syntax . Released earlier this year Realm Sync, Support terminal devices and atlas Synchronize data between database backend .

The new function is :

  • Support Unity , It can be seen that MongoDB Further moves in the game industry :smile:
  • In the future, cross platform frameworks will be supported ——Kotlin & Flutter
  • A way to more finely control synchronized data ——Realm Flexible Sync ( Unpublished )
realm.png

new MongoDB Shell(mongosh)

new mongo shell, Syntax highlighting has been introduced 、 Intelligent automatic completion 、 Context help and helpful error messages , It can be for MongoDB Users create a more intuitive interactive experience .

  • And 4.0 The above MongoDB Cluster compatible , You don't need to put your own mongoDB Cluster upgrade to 5.0 You can experience .
  • More useful error help information ( Sometimes complex commands are crazy without a brace ..)
mongosh 1.png
  • Better interaction shell Prompt information
Mongosh 2.png
  • Even you can be like mysql See the same table Visualized library table schema( It's really not NoSql Ha ha ha )
Mongosh 3.png

other

  • Faster release frequency ( Change from year to quarter )
    releases in the future.png
  • Support window function ;
  • New time-dependent operators , such as $dateAdd,$dateDiff,$dateSubtract, It is also to better support the processing of time series data
  • Read the following snapshot ( read concern "snapshot" ), And you can set the retention time
  • dbstats and serverStatus Command output update , Will show more systems / Library table related information
  • For more changes, please refer to release notes

summary

Represent personal opinion only , Welcome to exchange ~

  • The trend of database convergence ( Whether it's OLAP and OLTP, still SQL And NoSQL)
  • The support of native time series data is 5.0 The highlight of the version , As for and ES The differences and comparisons between the two have yet to be further studied after experience
  • Atlas More and more powerful ,MongoDB Expect to bind users through these capabilities .

Reference link

原网站

版权声明
本文为[phoenix、]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/07/20210714203253345Z.html

随机推荐