Mongodb on Terminal keeps getting stuck - macos

I have a Macbook Pro with El Capitan. I installed mongodb on my terminal with macports, which is similar to homebrew. I've followed all of the instructions and I've made sure to change the user permissions to /data/db. Does anyone have any idea of what's wrong with my mongodb installation?
Whenever I try to run "mongod", it keeps pausing at "waiting for connections on port 27017". This is shown in Screenshot 1. Then I hit CTRL-C to exit, and I get more error messages shown in Screenshot 2. Also the "mongo" command does not work either.
Here is the error report shown when entering "mongo".
MongoDB shell version: 3.0.8
connecting to: test
2016-01-11T19:08:41.888-0600 W NETWORK Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused
2016-01-11T19:08:41.890-0600 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
Here is a link to my google drive with a photos of the error report for "mongod".
Screenshot 1 - https://drive.google.com/file/d/0Bwl_BDx-HIfcYnBJRUJfbzFvSm8/view?usp=sharing
Screenshot 2 - https://drive.google.com/file/d/0Bwl_BDx-HIfcdkVkUWJzeENuelU/view?usp=sharing

Whenever I try to run "mongod", it keeps pausing at "waiting for connections on port 27017".
This is exactly what it is supposed to do. Unless you indicate otherwise via a command switch (such as "--fork"), running "mongod" starts up the mongo server process within the current shell and blocks that shell until the process is terminated (via CTRL+C).
If you want to connect to the running mongo server process via the mongo shell, you'll need to open a second terminal to do so. From there, run "mongo" and it should connect to the server running in the first terminal shell.
Re-cap:
In terminal #1, run "mongod". When it says "waiting for connections...", it's ready to accept client connections. Do not stop the process via CTRL+C; do not close that terminal.
In terminal #2, run "mongo". It should connect to the server successfully.

This "connection refused" message is significant:
2016-01-11T19:08:41.888-0600 W NETWORK Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused
You need to work with the packet filter to flush all the rules. See this article near the bottom in order to open port 27017 which is what mongod uses:
http://www.macworld.co.uk/how-to/mac-software/how-open-specific-ports-in-os-x-1010-firewall-3616405/
This is quite direct:
https://gauravsohoni.wordpress.com/2015/04/14/mac-osx-open-port/
This may be less helpful but still worth glancing through:
https://support.apple.com/en-us/HT201642

Related

How to fix VS Code error with Remote-SSH: "the terminal process failed to launch: A native exception occurred during launch (forkpty(3) failed.)."?

I've installed and used the Remote-SSH extension in VS Code to access a Linux staging environment and work remotely.
The setup and connection works for one user, however is not allowing me to connect as a different user (on the same server).
Immediately after connecting, an error pops up saying the terminal process failed to launch: A native exception occurred during launch (forkpty(3) failed.). and the terminal would fail to open. If I attempt to manually open the terminal, it will fail with the same error.
Here is an example of how my Remote-SSH config file looks:
Host configfile1
HostName host.website.com
User username1
IdentifyFile "[key file path]"
Host configfile2
HostName host.website.com
User username2
IdentifyFile "[key file path]"
I could connect just fine and open remote terminal with configfile1, however would run into the aforementioned error when attempting to connect with configfile2.
I have tried various solutions mentioned in this GitHub issues thread, but to no avail: https://github.com/microsoft/vscode-remote-release/issues/4233
Does anybody have a solution for this?
I don't know the underlying causes for this, but this error pops up when using jailed shell settings.
Try changing the user's SSH shell settings to normal shell, and you may be able to connect without an issue.
This may not be ideal for all scenarios or security considerations, however, but it will allow Remote-SSH to connect and spawn the terminal.

Cannot create Solr core on localhost - ERROR: Connection reset

I'm running Solr 8.2 on OSX 10.13.5. The Solr dashboard is accessible in my browser (via http://localhost:8983), yet when I run the terminal command "bin/solr create -c test" to create a core, after a few moments I end up with:
ERROR: Connection reset
I've tried booting Solr as sudo, and the result is the same. I'm at a bit of a loss here. How can I resolve this connection error and create a core? Thanks!
I figured this out. It turns out that port 8983 was still in TIME_WAIT mode. I obtained the port's PID with:
sudo lsof -i :8983
Then closed the port with:
kill PID
Where 'PID' is the numerical PID of the port. With the port now being free of traffic, the core creation worked just fine. I'm leaving this posted in case any other Solr beginners hit this snag!

Screen freezes on connecting to mongodb in Windows 10

I was trying to set up mongo server on Windows 10.
It looked like everything alright and the service was listening on 27017.
However on another command prompt, mongo failed to connect and the screen just froze as follow
I've checked the firewall rule, port 27017 is open. And ping 127.0.0.1 is responding.
Any idea why the connection would get stuck?
Try running mongo.exe with verbose mode
c:\mongodb\bin>mongo.exe --verbose
This will help you diagnose this further.
I have just got this situation.
Solution: Edit mongo configuration
mongodb.conf
linux: sudo nano /etc/mongodb.conf
and disable auth=true. Then restart mongo server service.
linux: sudo service mongodb restart
Incorrect config authentication steps lead to this hanging in mongo shell.
After that, config following this link: https://medium.com/#matteocontrini/how-to-setup-auth-in-mongodb-3-0-properly-86b60aeef7e8
Then re-enable auth=true

Starting Neo4j failed: Address localhost:7474 is already in use, cannot bind to it on Mac OSX

I'm trying to install a neo4j server on my localhost (mac osx - El-capitan) and i'm getting this error -
Starting Neo4j failed: Address localhost:7474 is already in use,
cannot bind to it.
I tried to stop the port from running and then install it throw the neo4j install app, but it still give this error
When i try to start the neo4j server it gives me this error :
./usr/local/bin/neo4j: line 229: [: too many arguments
Try to kill your java processes :
sudo killall -9 java
Then restart your neo4j server :
./bin/neo4j restart
Same problem using Win 10, I had to turn off https-support
in neo4j-server.properties, i.e.
\# Turn https-support on/off
org.neo4j.server.webserver.https.enabled=false
You don’t need to install anything. Just download the linux tar.gz package, uncompress it and use the terminal to run the command ‘./bin/neo4j console’ to run it in console mode. You can start it in background too but based on your question, it sounds like this is just a dev machine.

How to handle postgresql connection problems

I have run into a number of cases where the postgresql connection is in a bad state. OK, I'll make this complicated by having a master with a couple of slave servers... And to complicate matters even more, the master is on OS X with postgresql installed via homebrew
So things like
pg_basebackup: could not connect to server: could not connect to server: Connection refused
Is the server running on host "XX.XX.XX.XX" and accepting
TCP/IP connections on port 5432?
crop up. The master postgres/server.log was showing
FATAL: pre-existing shared memory block (key xx, ID yyy) is still in use.
this notwithstanding running
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
to start and stop the service. [head scratch] Got we worrying... So I run
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
I query the master's application and can edit data! WAIT postgresql was supposed to be unloaded!
So launctl is NOT working as expected... This explains why some synching up has fallen by the wayside.
Question 1: How can we ensure that postgres is really stopped on OS X because although it may be risky, the only alternative appears to be to kill the postmaster.pid
Then things went probably haywire in the flow... master's log states:
LOG: could not send data to client: Broken pipe
and effectively one of the VPS is complaining
$ service postgresql stop
Error: pid file is invalid, please manually kill the stale server process.
Question 2: how can those be killed (Ubuntu 14.04) without harming the database and the WAL process that should be updating the slave? (or is there a more effective/saner way of handling master-slave replication?)

Resources