Open lupetalo opened 9 years ago
Last I checked robomongo was behind the mongo schema version so here is what I did after deleting the existing user.
If your mongo log says that user information doesn't exist or similar error then
Create a user
mongo
db.createCollection('uptime')
use uptime
db.createUser({
user: "some_name",
pwd: "some_password",
roles: ["readWrite", "dbAdmin"]
})
Make auth enabled:
vim /etc/mongod.conf
# Listen to local interface only. Comment out to listen on all interfaces.
bind_ip = 0.0.0.0
# Turn on/off security. Off is currently the default
#noauth = true
auth = true
after restart test auth
mongo -u admin -p --authenticationDatabase uptime
Now retest Hope it should work.
did you solve this? im getting the same problem in an os x environment. authentication works as i have tried from the command shell, but for some reason it keeps getting rejected from uptime
Nope....
+1
found the answer in a stackoverflow answer:
mongo
use admin
db.system.users.remove({}) <== removing all users
db.system.version.remove({}) <== removing current version
db.system.version.insert({ "_id" : "authSchema", "currentVersion" : 3 })
re-add your user and it should work
I had the same issue. If you don't have the authentication enabled, the solution is to configure your connection URI string without credentials in the config/default.yaml
file.
With a local database, the connectionString
parameter should resemble to
connectionString: mongodb://localhost:27017/uptime
gfornari, could you please elaborate? Is that instead of the solution posted by ayhoung?
If it's correct, where mongoose create the connection, if the connectionString
is not set, then a connection URI string is built, but in a way that force you to have an authentication system in your database. Setting the connectionString
you actually work around the problem due to the priority that it has against the other parameters.
A possible solution at source code level is to build the connections URI string in a smarter way checking whether the user and the password are set or not.
About the solution posted by @ayhoung, I haven't tried it, but I would not manipulate the system collections.
Wonderful, and where do I set this connectionString?
As I previously said, you can change it in the config/default.yaml
file ;).
Of course, be aware of the environment with whom you run your app. As stated in the Readme, if you run your app in a production environment (e.g. running NODE_ENV=production node app
), you should have a proper config/production.yaml
file.
So I added connectionString:
mongodb://localhost:27017/uptime
to the config/default.yaml file and I still get this output:
uptime@uptime:~/uptime$ nodejs app
loading plugin ./plugins/console on app
loading plugin ./plugins/patternMatcher on app
loading plugin ./plugins/httpOptions on app
info - socket.io started
loading plugin ./plugins/patternMatcher on monitor
loading plugin ./plugins/httpOptions on monitor
Monitor origin started
Express server listening on host localhost, port 8082 in development mode
MongoDB error: auth failed
Make sure a mongoDB server is running and accessible by this application
when I run:
service mondo status
I get
mongod start/running, process 817
I also ran a telnet to confirm mongo is on the proper port:
netstat -anp | grep mongo
returns
uptime@uptime:~/uptime$ sudo netstat -anp | grep mongo
tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN
For reference, db.version() in the mongo shell returns:
> db.version()
3.0.6
and my nodejs version is:
v0.10.25
Any ideas?
Do you have the mongod authentication enabled?
So I did a complete reinstall of everything (including ubuntu server 14.04) and added the
connectionString: mongodb://localhost:27017/uptime
line to the config/default.yaml and still got:
up@uptime:~/uptime$ nodejs app
loading plugin ./plugins/console on app
loading plugin ./plugins/patternMatcher on app
loading plugin ./plugins/httpOptions on app
info - socket.io started
loading plugin ./plugins/patternMatcher on monitor
loading plugin ./plugins/httpOptions on monitor
Monitor origin started
Express server listening on host localhost, port 8082 in development mode
MongoDB error: auth failed
Make sure a mongoDB server is running and accessible by this application
also running into this on a fresh install, followed all the steps.
I tried again with a fresh install with MongoDB v3.0.6 and Node.js v0.12.7. It works for me following my comment.
a fresh install of the uptime repo solved my problem.
I am first time user of MongoDB and Node, so i am sorry for maybe asking stupid questions.
i get no errors while installing. Than i created mongodb with robomongo gui, added user with read/write and change details in default.yaml config. error is same. Can you please explain install proces to users that are less tehnical about this, because if you do exactly like in video or in readme, you cant run this... Thanks