Running the MongoDB collector on-premise
Important
This collector is available in Private Preview. If you would like access to this collector, please contact your Customer Success Director.
Note
The latest version of the Collector is 2.253. To view the release notes for this version and all previous versions, please go here.
Generating the command or YAML file
This section walks you through the process of generating the command or YAML file for running the collector from Windows or Linux or MAC OS.
To generate the command or YAML file:
On the Organization profile page, go to the Settings tab > Metadata collectors section.
Click the Add a collector button.
On the Choose metadata collector screen, select the correct metadata source. Click Next.
On the Choose where the collector will run screen, in the On-premise section, select if you will be running the collector on Windows or Mac OS or Linux. This will determine the format of the YAML and CLI that is generated in the end. Click Next.
On the On-prem collector setup prerequisites screen, read the pre-requisites and click Next.
On the Configure an on-premises MongoDB Collector screen, set the following properties and click Next.
On the next screen, set the following properties and click Next.
Table 2.Field name
Corresponding parameter name
Details
Required?
Connection String
--connection-string=<connectionString>
Specify the connection string to connect to your MongoDB cluster/instance. Ensure any option parameters are URL encoded.
To get a connection string, go to the selected cluster in the MongoDB web interface from which you want to collect the catalog, click Connect > Drivers, then select Java and your desired authentication method. For example:
For username/password authentication, use a string like mongodb+srv://<db_user>:<db_password>@<clusterUrl>/?retryWrites=true&w=majority&appName=<clusterName>.
Replace <db_password> with the password for the <db_user> database user, <clusterUrl> and <clusterName> with your cluster URL and name accordingly.
For X.509 authentication, use a string like mongodb+srv://<clusterUrl>/?retryWrites=true&w=majority&appName=<clusterName>&authMechanism=MONGODB-X509&authSource=%24external&tls=true.
Replace <clusterUrl> and <clusterName> with the appropriate values. As a prerequisite, set the javax.net.ssl.keyStore and javax.net.ssl.keyStorePassword values as system properties or pass them as java parameters, where:
javax.net.ssl.keyStore: the path to a key store containing the client TLS/SSL certificates
javax.net.ssl.keyStorePassword: the password to access the key store defined in javax.net.ssl.keyStore
For details, see x.509 security and Configure the JVM Key Store documentation pages.
For AWS IAM authentication, use a string like mongodb+srv://<AWS access key>:<AWS secret key>@<clusterUrl>/?authSource=%24external&authMechanism=MONGODB-AWS&retryWrites=true&w=majority&authMechanismProperties=AWS_SESSION_TOKEN:<session token (for AWS IAM Roles)>&appName=<clusterName> aa
Replace <AWS access key> and <AWS secret key> with the secret and access key of your Amazon resource. If you are using an assumed role to authenticate, replace <session token (for AWS IAM Roles)> with the resultant session token. Also, replace <clusterUrl> and <clusterName> with your cluster URL and name accordingly.
For details, see Connection string options documentation.
Yes
Included Databases
--include-database=<includeDatabase>
Specify the databases to be collected. You can either provide the database name or a regular expression to match. Use the parameter multiple times for multiple specific databases. For example, --include-database="databaseA" --include-database="databaseB".
If multiple regular expressions are specified, the collector will harvest databases that match any of them.
No
Excluded Databases
--exclude-database=<excludeDatabase>
Specify the databases to be excluded by the collector. You can either provide the database name or a regular expression to match. Use the parameter multiple times for multiple specific databases. For example, --exclude-database="databaseA" --exclude-database="databaseB".
If multiple regular expressions are specified, the collector will exclude databases that match any of them. If both --include-database and --exclude-database are specified, --include-database takes precedence.
No
Analysis Samples Count
--analysis-samples-count=<analysisSamplesCount>
Specify the document amount from a collection for sampling analysis ($sample aggregation). It is used to determine collection field types and must be a non-negative integer. The default is 1000.
No
On the next screen, provide the Collector configuration name. This is the name used to save the configuration details. The configuration is saved and made available on the Metadata collectors summary page from where you can edit or delete the configuration at a later point. Click Save and Continue.
On the Finalize your MongoDB configuration screen, you are notified about the environment variables and directories you need to setup for running the collector. Select if you want to generate Configuration file ( YAML) or Command line arguments (CLI). Click Next.
The next screen gives you an option to download the YAML configuration file or copy the CLI command. Click Done. If you generated a YAML file, click Next.
The MongoDB Collector command screen gives you the command to use for running the collector using the YAML file.
You will notice that the YAML/CLI has following additional parameters that are automatically set for you.
Warning
Except for the collector version, you should not change the values of any of the parameter listed here.
Table 3.Parameter name
Details
Required?
-a= <agent>
--agent= <agent>
--account= <agent>
The ID for the data.world account into which you will load this catalog - this is used to generate the namespace for any URIs generated.
Yes
--site= <site>
This parameter should be set only for Private instances. Do not set it for public instances and single-tenant installations. Required for private instance installations.
Yes (required for private instance installations)
-U
--upload
Whether to upload the generated catalog to the organization account's catalogs dataset.
Yes
--no-log-upload
Do not upload the log of the collector run to a dataset in data.world. This is the same dataset where the collector output is uploaded. By default, log files are uploaded to this dataset.
Yes
dwcc: <CollectorVersion>
The version of the collector you want to use (For example,
datadotworld/dwcc:2.248)
Yes
Add the following additional parameter to test run the collector.
--dry-run: If specified, the collector does not actually harvest any metadata, but just checks the connection parameters provided by the user and reports success or failure at connecting.
We recommend enabling debug level logs when running the collector for the first time. This approach aids in swiftly troubleshooting any configuration and connection issues that might arise during collector runs. Add the following parameter to your collector command:
-e log_level=DEBUG: Enables debug level logging for collectors.
Verifying environment variables and directories
Verify that you have set up all the required environment variables that were identified by the Collector Wizard before running the collector. Alternatively, you can set these credentials in a credential vault and use a script to retrieve those credentials.
Verify that you have set up all the required directories that were identified by the Collector Wizard.
Running the collector
Important
Before you begin running the collector make sure you have completed all the pre-requisite tasks.
Running collector using YAML file
Go to the machine where you have setup docker to run the collector.
Place the YAML file generated from the Collector wizard to the correct directory.
From the command line, run the command generated from the application for executing the YAML file.
Caution
Note that is just a sample command for showing the syntax. You must generate the command specific to your setup from the application UI.
docker run -it --rm --mount type=bind,source=${HOME}/dwcc,target=/dwcc-output \ --mount type=bind,source=${HOME}/dwcc,target=/app/log -e DW_MONGODB_STRING=${DW_MONGODB_STRING} \ -e DW_AUTH_TOKEN=${DW_AUTH_TOKEN} datadotworld/dwcc:2.242 --config-file=/dwcc-output/config-mongodb.yml
If you are running the collector using Jar files, be sure to edit the command as instructed on this page.
The collector automatically uploads the file to the specified dataset and you can also find the output at the location you specified while running the collector. Similarly, the log files are uploaded to the specified dataset and can be found in the directory mounted to target=/app/log specified in the command.
If you decide in the future that you want to run the collector using an updated version, simply modify the collector version in the provided command. This will allow you to run the collector with the latest version.
Running collector without the YAML file
Go to the machine where you have setup docker to run the collector.
From the command line, run the command generated from the application. Here is a sample command.
Caution
Note that is just a sample command for showing the syntax. You must generate the command specific to your setup from the application UI.
docker run -it --rm --mount type=bind,source=${HOME}/dwcc,target=/dwcc-output \ --mount type=bind,source=${HOME}/dwcc,target=/app/log datadotworld/dwcc:2.242 \ catalog-mongodb --collector-metadata=config-id=85d89f6d-a7f6-4057-a29b-d724bff46456 \ --agent=collector-test-org --connection-string=${DW_MONGODB_STRING} \ --include-database=${DW_MONGODB_DATABASE(S)} --exclude-database=${DW_MONGODB_DATABASE(S)} \ --api-token=${DW_AUTH_TOKEN} --upload=true --name="MongoDB Collection" \ --output=/dwcc-output --upload-location=upload-location
If you are running the collector using Jar files, be sure to edit the command as instructed on this page.
The collector automatically uploads the file to the specified dataset and you can also find the output at the location you specified while running the collector. Similarly, the log files are uploaded to the specified dataset and can be found in the directory mounted to target=/app/log specified in the command.
If you decide in the future that you want to run the collector using an updated version, simply modify the collector version in the provided command. This will allow you to run the collector with the latest version.
Automating updates to your metadata catalog
Maintaining an up-to-date metadata catalog is crucial and can be achieved by employing Azure Pipelines, CircleCI, or any automation tool of your preference to execute the catalog collector regularly.
There are two primary strategies for setting up the collector run times:
Scheduled: You can configure the collector according to the anticipated frequency of metadata changes in your data source and the business need to access updated metadata. It's necessary to account for the completion time of the collector run (which depends on the size of the source) and the time required to load the collector's output into your catalog. This could be for instance daily or weekly. We recommend scheduling the collector run during off-peak times for optimal performance.
Event-triggered: If you have set up automations that refresh the data in a source technology, you can set up the collector to execute whenever the upstream jobs are completed successfully. For example, if you're using Airflow, Github actions, dbt, etc., you can configure the collector to automatically run and keep your catalog updated following modifications to your data sources.
Managing collector runs and configuration details
From the Metadata collectors summary page, view the collectors runs to ensure they are running successfully,
From the same Metadata collectors summary page you can view, edit, or delete the configuration details for the collectors.