Add Indexes for TTL to Stats and Trace Collections
Add MongoDB indexes for TTL to the collections of the MATRIXX Event Repository that contain event-loading statuses and traces.
About this task
This is an optional index for the Event Repository. MongoDB indexes can be added to your MongoDB system at any time, but perform this task as part of your initial setup of the Event Repository before you run the create_event_repository_partitions.py script.
Procedure
-
Do one of the following:
- For a non-sharded
MongoDB deployment:
Connect to the primary
mongod
of the replica set using the MongoDB mongo shell CLI.mongo
- For a sharded MongoDB deployment:
Start a mongo shell and connect to the
mongos
.mongo
- For a non-sharded
MongoDB deployment:
-
Enter the following commands to add TTL-related indexes to the Event Repository event collection of your
MongoDB system and to remove trace and stats data (MEF-loading information) from the collection after 30 days. If you do not add the TTL-related indexes to these collections, you
must purge the records periodically, for example, monthly, to achieve optimal performance.
use MtxEventDatabasedb.LoaderTraceCollection.createIndex( { "Time": 1 }, { expireAfterSeconds: 2592000 } )db.LoaderStatsCollection.createIndex( { "Time": 1 }, { expireAfterSeconds: 2592000 } )Note:
expireAfterSeconds
is the number of seconds after which MEF-loading information is purged (in this example, it is purged after 30 days). MEF-loading information can be useful during MEF recovery (to find out what is missing) so do not purge it too quickly.