create_event_repository_partitions.py

The create_event_repository_partitions.py script creates the indexes for collections that are to be generated in your MongoDB system to store event objects in the Event Repository. If you plan to load event objects into only one collection (no partitioning), run this script only once. If you plan to load event objects into multiple collections (partitioning is used), run this script at regular intervals (such as a cron job) so that new partitions are created. This script is also run in the Event Loader every 30 days using a --daysAhead value of 60.

Syntax

create_event_repository_partitions.py --host serverName|ipAddress --port portNumber [--daysAhead=numberDays] [--version] [-u username] [--uri=full_MongoDB_Atlas_uri] [--eventDatabase TenantDatabaseName] [--authDatabase AuthenticationDatabaseName] [--srv] [-h] 

Options

The create_event_repository_partitions.py script has the following options:

--daysAhead dayCount
For the event collection, if partitioning is to be used, this option specifies how far ahead to create future partitions.
The default value is 10 (days).
This option determines when the partitions (that support the number of collections to be generated) are created in your MongoDB system:

create_event_repository_partitions.py --daysAhead=numberDays

If the value given is 10, then all the partitions covering the next 10 days are created. If the value given is 30, then all the partitions covering the next 30 days are created. In these examples, the create_event_repository_partitions.py script is run at least once every 10 and 30 days, respectively. Running the script more often does not cause any issues.

Note: The script can be run more often because partitions that have been created are not affected or created again. If the collection partitioning configuration, or index definition configurations changed in the database, future empty collections created using the old configuration must be deleted so that they can be created using the new configurations.
--eventDatabase
(Optional) The name of the tenant database. Specify this option as needed for tenant repository queries. The default value is MtxEventDatabase. If you specify a URI, and the event database is not MtxEventDatabase, you must specify the --eventDatabase option.
--authDatabase
(Optional) The name of the database to be used for the authentication in the MongoDB URI. The default value is admin.
-u username, --user=username
Specify the MongoDB user to log in as.
--version
Show the program version number.
--host=serverName|ipAddress
The MongoDB host to connect to. This option specifies the host name or IP address of a machine on which one of the mongod instances in your replica set is running. Connecting to a machine on which your primary mongod is running is recommended. The default value is 127.0.0.1.
--port
The MongoDB port to connect to. Specify this option only if the port is not the default (27017).
--uri
The full URI for the MongoDB or MongoDB Atlas database. If the username or password has any special characters, they must be URI-encoded, for example, if the password has an @ character, it must be in the URI as %40. If the URI has an ampersand (&), the & must be escaped (preceded by a backslash (\&)) or the full URI must be inside quotes, for example:
uri=mongodb+srv://cluster0.8n9ep.mongodb.net/MtxEventDatabase?retryWrites=true\&option=value

uri="http://host/path?var1=val1&var2=val2"
Note: When entering the URI in create_config.py, if the URI has an &, it must be escaped (\&) to prevent the configuration file from becoming invalid. This option is needed only if there are other MongoDB driver parameters (like LDAP) that are not handled by the other options. If you specify a URI, and the event database is not MtxEventDatabase, you must also specify the --eventDatabase option.
--srv
If this parameter is specified, an SRV-based URI is generated for a MongoDB Atlas database. If this parameter is not specified, a regular MongoDB database URI is generated.
-h, --help
Show help about the script options.

Creates Partitions Covering the Next 31 Days

For multiple collections (partitioning is used), this example creates all the partitions covering the next 31 days. This example output is for a sharded MongoDB deployment:
create_event_repository_partitions.py –-daysAhead 31
=======================================================================
create_event_repository_partitions.py started on 2016-03-17 16:45:11
=======================================================================
Enabled sharding for collection 'EventCollection20160316'.
Enabled sharding for collection 'EventCollection20160331'.
Created index [(u'WalletOwnerId', 1), (u'EventTime', 1)] {'name': u'MtxWalletOwnerId_1_​EventTime_1'}
for 'EventCollection20160316'.
Created index [(u'WalletOwnerId', 1), (u'EventTime', 1)] {'name': u'MtxWalletOwnerId_1_​EventTime_1'} for 'EventCollection20160331'.
Created index [(u'EventTime', 1)] {'name': u'MtxEventTime_1'} for 'EventCollection20160316'.
Created index [(u'EventTime', 1)] {'name': u'MtxEventTime_1'} for 'EventCollection20160331'.