In my computer i'm running this command to make a backup of the information of some mongodb database.
mongodump -h <hostName>:<port> -d <databes> -u <user> -p <pass> -o direction/where/to/make Backup
But gave to me this error:
Failed: error connecting to db server: no reachable servers
I try to connect robomongo with the same user, pass, host and databes and it's work fines.
Version of mongo 3.0.1
Thanks.
This is basically what I figure from this link
The new mongo tool set doesn't work too well with Unix Domain Socket . The issue is still open.
If you're connecting via hostname try using the IP as the link suggests.
Hope this helps.
Related
I'm trying to connect to database restored from disk snapshot. I have new VM with ubuntu 18.04. I installed postgres, postgres-client and postgres-contrib from *.deb files. Then I mounted managed disk into machine with database and tried to connect - no success.
Postgres server running good, cluster ok, status ok, pg_isready ok. Until I change the data_directory in postgresql.conf from default to mounted - /snapshot_data_path/. After that my cluster is down and I cannot use psql in postgres (error ~ .s.PGSQL missing. File dissapearing from default directory).
chown -R to /snapshot_data_path - done, looks ok.
I think my database is running manualy when I use :
/usr/lib/postgresql/9.5/bin/postgres -d 3 -D /database/postgresql/9.5/main -c config_file=/etc/postgresql/9.5/main/postgresql.conf with that new path. EDIT: Error, I can connect but no data inside.
I try search over the internet for similar problems - no luck.
Is it possible to take database from 1 VM and connect it with another fresh VM? Or I must use pg_dump to achieve that?
Here the official documentation on this topic: https://www.postgresql.org/docs/9.0/backup-file.html
The database server must be shut down in order to get a usable backup.
Did you shutdown the server while the data snapshot was taken?
How can I connect to an Azure PostgreSQL database, from a remote machine?
Update 2. I can connect to the database from WSL/Ubuntu using sudo psql, but I can't using plain psql. So it's a permissions issue somewhere...
Update. I've discovered I can connect from the remote machine using PgAdmin4, but I can't connect using psql. So I want to know: how should I connect using psql?
Original question. I can connect to it using psql from a VM inside Azure, so I know the database is up and accepting connections.
But when I try to connect from my home machine, using exactly the same psql command, it fails:
psql --user=UUU --host=HHH DB
psql: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
More information...
On the Azure database's "Connection Security" blade, I have
added a firewall rule with start IP=0.0.0.0 and end IP=255.255.255.255
set "enforce SSL connection" to disabled
turned on "allow access to Azure services".
My home machine is running Windows+WSL, and I'm trying to connect from WSL / Ubuntu 18.04
using psql version 10.11. I run into the same problem whether I try to connect from home or from work, and I'm not blocking any outgoing ports (that I know of).
The database is running PostgreSQL 10.
When I connect (successfully) from an Azure VM, using psql 10.10, it looks like this:
psql --user=UUU --host=HHH DB
Password for user UUU:
psql (10.10 (Ubuntu 10.10-0ubuntu0.18.04.1))
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
Maybe your root user uses a different psql binary than your user. ( You can find out using
which psql and sudo which psql )
I Ran into the same connection issue. In my case, the base issue was a postgres major version mismatch.
I was connecting to an Azure Postgresql on version 11 with my local psql on version 12. Downgrading my local machine's Postgres version to 11.6 solved this for me.
Maybe your root user is using psql 10 and your default user is using psql 11 or 12. ( You can check this using psql -V and sudo psql -V )
I had the same issue. The error message sucks and is of 0 help.
You're probably using a different version of psql than your Azure DB. It needs to match whatever is installed in Azure.
So if you provisioned a version 10 DB in Azure, either you install version 10 for the pqsl tool or do a full Postgre version 10 install instead. The point is the major versions need to match between psql and the target database.
I want to install postgresql in my computer Linux mint sarah, and I finish procedure installation but when I type psql in my cmd postgres error, like this :
Error when install PostgreSQL
psql: 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"?
how I fixed that ??
thanks
The error states that the psql utility can't find the socket to connect to your database server.
Either you don't have the database service running in the background, or the socket is located elsewhere, or perhaps the pg_hba.conf needs to be fixed.
Step 1: Verify that the database is running
The command may vary depending on your operating system. But on most *ix systems the following would work, it will search for postgres among all running processes
ps -ef | grep postgres
On my system, mac osx, this spits out
501 408 1 0 2Jul15 ?? 0:21.63 /usr/local/opt/postgresql/bin/postgres -D /usr/local/var/postgres -r /usr/local/var/postgres/server.log
The last column shows the command used to start the server, and the options.
You can look at all the options available to start the postgres server using the following.
man postgres
From there, you'd see that the options -D and -r are respectively the datadir & the logfilename.
Step 2: If the postgres service is running
Use find to search for the location of the socket, which should be somewhere in the /tmp
sudo find /tmp/ -name .s.PGSQL.5432
If postgres is running and accepting socket connections, the above should tell you the location of the socket. On my machine, it turned out to be:
/tmp/.s.PGSQL.5432
Then, try connecting via psql using this file's location explicitly, eg.
psql -h /tmp/ dbname
Step 3: If the service is running but you don't see a socket
If you can't find the socket, but see that the service is running, Verify that the pg_hba.conf file allows local sockets.
Browse to the datadir and you should find the pg_hba.conf file.
By default, near the bottom of the file you should see the following lines:
# "local" is for Unix domain socket connections only
local all all trust
If you don't see it, you can modify the file, and restart the postgres service.
I'm trying to connect to mongolab via shell. I get a code from lab.
mongo ds023432.mlab.com:23432/somecol -u fakeusername -p fakepass123
Of course i created a db user on mongolab site. However When i call the above command I get the following error:
MongoDB shell version: 3.2.6 Enter password:
connecting to: ds023432.mlab.com:23432/somecol
2016-05-16T17:55:04.290+0200 E - [main] file [fakepass123] doesn't exist
failed to load: fakepass123
So far I am able to connect only via driver. And I am using Arch linux
What am I missing?
I am using Arch Linux as well with mongo client version 3.2.6 and have the same issue.
I would assume it is a client - server incompatibility (since my java application can connect with its driver)
To solve the issue I've installed robomongo via
yaourt -S robomongo-bin --noconfirm
Notes:
Follow these steps to get yaourt if you don't already have it
I am not affiliated with robomongo - it's just a solution for the problem I was facing
I am running an Amazon EC2 CentOS 6.6 server instance with pre-installed PostgreSQL 8.4.20 server which I want to upgrade to 9.4.1 using pg_upgrade via SSH.
What I've done so far: Downloaded and installed PostgreSQL 9.4.1 with yum, configured it. Configured the postgres user to have the same password on the UNIX server and for both database instances. Both database instances are functioning correctly - old one on port 5432, new on 5433.
What I am trying to do:
su - postgres
/usr/pgsql-9.4/bin/pg_upgrade
-b /usr/bin/
-B /usr/pgsql-9.4/bin/
-d /var/lib/pgsql/data/
-D /var/lib/pgsql/9.4/data/
Here is my issue with pg_hba.conf. Using
TYPE DATABASE USER METHOD
local all all trust
or
TYPE DATABASE USER METHOD
local all all peer
I can't start the old server, getting:
Performing Consistency Checks
-----------------------------
Checking cluster versions ok
connection to database failed: fe_sendauth: no password supplied
Failure, exiting
Using the default setting
TYPE DATABASE USER METHOD
local all all ident
is the only method that allows me to start the server, but then I get the following error:
Performing Consistency Checks
-----------------------------
Checking cluster versions ok
*failure*
Consult the last few lines of "pg_upgrade_server.log" for
the probable cause of the failure.
connection to database failed: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.50432"?
could not connect to old postmaster started with the command:
"/usr/bin/pg_ctl" -w -l "pg_upgrade_server.log" -D "/var/lib/pgsql/data/" -o "-p 50432 -c autovacuum=off -c autovacuum_freeze_max_age=2000000000 -c listen_addresses='' -c unix_socket_permissions=0700" start
Failure, exiting
I have been reading more than 10 hours straight everything related, before I posted this, but can't seem to find the solution. Will be very grateful if you can give me any hints.