I'm running a 3 server MongoDB replica set. I recently upgraded from 2.4 to 2.6.
On 2.4 I was able to reach the HTTP Console on all three servers, regardless of whether they were Primary or Secondary. Now with 2.6 there is a different config setting needed to enable the console.
# Disable the HTTP interface (Defaults to localhost:28017).
#nohttpinterface = true
nohttpinterface = false
If I create a completely fresh, standalone instance with 2.6, it works. However on the replica set, it does not. MongoDB is running on 27017 and I have confirmed nothing is running on 28017, so that rules out firewall issues.
Are there additional changes required to enable this feature on a replica set?
Adding
httpinterface=true
in /etc/mongod.conf enables it on http://127.0.0.1:28017
I had to add
rest=true
to enable REST interface so that commands in http console are working.
For mongodb v3.0.2 the mongod.conf is a yaml file,
you should add these two lines after net:
http.enabled: true
http.RESTInterfaceEnabled: true
my mongod.conf is
net:
bindIp: 127.0.0.1
http.enabled: true
http.RESTInterfaceEnabled: true
https://docs.mongodb.com/ecosystem/tools/http-interfaces/
HTTP Status Interface
Deprecated since version 3.2: Starting in 3.2, MongoDB deprecates the HTTP interface.
Related
We installed MongoDB on windows(development) version 3.4, and enabled authentication, after running the command mongod --auth, the authentication was successfully implemented.
Now on the production server that is Ubuntu 16, with MongoDb version 4.0, we made changes to the mongod.conf file as seen below and then restated the mongod service with command sudo service mongod start, but now we are not able to connect to our MongoDB Ubuntu server.
security:
authorization: "enabled"
Where did we go wrong in implementing authentication for MongoDB on Ubuntu server.
security:
authorization: "enabled"
2 possible issues here : reading the doc, i'm not sure you need to quote the enabled word.
Moreover, yaml format need to increment sub part of conf, so your conf file have to look like :
security:
authorization: enabled
But cannot really test, since i don't have any running local instance
I'm using MongoDB v3.0.0 with the following configuration file:
storage:
dbPath: "/home/vagrant/backend/mongodata"
engine: wiredTiger
systemLog:
destination: file
path: "/home/vagrant/backend/log/mongo.log"
logAppend: true
net:
port: 27017
# Enable the HTTP interface (Defaults to port 28017).
http:
enabled: false
ssl:
mode: requireSSL
PEMKeyFile: /home/vagrant/backend/keys/privKeys.pem
security:
authorization: 'enabled'
But when I start it up, I get the following error:
Unrecognized option: net.ssl.PEMKeyFile
try '/home/vagrant/backend/mongo/bin/mongod --help' for more information
It looks like I have it set up pretty much exactly like they recommend in the docs: https://docs.mongodb.com/manual/tutorial/configure-ssl/ . The docs say this is new in mongo 3.0, so it should support this option. It does say certain distributions still don't support it (bizarrely), so I should include that I installed mongo via this: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.0.tgz . The closest info I could find is the MongoDB Download Center saying version 3.0.14 for linux "has been compiled with SSL enabled and dynamically linked. This requires that SSL libraries be installed seperately. See here for more information on installing OpenSSL."
Any idea what might be going wrong here?
For me its looks like spacing issue in configuration you may need to check the spacing only two spaces are allowed with list members ssl become underneath of net so when declaring ssl ensure the spaces
here are my working configurations.
net:
port: 28017
bindIp: 127.0.0.1
ssl:
mode: requireSSL
PEMKeyFile: /etc/ssl/mongodb/mongodb-server.pem
CAFile: /etc/ssl/mongodb/mongodb-client.pem
PEMKeyPassword: abc123+
Since MongoDB v3.0.x most MongoDB distributions include support for SSL, but not all. As you have figured out, most likely the distribution that you have does not support SSL.
If you're starting a new MongoDB deployment, I would recommend to install the latest stable release, currently at MongoDB v3.4.x which have more (if not all) distributions supporting SSL. See Release Notes for MongoDB 3.4
Worked for me Mongo version 4.2.8 :
Ignore the message and check the Mongo logs, I found that the path configured for the PEM file was incorrect and should be the fully qualified path. Even after configuring it right, there was this SSL warning that was still present but worked.
ssl:
mode: requireSSL
PEMKeyFile: /data/users/mongodb/mongodb.pem
PEMKeyPassword: YOUR_PASS
mongoDB version 2.6 was an option file mongod.conf
Allow "Auth" Or "NoAuth"
How to do it now mongoDB version 3.2?
According to the Mongo docs here -
https://docs.mongodb.com/manual/reference/configuration-options/#security.authorization - one can enable authorization (which is DISABLED by default) by doing the following:
Edit the mongo settings file /etc/mongod.conf
Add the line:
security.authorization : enabled
Restart the service
Regards,
we are using centos 7 , mongodb 3.0.8
Im trying to disable anonymous access to mongodb.
Place auth = true in /etc/mongod.conf disabling anonymous access in version 2.x
but in version 3 when i place the same , the server it self not starting
When i hard search , i found in the mongo docs that in version 3.x
security.authorization should be placed in /etc/mongod.conf
Could any one please help me how to place security.authorization in config file.
add the following to the mongod.conf file:
security:
authorization: enabled
I am running mongod as standalone server .now i want to enable oplog for it ,i want to know whether it is possible or not ?
I knew I can do this by creating single node ReplicaSet ,but I want to do this without replica set .
I got a reply from the MongoDb Team, and it's working fine.
To enable oplog on a standalone server, start mongo with master options.
On command line start mongod --master.
For conf file append the following line:
master=true
More details here.
For mongo 2.6 or greater the /etc/mongod.conf now uses a yaml format.
To enable the oplog add something similar to the below, note the replication: line may already exist, be sure to use spaces.
replication:
replSetName: rs0
oplogSizeMB: 100
Full documentation here:
https://docs.mongodb.com/manual/reference/configuration-options/#replication-options