MongoDB Tip: The touch Command

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
リリース: 2016-06-07 16:29:45
オリジナル
995 人が閲覧しました

MongoDB 2.2 introduced the touch command, which loads data from the data storage layer into memory. The touch command will load a collection’s documents, indexes or both into memory. This can be ideal to preheat a newly started server, in

MongoDB 2.2 introduced the touch command, which loads data from the data storage layer into memory. The touch command will load a collection’s documents, indexes or both into memory. This can be ideal to preheat a newly started server, in order to avoid page faults and slow performance once the server is brought into production. You can also use this when adding a new secondary to an existing replica set to ensure speedy subsequent reads.

Note that while the touch command is running, a replica set member will enter into a RECOVERING state to prevent reads from clients. When the operation completes, the secondary will return to the SECONDARY(2) state.

You invoke the touch command through the following syntax:

db.runcommand({ touch: “collection_name”, data: true, index: true})
ログイン後にコピー


Here you indicate which collection to touch and whether or not you want both documents (data) and/or indexes to be loaded into memory. Index and data are both off by default, so you will need to indicate at least one as “true” to have any effect on your server. Otherwise you will see the following message:

db.test.runCommand(“touch”)
 ???????"ok" : 0,
 ???????"errmsg" : "must specify at least one of (data:true, index:true)
ログイン後にコピー

touch is non-blocking on a mongod process, so you can run it concurrent with other commands.


For a full list of MongoDB commands, check out the Database commands in the MongoDB Manual

関連ラベル:
ソース:php.cn
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
最新の問題
Mac での mongodb の構成エラー
から 1970-01-01 08:00:00
0
0
0
symfony2 mongodb の使用
から 1970-01-01 08:00:00
0
0
0
mongodbのパラメータの理解
から 1970-01-01 08:00:00
0
0
0
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート