Setup x.509 Certificate for Membership Authentication. ![]() Create 3 nodes (Primary, Secondary and Arbiter) using MI - Arbiter can be replaced by another secondary node.Create Mongo Machine Image (MI) with CentOS 7 - Using this we can quickly create Mongo instances for production deployment as well as for DR.Use x.509 Certificate for Membership Authentication.With the WiredTiger storage engine (default), using XFS is strongly recommended.Minimum 2 real cores or one multi-core physical CPU.You can connect to as many MongoDB servers as you need to from Compass and start creating and managing all the MongoDB collections you need. Next stepsĬongratulations, you now have a well-designed GUI to help make your MongoDB admin tasks a bit easier. If you are still unable to connect to the containerized version of MongoDB from a remote instance of Compass, you might have to install Compass on the same machine running the MongoDB container. With the MongoDB container running, you can now connect to it with Compass using the same connect command you would use if MongoDB were installed via the traditional package manager and the user credentials you used with the environmental variables. NAME is a username and SECRET is a unique and strong password. Note: You might have to deploy the MongoDB container with environmental variables for the username and password, which can be done like so:ĭocker run -d –name some-mongo -e MONGO_INITDB_ROOT_USERNAME=NAME -e MONGO_INITDB_ROOT_PASSWORD=SECRET mongo If you’re not sure of the ID, you can find it with: In that command, ID is the ID of the Mongo container. Exit from the container with the exit command. Once you’ve made those changes, save and close the file. In that file, locate the following section: Once inside the container, we need to edit the MongoDB configuration file with this command: With the container running, you’ll need to access it with this command: We can now deploy the MongoDB container with the following:ĭocker run -d -p 27017:27017 -name example-mongo mongo:latest Deploying and configuring the MongoDB container Log out and log back in so the changes take effect. Now, add your user to the Docker group with the following: Sudo apt-get install docker-ce docker-ce-cli containerd.io -y In order to install the latest version of the Docker engine, you can use the following two commands: Sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release -y You can add the official Docker GPG key with this command:Ĭurl -fsSL | sudo gpg -dearmor -o /usr/share/keyrings/docker-archive-keyring.gpgĮcho "deb $(lsb_release -cs) stable" | sudo tee /etc/apt//docker.list > /dev/nullįrom there, it’s time to install the necessary dependencies with this command: The first thing to do when connecting to MongoDB through this method is installing Docker. If you’re more interested in general instructions for installing MongoDB GUI Compass and connecting it to a remote server, this tutorial may be a better place to start. Please note that this process is compatible with a variety of Linux distros. I’ll demonstrate with Ubuntu Linux and show you how to install Docker, deploy the container and then connect Compass to a database. To make this connection work, you’ll need a running instance of an operating system that supports both Docker and the MongoDB Compass app. What you’ll need to connect MongoDB Compass to a containerized database Deploying and configuring the MongoDB container. ![]()
0 Comments
Leave a Reply. |