I'm on OS/X Macbook and recently installed mongodb to try my hands on it. I installed it using shell commands. I scrapped some data and passed into it and when I tried looking for it, the connection was getting failed. On googling the root cause, I found there was some mongodb.lock file, and I removed it using bash command.
Now, I'm trying to restart using the following command
sudo service mongodb restart
However, it is saying
sudo: service: command not found
in addition, if I start mongodb by navigating to folder and then using the command ./bin/mongo, it displays the following error:
MongoDB shell version: 3.0.7
connecting to: test
2015-11-08T14:47:56.965+0800 W NETWORK Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused
2015-11-08T14:47:56.967+0800 E QUERY Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed
at connect (src/mongo/shell/mongo.js:179:14)
at (connect):1:6 at src/mongo/shell/mongo.js:179
exception: connect failed
can someone please help how to resolve it.
AFAIK there is no service command on Mac. And ./bin/mongo runs a shell client, you need to run .bin/mongod with relevant --dbpath argument. You can find more info here
Like Yuri wrote, there is no service command on OS X. You need to manage MongoDB yourself by starting it with the mongod command.
An Alternative is to install MongoDB via MacPorts.
After you successfully installed MacPorts, you simply install MongoDB with
sudo port install mongodb
You can start MongoDB quite easily then with
sudo port load mongodb
and stop it with
sudo port unload mongodb
mongo is the client. You haven't had the server running, so it is only natural that you can not connect to the server.
Some side note: OS X is not very close to Linux. OS X is based on a flavor of BSD-UNIX, which in turn is based on Research UNIX. Linux started as a free implementation of Minix, based on GNU utilities. So assuming that you'd have Linux tools available on the OS X command line is pretty dangerous. Often, the tools (if present) even share the name, but are different implementations of the same functionality with some differences in usage. So, get it in your head: With OS X, you do not use the hipster version of Linux – you use BSD on steroids. Hence, I will remove the "linux" tag and add the OS X tag.
Related
Hello there guys i have been trying to use hcitool on mac os terminal but whenever i type hcitool scan the following error is appeared -bash: hcitool: command not found i have tried pip install hci and pip install hcitool but the following error is shown
ERROR: Could not find a version that satisfies the requirement gatttool (from versions: none)
ERROR: No matching distribution found for gatttool
please help me with this
Commands such as hcitool, gatttool, hciconfig, etc. are part of the BlueZ package which works on Linux only. MacOS on the other hand is UNIX-core and therefore the commands will not run on a MacOS operating system. There have been hacks before to get some sort of functionality on MacOS OSs but the solution is always incomplete.
Your next best bet will be to use a Virtual Machine running a Linux guest (e.g. Ubuntu) and then use the BlueZ commands from within that VM OS.
I hope this helps.
Get yourself a Docker container up and running. You can write scripts that you keep in a shared volume between the host and the container (meaning you don't have to log into the container). You can then execute those scripts from your OSX terminal, to run in the container.
HTH
I installed mongodb on mac using brew and official guides. mongodb seemed to installed correctly. when i go to terminal and type sudo mongod it produces bunch of logs and final that db is listening on port 27017 i can open tab in browser localhost:27017 which doesnt seem to do anything but at least i know it works. mongodb is taking over terminal and i can type commands but i dont get any response for any command. i tried:
show dbs
use testdb
and so on. doesnt matter what i type it never returns any response. what did i do wrong?
OSX 10.9.5
db version 3.2.8
The mongod command you entered refers to the mongo daemon process which runs in the background.
Try typing mongo in your terminal instead of mongod and you should see the following input with the '>' prompt:
MongoDB shell version x.x.x
connecting to: xxx
Then you can type show dbs and see your databases.
I've installed rabbitmq on Mac OS X via homebrew, just a simple command:
$ brew install rabbitmq
but, when I start the server via rabbitmq-server, it occurs:
ERROR: distribution port 25672 in use on localhost (by non-Erlang process?)
I want to find some process that uses port 25672, but I can't find that really strange
anyone knows the reason, thx a lot :)
Use sudo lsof -i :25672 to find the process. sudo may or may not be needed depending on user permissions.
I have this error while trying to launch the command ./runInstaller
Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
From Oracle help docs:
sudo yum install xorg-x11-utils -y
worked for me.
If you are executing this via Putty, then I suggest you have a look at Xming, this allows you to have a Putty remote ssh session, and forward your display to you Windows machine...
If you're executing this from a Linux server without a gui, you will either need to connect remotely with a pc with a GUI installed (Gnome, KDE, etc) or you'll need to install the Gui directly on the server.
Check if it's not already installed by using the command on the terminal
$ startx
Error is reproducible thus:
$ export DISPLAY=:0.0
$ ./runInstaller
ERROR: Unable to verify the graphical display setup. This application requires X display. Make sure that xdpyinfo exist under PATH variable.
Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
OP's X server was Hummingbird Exceed. Xming will work as well.
The actual solution depends on:
whether you are su'd to oracle from a different login account.
whether you are using X11 forwarding.
the actual port used by X11 forwarding, which could be 6010 or a different port.
If you logged in and then su'd to oracle, then copy ~/.Xauthority to the oracle account.
If you are using X11 forwarding and the forwarding port is 6010, then DISPLAY=localhost:10.0 is correct.
If you are not using X11 forwarding, and if port 6000 on your PC is reachable from the oracle server, then export DISPLAY=your.pc.ip.address:0.0 is correct.
Install xterm and use xterm to test X windows.
Be sure to install xdpyinfo.
For more details, please refer to my article X windows for Oracle DBAs
Running OSX 10.9.2, I just ran brew upgrade mongo which upgraded my mongo to version 2.6
As per the instructions I've run
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
But now when I run mongo it says
MongoDB shell version: 2.6.0
connecting to: test
2014-05-05T10:07:22.769+1000 warning: Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused
2014-05-05T10:07:22.770+1000 Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:146
exception: connect failed
Things I've tried:
I've seen this covered on other SX questions and people have suggested creating a /data/db folder but this wasn't needed previously and I don't want to lose the data from my old instance of mongo. Regardless, I tried it, and chowned it to allow read/write from my user account, but that made no difference. (FYI my data lives in /usr/local/var/mongodb/ which is typical I believe for OSX.)
A lot of the other questions also assume Linux rather than Mac, or they wade off into PHP land which is not relevant to me.
I've also tried rebooting my Mac.
I fixed it by forcing home-brew to restart it.
brew services restart mongodb
and voila
$ mongo
MongoDB shell version: 2.6.0
connecting to: test
>
now works a treat.