MongoDB multiple instances
In the case of sufficient resources for a single server, multiple instances can be used to make full use of the server resources.
The steps are as follows:
The first thing you need to do is copy the configuration file as a
Then go to the backup configuration file to modify the log storage location, data file storage location, listening port, listening address.
Although we have defined the location of log files and data files, we have not created the defined directory, so we need to create the path here, but the main thing to do here is that the log files need to be given maximum permissions, otherwise an error will be reported when MongoDB is opened later.
Start using the mongod-f configuration file path. Such as mongod-f / etc/mongod2. In this way, if you look at the port, you will find that there are two ports, and the same multi-instance is complete.
We can use the mongo-- port port number to enter