MongoDB
🐕🦺 Setup guide
This guide will help you set up MongoDB as a data source for your Zenskar account.
Prerequisites
Create users
Run mongo
shell, switch to admin
database and create a READ_ONLY_USER
. READ_ONLY_USER
will be used for Zenskar integration.
mongouse admin;db.createUser({user: "READ_ONLY_USER", pwd: "READ_ONLY_PASSWORD", roles: [{role: "read", db: "TARGET_DATABASE"}]})
Access
Please ensure that the user has appropriate access levels: read-only privileges. A user with higher or lower privileges may result in errors.
Enable MongoDB authentication
Open /etc/mongod.conf
and add/replace specific keys:
net:
bindIp: 0.0.0.0
security:
authorization: enabled
- Setting
bindIP
to0.0.0.0
will allow connections to database from any IP address. - The last line will enable MongoDB security: only authenticated users will be able to access the database.
Configure firewall
Make sure that MongoDB is accessible from external servers. Specific commands will depend on the firewall you are using (UFW/iptables/AWS/etc). Please refer to appropriate documentation.
Your READ_ONLY_USER
should now be ready for use with Zenskar.
TLS/SSL on a Connection
It is recommended to use encrypted connection. Connection with TLS/SSL security protocol for MongoDb Atlas Cluster and Replica Set instances is enabled by default. To enable TSL/SSL connection with Standalone MongoDb instance, please refer to MongoDb Documentation.
⚙️ Set up MongoDB as data source in Zenskar
⚙️ Set up data source and type
- Log into your Zenskar account.
- In the left navigation bar, navigate to Metering > Data Sources. In the top-right corner, click + ADD DATA SOURCE.
- In the Set Up Source section of the Add New Data Source page, enter a name for the MongoDB data source connection.
- Select MongoDB from the Source Type dropdown.
⚙️ Configure data source
In the Source Config section of the Add New Data Source page, do the following:
- User: username to use when connecting
- Database Name: database name
- Password: used to authenticate the user
- Authentication Source: specifies the database that the supplied credentials should be validated against. Defaults to
admin
. - MongoDb Instance Type
- Standalone MongoDb instance
- TLS: indicates whether to create encrypted connection
- Host: URL of the database
- Port: Port to use for connecting to the database
- Replica Set
- Replica Set: A replica set name
- Server addresses: the members of a replica set
- MongoDb Atlas Cluster
- Cluster URL: URL of a cluster to connect to
- Standalone MongoDb instance
For more information regarding configuration parameters, please see MongoDb Documentation.
Updated 18 days ago