In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Today, we will probably study the wiredtiger engine. Mongo was introduced from 3.0. it is mainly to solve the problem of eating too much memory and taking up a lot of disk space. In fact, the performance of using the wt engine is still worse than that of tokuft, but the code iteration of tokuft is too slow, so we still use mongo. First of all, the default is the mmapv1 engine, so we need to reassign the wt engine. Since version 3.2, I have defaulted to wt. What I use now is mainly configuration optimization. I read the things written by many people, all of which are specially copied. I'll write it on the official document to record it.
Storage.wiredTiger Optionsstorage: wiredTiger: engineConfig: cacheSizeGB: journalCompressor: directoryForIndexes: collectionConfig: blockCompressor: indexConfig: prefixCompression:
This is official, and now it's my own.
Storage: dbPath: / var/lib/mongo journal: enabled: true# engine:# mmapv1:# wiredTiger: wiredTiger: engineConfig: cacheSizeGB: 0.25 # # here Size is the Cache size of WT itself and does not represent the memory used by Mongod. # the default is Max (1G, 1x2 of memory). Please give it as much as possible, and try to Cache all the hot data. # make sure that the Dirty does not exceed 1%. Of course, this is related to your business and the speed of reading and writing queries. # in addition, the unit of Cache is Page rather than Document. JournalCompressor: snappy # # specifies the compression method for Journal Log alone. By default, snappy supports "none, snappy, zlib". In general, zlib is not required. Although the compression ratio is high, the occupancy rate of cpu is also high. DirectoryForIndexes: true # # Index files and data files are separated, indexing a directory and data a directory. CollectionConfig: blockCompressor: zlib # the compression method of Collection in database is snappy by default, and also supports "none, snappy, zlib". # generally, snappy is sufficient, snappy cpu utilization is low, compression ratio is not very high, but it can meet general business needs. # zlib has the highest compression ratio, and cpu utilization is also high, if cpu resources are abundant To reduce disk space, you can choose zlib. IndexConfig: prefixCompression: true # # whether prefix compression is enabled for indexes, which affects all DB indexes. It stores all indexes with the same prefix at one time. # # reduces the consumption of memory and disk IO. It is enabled by default.
Official original text:
Values can range from 256MB to 10TB and can be a float. In addition, the default value has also changed.
Starting in 3.4, the WiredTiger internal cache, by default, will use the larger of either:
50% of RAM minus 1 GB, or
256 MB.
Avoid increasing the WiredTiger internal cache size above its default value.
With WiredTiger, MongoDB utilizes both the WiredTiger internal cache and the filesystem cache.
Via the filesystem cache, MongoDB automatically uses all free memory that is not used by the WiredTiger cache or by other processes. Data in the filesystem cache is compressed.
From this, we can see that when the memory is large enough, the main thing is to improve the performance of cpu. Although zlib is the highest compression, it also eats cpu the most. In addition, when the storage engine is switched over, start from second, enter the server, db.shutdownServer (), turn off the server, then clear all the data, then configure the wt engine, and then mount it back for resynchronization.
Official original text: http://docs.mongoing.com/manual-zh/tutorial/change-replica-set-wiredtiger.html
Steps
In this step, the data of secondary in the replication set is completely removed, then restart mongod using WiredTiger storage engine, and complete data synchronization with: doc: `initialization synchronization.
When upgrading the member storage engine in a replication set, upgrade the secondary member first. Then the primary is demoted to a slave node, and then the upgrade is demoted to a member of the slave node.
one
Shut down the secondary member.
In the mongo shell, shut down the secondary mongod instance you wish to upgrade.
Db.shutdownServer ()
two
Prepare a data directory for the new mongod running with WiredTiger.
Prepare a data directory for the new mongod instance that will run with the WiredTiger storage engine.mongod must have read and write permissions for this directory. You can either delete the contents of the stopped secondary member's current data directory or create a new directory entirely.
Mongod with WiredTiger will not start with data files created with a different storage engine.
three
Start mongod with WiredTiger.
Start mongod, specifying wiredTiger as the-storageEngine and the prepared data directory for WiredTiger as the-dbpath. Specify additional options as appropriate for this replica set member.
Mongod-storageEngine wiredTiger-dbpath-replSet
Since no data exists in the-dbpath, the mongod will perform an initial sync. The length of the initial sync process depends on the size of the database and network connection between members of the replica set.
You can also specify the options in a configuration file. To specify thestorage engine, use thestorage.engine setting.
four
Repeat the procedure for other replica set secondaries you wish to upgrade.
Perform this procedure again for the rest of the secondary members of the replica set you wish to use the WiredTiger storage engine.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.