Cant access mongodb shell and mongo errored - node.js

I installed mongo following this tutorial with the exception that I ran the service with pm2 because I can actually tell what I am doing with pm2.
I then have been trying to follow this tutorial however I cant even access the shell.
I have tried the following commands and none of them work:
./bin/mongo causes a file not found error whether it is in my project file or in the /var/lib/mongodb folder where the db is supposedly "installed"
Additionally
mongo localhost:27017 (or just mongo)
causes
MongoDB shell version: 3.2.19
connecting to: test
2018-02-12T20:15:59.009+0000 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused
2018-02-12T20:15:59.009+0000 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect#src/mongo/shell/mongo.js:229:14
#(connect):1:6
exception: connect failed
My log file (from /var/log/mongodb/mongod.log) can be found here. I do have some confusion about it:
Why did it shut down
Why is the host=GraphicsApplications? That is an old folder that I have since deleted on my machine. It was my first attempt at getting this going but back then I was hosting my DB with mlab. The folder/name it lists no longer exists. For some reason though the start of every line in terminal says root#GraphicsApplications. Not sure where that name came from... perhaps I named the box that?
Ultimately I dont know exactly how that tutorial had me install mongodb. Sure I installed the packages and everything but I dont feel like I ever really created anything if that makes sense.
It is worth noting that pm2 does show the status of the mongod app as "errored" currently but I am not sure why or for how long it stayed up.
I am just trying to get my database running on my own Linux box rather than mlab. I had everything working with mlab but now want to be hosting my db on localhost.

Looking in the logs it says that your hostname is host=GraphicsApplications
But in your actual hosts file you have 127.0.1.1 GraphicsApplications GraphicsApplications
Edit this line in your hosts file to be just 127.0.1.1 GraphicsApplications
Then save the file and rerun mongod. Hopefully that should do it.

Regarding file not found:
Try running from the cmd line:
which mongo
If that doesn’t show any result then the mongo binariesarn’t in your PATH env variable, in which case try
find / -name “mongo*”
That should then show where your mongo binaries have been installed.
If you know where the binaries are installed then running:
./bin/mongo
Presumes you’re in the mongo home dir, so you would need to run;
/var/lib/mongodb/bin/mongo
Regarding connection refused
could be an iptables rule, try disabling it and starting mongo
sudo ufw disable
hostfile
Comment out this
127.0.1.1 GraphicsApplications
And change/add this
127.0.0.1 localhost localhost.localdomain
As per : https://jira.mongodb.org/plugins/servlet/mobile#issue/SERVER-20952

Related

Database 'neo4j' is unavailable. Cannot reset neo4j database

I have my community 4.1.1 neo4j service installed on the ubuntu commandline running on my windows machine. I have been using neo4j steadily for a month or two now, just recently it has prevented me from accessing the neo4j database, it will say this in neo4j browser:
Database 'neo4j' is unavailable. Run :sysinfo for more info.
I have tried uninstalling neo4j and reinstalling but that has not worked either. I tried playing around with the default listen address previously, but now with the reinstall all config data is back to normal. Running ./neo4j-community-4.1.1/bin/cypher-shell under bin does not work. It says:
Unable to establish connection in 3000ms
If I run ./neo4j-community-4.1.1/bin/cypher-shell -a 192.168.0.19 it says:
Database 'neo4j' is unavailable
When I run ./neo4j-community-4.1.1/bin/neo4j-admin check-consistency --database=neo4j it also states:
.2020-08-18 22:12:16.868+0000 WARN [o.n.c.ConsistencyCheckService] Index was dirty on startup which means it was not shutdown correctly and need to be cleaned up with a successful recovery. Index file: /home/thomp105/neo4j-community-4.1.1/data/databases/neo4j/neostore.relationshipgroupstore.db.id.
I would love to reset everything from scratch but I am unsure how
At this point I cannot even access the browser at localhost:7474. It hangs indefinitely trying to load.
I am truly stumped. Anyone have any advice on how I navigate this issue?
It's not easy to guess the issue without seeing your system, but may I ask if you can try to delete your default database, i.e. neo4j physically from the disk (e.g. rm -rf /home/thomp105/neo4j-community-4.1.1/data/databases/neo4j/), and then try to create another database with different name instead (open neo4j.conf, search for dbms.active_database, which point out on default database, and change it to some other name)?
I had this problem running on a linux server. The server was up but got this error on any query: Database 'neo4j' is unavailable. To troubleshoot I ran sudo neo4j console and the problem went away. When I ran the console as user ne04j the problem came back.
$ /usr/share/neo4j/bin/neo4j console
Directories in use:
home: /var/lib/neo4j
config: /etc/neo4j
logs: /var/log/neo4j
plugins: /var/lib/neo4j/plugins
import: /var/lib/neo4j/import
data: /var/lib/neo4j/data
certificates: /var/lib/neo4j/certificates
run: /var/run/neo4j
So I tried: sudo chown -R neo4j:neo4j /var/lib/neo4j/data and the problem went away. Apparently when I'd done a restore of the database I'd run the neo4j server as root and when the system runs neo4j it does it as the user neo4j so couldn't read any of its data. It seems that an error like this would warrant an easy to parse error message but verbosity is not the neo4j way.

I am getting an error while trying to connect with node using geth tool

I am having an error while trying to attach to the quorum node, using the following command :--
geth attach --datadir new-node-1/geth.ipc
then I get this error
Unable to attach to remote geth: dial unix new-node-1/geth.ipc: connect: no such file or
directory
I tried to locate path of geth.ipc but nothing was there. I guess the file is not being created.
any suggestions guys..
You should be running the command like this (without --datadir):
geth attach new-node-1/geth.ipc
If that still doesn't work then make sure you have the correct path for the ipc file. Is new-node-1 definitely the same path that was specified to the quorum node when it was started (i.e. with with --datadir new-node-1).
If the path is correct but geth.ipc file doesn't exist then the node hasn't managed to start up. Check the log file to see if there were any errors.
Try out below:
geth attach http://127.0.0.1:8545
It worked for me

Errors setting up Ruby development environment: nodejs not found, could not connect to server

I'm a new developer-in-training attempting to set up my Ruby development environment on a Windows machine using Ubuntu. I'm following the instructions here:
https://gorails.com/setup/windows/10
I've made it to the last few steps of the process, which is where I'm started to get errors:
# Navigate to the C: drive on Windows. Do this every time you open the Linux console.
cd /mnt/c
# Create a code directory at C:\code for your Rails apps to live (You only need to do this once)
mkdir -p code
#### If you want to use Postgres
# Note that this will expect a postgres user with the same username
# as your app, you may need to edit config/database.yml to match the
# user you created earlier
rails new myapp -d postgresql
#### or if you want to use SQLite (not recommended)
# rails new myapp
#### Or if you want to use MySQL
# rails new myapp -d mysql
# Then, move into the application directory
cd myapp
# If you setup MySQL or Postgres with a username/password, modify the
# config/database.yml file to contain the username/password that you specified
# Create the database
rake db:create
rails server
On the step to set up Postgres:
rails new myapp -d postgresql
I receive this error about setting up nodejs:
/home/event/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/app_loader.rb:53: warning: Insecure world writable dir /home/event/.rbenv/versions/2.6.5 in PATH, mode 040777
sh: 1: node: not found
sh: 1: nodejs: not found
Node.js not installed. Please download and install Node.js https://nodejs.org/en/download/
Even after I go to the URL provided and install NodeJS, that error still shows up when I attempt to repeat the process. Is this just a matter of it not existing in the correct path and I need to relocate it?
Also, I've attempted to proceed with the other steps despite that error. When I enter this command, the second last one in the article referenced above:
rake db:create
I receive this error:
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Couldn't create 'myapp_development' database. Please check your configuration.
rake aborted!
ActiveRecord::NoDatabaseError: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Caused by:
PG::ConnectionBad: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Tasks: TOP => db:create
(See full trace by running task with --trace)
I've searched around about this with little success, and attempted to decipher what the error messages mean; but at my current level of knowledge it just seems beyond me. Appreciate any insight anyone has to share on this!

'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)' in debian6

Well, recently I tried to install mysql_cluster on debian6. At first it works well, but when I try to install mysql_cluster multiply, an error occurs saying, that I cannot login as root anymore. I was trying to modify the pwd of root with the command:
/usr/local/mysql/bin/mysqladmin -u root password '654321'
But it turned out with wrong info as:
/usr/local/mysql/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (2)'
I tried everything I can to solve this problem but failed. I was attemped to run the command:
find / -name *.sock -type s
but I just cannot find the file mysqld.socks anywhere. As reference I had tried every method from this article.
All the methods failed, that I've tried so far.

ec2 instance access failed due to change in owner

When I login to the server, but 22 is already open for all upcoming connections still getting error as below,
ssh Server_Name
ssh: connect to host Server-IP port 22: Connection refused
I misleadingly change the the owner of the system and change root privileges with jenkins. So, right now I could not able to log into the system and port 22 is closed it's throwing the error.
I understood the error issue occurred because of wrong fstab file and wrong editing to sshd conf(Not sure). And, the directory of authorized_keys been messed up. I tried this solution but not working
I tried accessing via public DNS, via private IP address, detaching and re-attaching volumes driver after attaching it to other instance(but, once I attached to it, I could not able to ssh into that instance), etc. but no luck. Also, tried login with Jenkins user still not working. But, jenkins is still running fine on the server and I could access the Jenkins Dashboard and run the shell onto my instance. But, if I try any sudo command, it shows sudo: effective uid is not 0, is sudo installed setuid root?
Build step 'Execute shell' marked build as failure
Questions
Is there any way to get back my instance port 22 running fine as before ?
Is there a way I can run the sudo commands using Jenkins user by creating the job(By running the shell) inside Jenkins ?
I could trace on the IP which clearly shows port 22 is closed and I could not do anything because of it. Thanks in advance.

Resources