partition_events.py
Use the partition_events.py script to migrate your event repositories from single collections to multiple collections. Reconfigure the event collection partitioning value to multiple collections (1, 2, 3, or 4), and then run the partition_events.py script. For details, see the discussion about resetting the partitioning method configuration.
Note: Do not run the partition_events.py script during
GL queries as this might cause an event to appear twice if it is being moved during
the query. If necessary, you can stop the script to complete GL queries. The next
time the script runs, it picks up where it was stopped.
Syntax
partition_events.py --host serverName|ipAddress --port portNumber [--user username] [--eventsPerSec eventsPerSec] [--logEveryN logEveryN] [--logEverySec logEverySec] [--uri=full_MongoDB_Atlas_uri] [--srv] [--dryrun] [-h]
Options
The partition_events.py script has the following options.
- --host=serverName|ipAddress
- The MongoDB server 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 primarymongod
is running is recommended. The default value is 127.0.0.1. - --port=portNumber
- The MongoDB server port to connect to. Specify this option only if the port is not the default (27017).
- -u username, --user=username
- Specify the MongoDB user to log in as.
- --eventsPerSec=eventsPerSec
- Throttle events to this maximum number per second. This option tries to throttle the script to place less load on the MongoDB repository. The default value is 1000000.
- --logEveryN=logEveryN
- Logs a message every N events that are moved. The default value is 1000.
- --logEverySec=logEverySec
- Logs a message every N seconds including the current progress. The default value is 30.
- --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"
- --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.
- --dryrun
- Runs the script without moving any events. The default value is
False
. - -h, --help
- Show help about the script options.