mongo displays error on MAMP - mongodb

I have followed this after installing Mongo on Mac.
On php.ini shows mongo details.
mongo
MongoDB Support enabled
Version 1.0.11
Directive Local Value Master Value
mongo.allow_empty_keys 0 0
mongo.allow_persistent 1 1
mongo.auto_reconnect 1 1
mongo.chunk_size 262144 262144
mongo.cmd $ $
mongo.default_host localhost localhost
mongo.default_port 27017 27017
mongo.long_as_object 0 0
mongo.native_long 0 0
mongo.utf8 1 1
But when I type mongo on a terminal it displays the following error.
sokada-macbook:bin sokada$ mongo
MongoDB shell version: 2.0.6
connecting to: test
Thu Jun 14 21:54:47 Error: couldn't connect to server 127.0.0.1 shell/mongo.js:84
exception: connect failed
I thank you in advance to solve this problem.

I needed to run the following in the terminal.
sudo mkdir -p /data/db
sudo chown `id -u` /data/db
Then I run mongo and give the following.
sokada-macbook:~ sokada$ mongo
MongoDB shell version: 2.0.6
connecting to: test
>

It looks like you have successfully installed the Mongo support for PHP, but haven't started the actual mongod server yet.
In the tutorial you followed, that would be Step 4. Create Startup Routines for MAMP.

Related

pg_dump: sever version:11.7; pg_dump version: 10.3(Ubuntu-10.3-1) pg_dump: aborting because of server version mismatch

I use pip3 install pgadmin4==4.30 to install pgadmin in my ubuntu. And I want to backup my remote server data by Tools-Backup in pgadmin, which is equal to the following command.
/usr/bin/pg_dump --file "~/demo.backup" --host "127.0.0.1" --port "42885" --username "postgres"....
However there is an error says:pg_dump: sever version:11.7; pg_dump version: 10.3(Ubuntu-10.3-1). One thing that puzzles me is I don't have version 11.7 installed at all. Here is the output of ls -la /usr/bin/pg_dump
0 lrwxrwxrwx 1 root root 34 Mar 2 18:05 /usr/bin/pg_dump -> /usr/lib/postgresql/10/bin/pg_dump
And there is only one version(10) in /usr/lib/postgresql folder. Anyone can tell me how I can fix this? I have tried every solution of this and neither of them worked out.

Mongoexport with cluster throws i/o timeout error

Just upgraded to mongo 3.0, but mongoexport gives us a the following error: "Failed: read tcp 127.0.0.1:27020: i/o timeout" after outputting some documents (not always the same amount). mongoexport is connecting to a sharded cluster of 4 standalone mongod servers with 3 mongod config servers
[root#SRV]$ mongoexport --host
localhost:27022,localhost:27021,localhost:27020 --db horus
--collection users --type json --fields _id | wc -l
2015-03-09T12:41:19.198-0600 connected to:
localhost:27022,localhost:27021,localhost:27020
2015-03-09T12:41:22.570-0600 Failed: read tcp 127.0.0.1:27020: i/o
timeout
15322
The versions we are using are:
[root#MONGODB01-SRV]# mongo --version MongoDB shell version: 3.0.0
[root#SRV]$ mongoexport --version mongoexport version: 3.0.0 git
version: e35a2e87876251835fcb60f5eb0c29baca04bc5e
[root#SRV]$ mongos --version MongoS version 3.0.0 starting: pid=47359
port=27017 64-bit host=SRV (--help for usage) git version:
a841fd6394365954886924a35076691b4d149168 OpenSSL version: OpenSSL
1.0.1e-fips 11 Feb 2013 build sys info: Linux ip-10-181-61-91 2.6.32-220.el6.x86_64 #1 SMP Wed Nov 9 08:03:13 EST 2011 x86_64 BOOST_LIB_VERSION=1_49
Tried with a 2.6 mongoexport in another server against our mongod3.0 and mongos3.0 and works fine
This is an old question but I wanted to answer. Maybe this answer will help one of us. It might be caused by someone else trying to write to the collection you are writing. I had a smilar problem. After a long research I realised that a user with higher role was trying to write in the sametime and because his/her role is more important than mine ones request were done and mine are given IO exception.
Try closing the ports first: eg. killall -9 node

unable to connect to mongodb on localhost

I have installed MongoDB:
user#user-workshop:~$ sudo service mongodb restart
stop: Unknown instance:
mongodb start/running, process 7980
user#user-workshop:~$ mongo
MongoDB shell version: 2.0.4
connecting to: test
Mon Mar 3 21:43:33 Error: couldn't connect to server 127.0.0.1 shell/mongo.js:84
exception: connect failed
user#user-workshop:~$
but as you can see, I'm unable to connect to it. What can I do about it?
Try running these commands:
rm /data/db/mongod.lock
mongod --dbpath /data/db --repair
mongod --dbpath /data/db
For more details read: mongodb manual

Running mongoDB on ubuntu

I'm trying to run mongodb on my ubuntu :
calling sudo service mongodb start tells me that mongo is already running.
But when i run the command mongo or mongod i get the error :
terminate called after throwing an instance of 'std::runtime_error'
what(): locale::facet::_S_create_c_locale name not valid
Aborted (core dumped)
The weird thing is that I have a meteor application already using this mongoDB, and it is working correctly. My only problem is that i want to view/access the data from outside meteor and from a mongo client.
Thanks.
ps aux | grep mongo gives me :
mongodb 27835 1.0 1.4 204936 14644 ? Ssl 12:59 1:13 /usr/bin/mongod --config /etc/mongodb.conf
root 30838 0.0 0.0 4344 836 pts/0 S+ 14:53 0:00 grep --color=auto mongo
Looks like an old version of Boost was used to compile Mongo. Try executing
export LC_ALL=C
first before starting mongo shell

MongoDB server won't start

I just installed Arch Linux today. I'm setting up my development stack, and I'm stuck with mongodb.
I have followed this wiki when installing:
https://wiki.archlinux.org/index.php/MongoDB#Installing_MongoDB
When I try to get into mongo console, I get this:
jan#arch:~$ mongo
MongoDB shell version: 2.4.5
connecting to: test
Tue Jul 9 19:38:13.365 JavaScript execution failed: Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:L112
exception: connect failed
jan#arch:~$
What am I missing here?
EDIT: I figured out when I run mongod directly from terminal, it starts server fine. However the systemctl start mongodb doesn't start it.
Okay, I've figured it out by scanning journalctl output:
ul 09 19:49:33 arch mongod[1122]: all output going to: /var/log/mongodb/mongod.log Jul 09 19:49:33 arch mongod[1122]: can't open [/var/log/mongodb/mongod.log] for log file: errno:13 Permission denied Jul 09 19:49:33 arch mongod[1122]: Bad logpath value: "/var/log/mongodb/mongod.log"; terminating.
So I searched for user that might be utilized by mongodb:
jan#arch:~$ cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
...
mongodb:x:998:2::/var/lib/mongodb:/bin/bash
And chowned required folders:
jan#arch:~$ sudo chown -R mongodb:x /var/log/mongodb/
jan#arch:~$ sudo chown -R mongodb:x /var/lib/mongodb/
Started it again:
jan#arch:~$ sudo systemctl start mongodb
It works now.
jan#arch:~$ mongo
MongoDB shell version: 2.4.5
connecting to: test
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user
>