Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the new features of MongoDB version 1.7.x

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

In this issue, the editor will bring you about the new features of MongoDB 1.7.x. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

The official MongoDB blog recently published an introduction to five important new features of ReplicaSets in version 1.7.4, which will continue to exist and improve in version 1.8.x.

What are the new features of the MongoDB1.7.x version

1. Initialize a new node (Initialsyncfromasecondary) from a secondary node

You can set the initialSync option on the newly launched ReplicaSets node to specify that initialization data is obtained from a secondary node. As follows:

> rs.add ({"_ id": num, "host": hostname, "initialSync": {"state": 2}})

In the initialSync option is a filter, you can choose which role's machine to get initialization data (primaryorsecondary), or you can directly specify _ id,hostname or from the latest node of the data. If you specify to get initialization data from the latest node of the data, you can specify a date or timestamp, at which time the newly added node will select a node that is newer than the time point data you set to get the data.

The newly added node acquires initialization data from a secondary node by default, and only when such a node cannot be found will the data be obtained from the primary node. If he finds a secondary machine, he will only get the data needed for initialization from him, and once his data is synchronized with the secondary machine, he will switch to getting new update operations from the primary node.

two。 Slave delay configuration (slavedelay option)

This slavedelay option was previously supported in replication in master-slave mode and is mainly used to configure for a long time to prevent some human errors. For example, if you set this time to 86400, the synchronization operation will only synchronize the data from more than one day ago, and the synchronization operation will be done all the time, not just once a day (thanks to ElmerZhang for your message reminder). And now ReplicaSets also supports it, how to use it:

> rs.add ({"_ id": num, "host": hostname, "slaveDelay": 3600})

What are the new features of the MongoDB1.7.x version

3. Hidden Node (hiddennode)

The description of the hidden node is simple, that is, the node is hidden and invisible to the client. Configuration method:

> rs.add ({"_ id": num, "host": hostname, "priority": 0, "hidden": true})

4. Node freezing (Freezeamember)

One of the features of ReplicaSets is automatic failover, that is, after a primary machine fails, other secondary machines will choose a new host as soon as possible. But when we do some maintenance operations, we hope that for a certain period of time, the secondary machine that has lost its primary connection will not be promoted to primary, but will wait for a period of time before the election. This operation is called node freezing operation, and the specific operation method is as follows:

> rs.freeze (3600)

Thawing method:

> rs.freeze (0)

5. Fast synchronization (Fastsync)

In the past, when you started a new node, you could only get new data from the primary node, and the first feature above allowed you to get initialization data from the secondary node. But in any case, the synchronization of all data will be a slow process. The Fastsync feature allows the new node to start faster. Fastsync allows the new node to specify dbpath as a directory of data files that have been backed up in the past. As long as the backup time of this data is not long (no more than the oldest oplog of primary), you can start through the existing backup data files and then get new updates from the primary machine.

The way to view the oldest oplog is as follows:

> uselocal

> newDate (db.oplog.rs.find () .sort ({$natural:1}) .limit (1) .next () ["ts"] ["t"])

10gen's team also listed the following new features to be added in the future: authentication,syncingfromsecondariesbeyondtheinitialsync,datacenterawareness,andmore. If you want to add some other features, you can go to voteonthecasesyoucareabout to vote for the features you expect.

These are the new features of the version of MongoDB 1.7.x shared by the editor. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report