Postgresql Difficulties on open a backup - javascript

I have an app with Node.JS where I have Sequelize to manage my database created in Postegresql on my vps.
I'm trying to backup the database with the command:
pg_dump dbname -U user -h 127.0.0.1 -f > db.sql
Then it asks the password that, in my case, I have set on Sequelize on the app and it creates a backup.
But when I try to open it on my pc, for exemple in DB Browser, it asks the key where I insert the password for the database, the user password for psql (which is the same) and the vps password but nothing happens. It does not open the database. What am I doing wrong?
In order to create user and database on psql I used this guide: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-16-04
Thank you

Related

psql database setup and connection on fedora linux

I've recently started work on a project that requires a psql database. I've followed numerous guides on setting up psql database on fedora, and have got my db up and running. I am able to connect into it using sudo -u postgres psql the project I am working on has a init-db bash scrip that is used to set up all the relation and tables for the database, which I am able to query once I am in the psql view on my terminal.
My issue is that no other application or software is able to connect to the database. At first I though it was a issue with the code left by previous developers but with further investigation I am unable to connect to it even using Jetbrain 'Database Tools and SQL' plug in.
I Have Tried a few thing to fix this (listed bellow) but none have worked
edited the postgresql.conf file to contain linsten_addresses = '*'
editted the pg_hba.conf file to have host all all 0.0.0.0/0
tried connecting to the database via JetBrains 'Database Tools and SQL' using localhost, my public ip, and my private ip
( yes I am sure i have to correct login details )
None of the above worked. I have tinkered with this for 4 hours now and have not gotten it to connect, so any suggestions would be much appreciated. If there is anything that i have missed out please ask and I will update the post with the needed information

How can I set database authentication in Mongodb - Is SSH Pipes better for MongoDB?

I have installed MongoDB in my computer. I did't define any password and username for the installation. I can see everything with Robo 3T.
Now I want to protect my database.
I have tried to set authentication for the database. I followed https://docs.mongodb.com/manual/tutorial/enable-authentication/ . It did not work.
I still can reach mongodb with robo 3t and see all information.
I have also tried to start mongodb with --auth parameter. I have define a configuration file looks like
And for starting mongodb
mongod -f C:\mongodb\conf\mongodb.conf
Mongodb has been started but, it did not ask any pass. And I can save simple data with Postman without authentication.
What I want to do:
Protect my database against Robo 3t. :))
I dont want to save any data without auth.
Building Nodejs connection string that include pass like
mysql://root:password#localhost:port/dbName
Here is my Nodejs index.js code
this is my model.
PS: I am very new in Nodejs and Mongodb.
EDIT: inside conf file

Deployed database has no connections

I have deployed an application to heroku: https://stark-citadel-91743.herokuapp.com/
The app initially loads properly until you click a button that requires the database. Then it crashes.
Everything works in local development environment. I believe I have properly set up all connection settings for production in heroku dashboard's config variables (database url, database name, username, password). But in production it doesn't work.
Two evidences that it's not set up right:
1) When I log into the ClearDB MySQL plugin (in my heroku dashboard) under 'current connections' it says, 'No connections are currently established to the database.'
2) When I use postman to hit a custom endpoint I made just for testing a request to the database, I get: "Error adding color: Error: connect ECONNREFUSED 127.0.0.1:3306" <-- that 127.0.0.1 seems enlightening. Why would a deployed db have a connection on that address?
Any clues? Thank you!
If your database is also set up at keroku host:
check the db setting(username, pw, port,etc.)
If you actually need to connect back to your own database(which is hosted by you or other third party);
You should find out the setting and replace with 127.0.0.1:3306, which is only work for local env
Update:
127.0.0.1 is localhost, which is your machine. Your test case is working because your server and your database are hosting on the same machine(which both have same ip). However, when your code are deployed to heroku, your heroku server cannot find a database hosted on same machine. This is why your are having this problem

Setup Auth0 with local database ran in a docker container

I've got a web-page at localhost:8080 with a login button that triggers a call to the auth0 handler. It works fine as long as it interacts with their database. Now i'm trying to set-up my own database, but can't seem to fill correctly the login script.
My database runs through a docker container via the command-line:
docker run —ip="172.0.0.3" —net="unihub-network" -p 13306:3306 -e MYSQL_ROOT_PASSWORD=mypasswd -d unihub-mysql
Using their template, I wrote:
function login(email, password, callback) {
var connection = mysql({
host: 'my-ip-address',
user: 'my-user',
password: 'my-psw',
database: 'UNIHUB_DB' //supposed to be the name of my db
});
Which obviously doesn't work. I can access my DB through software like SQuirreL at jdbc:mysql://localhost:13306/UNIHUB_DB, but it looks like i would need to access it through a URL to put in the login script for auth0.
Any thought on this ?

Save documents from OpenShift Mongodb

I have a scalable app in OpenShift with MongoDb2.2 ad NodeJs0.10,
Since i can't use Cartridge rockmongo-1.1 because it cannot be embedded in scalable app,
How can i get my db'documents and do a Backup and Restore with ssh ?
Make sure you use the RHC command line tools.
You have two ways to get to your data:
1) You can ssh into your gear (as a shortcut you can do rhc ssh {app-name}). Then you can do the dump and restore at the console. Remember, you only have write permissions to the ~/app-root/data and /tmp directory so make sure to put your output there. Then you can scp your files back and forth.
2) You can you*rhc port forward* to port forward you MongoDB terminal and commands to you local machine. You will still need the MongoDB username and password we assigned to your instance on creation.

Categories

Resources