Heroku download postgres DB - capture works, curl is unknown - python

I am doing this task the first time. I have found good documentation on how to download an existing postgres DB to local but none of the informations seem to work for me.
I need to download an existing postgres DB to local. I do this to check the entries and to have a backup because I need to work on the DB.
I have posgresql installed localy and I want to copy the heroku DB into my local DB which is named postgres. The local server has a username postgres and a password.
I have only one DB and one APP on heroku.
I tried 2 solutions.
PG:PULL
heroku pg:pull DATABASE_URL postgres
This gave me:
DL is deprecated, please use Fiddle
! The command "createdb" is written either false or
! could not be found
!
! Unable to create new local database. Ensure your local Postgres is working and try again.
So I tried with password ans username:
PGUSER=postgres PGPASSWORD=mypw heroku pg:pull DATABASE_URL postgres
This gave me:
The command "PGUSER" is written either false or could not be found
PG:BACKUPS
heroku pg:backups capture
This worked well:
Use Ctrl-C at any time to stop monitoring progress; the backup
will continue running. Use heroku pg:backups info to check progress.
Stop a running backup with heroku pg:backups cancel.
DATABASE ---backup---> b003
Backup completed
Then I used curl:
curl -o latest.dump `heroku pg:packups public-url`
Which gave me:
The command "curl" is written either false or could not be found
It seems nobody had such a problem, I dont know what I am missing. I red the whole heroku documentation and there is no such case.
EDIT
I connected to my DB via PgAdmin4 but also here I am getting the same type of error when trying to restore a DB dump file.
The PgAdmin4 log gives me:
The command "pg_restore.exe" is written either false or could not be found
I also tried to add postgresql to global path variable, but it does not seem to help:
;C:\Programme\PostgreSQL\9.6\bin\pg_restore.exe
and I tried:
;C:\Programme\PostgreSQL\9.6\bin

Related

Unable to connect external postgresql database to Heroku

I'm trying to deploy a Dash app onto Heroku that is connected to an external PostgreSQL database. I've tried to use the heroku-postgres addon but I don't quite understand how that works, and I think it also won't have enough space for the data I need. I currently have an external PostgreSQL database I'm using and I've gone through the steps to attach/detach/config:add the new DATABASE_URL.
Every time I deploy I run into this error (more of the error code in the image):
Error fetching data from PostgreSQL table 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"?
I've set up my Config Vars such that the DATABASE_URL is postgres://user:password#host_ip:port/database_name
and in my code I'm connecting to the database via a .env file that looks like this:
# Development settings
user="user"
password="password"
host="ip"
database="postgres"
Also, I saw somewhere that this might be useful to check ps -ef | grep postgres and the output of that shows the correct database connection, but the output of pg_lsclusters shows nothing.
Please let me know if I can provide any more info. Thank you in advance!

Peer authentication failed for user "odoo"

I'm on Odoo 9, I have an issue when lunching odoo server $odoo.py -r odoo -w password, the localhost:8069 doesn't load and I get an error on terminal "Peer authentication failed for user "odoo"".
I already created a user "odoo" on postgres.
When lunching $odoo.py I can load the odoo page on browser but I can't create database (as default user).
It was working and i already created database but when I logged out I couldn't connect to my database account anymore.
Any ideas ?
You need to change your pg_hba.conf configuration.
This error means that you are using peer authentication, so you need to change it for md5 or something that suits you.
You can find more information here:
http://www.postgresql.org/docs/9.4/static/auth-pg-hba-conf.html
If you are connecting locally you will need to change the following entrance from
local all all peer
to something like this :
local all all md5
This helped me.
sudo nano /etc/postgresql/9.3/main/pg_hba.conf
then add
local all odoo trust
then restart postgres
sudo service postgresql restart
I know this is an old post but upper results are not working for me.Well this will definitely work.
You can see this django link.
Apparently there are multiple ways for authentication with postgresql.
So,if your Postgresql user is different from your linux user then one easy way is to add --db_host to localhost which is "127.0.0.1":
.odoo-bin -r "pg_user" -w 'pg_pass' --db_host "127.0.0.1"
If you feel any problem in this,Tell me i will elaburate further

Odoo/OpenERP "Unable to login on database odoo"

I am trying to install Odoo on a hosted machine. First, I created a new Postgres user "odoo" with database "odoo". Then, I cloned the GIT repositry "https://github.com/odoo/odoo". After that I ran:
./openerp-server -s -c server.cfg
This created a configuration file named "server.cfg". I edited the configuration by changing the database parameters. After that, I ran
./openerp-server -c server.cfg
This loaded all the necessary addons and the server started running.
Whenever I open the browser, I keep getting to the following url:
http://erp.example.com/web/database/selector?error=Unable%20to%20login%20on%20database%20odoo
I thought maybe this is a database error. So, I checked the database and all the tables are created in the database.
The database user and password created all the tables but for some reason I can't login to the database.
Has anyone had an issue like this? If yes, how did you fix it?
Maybe you don't set a password for your database yet, if it's the case: do it with this query :
ALTER USER odoo WITH ENCRYPTED PASSWORD '<type your password here>';
or : run odoo in the debug mode for see some details about the problem :
try this command
python openerp-server -r odoo -w '<the password>' --db_port=<5432 by default> --debug

Django not connecting to RDS Mysql

I am trying to deploy my django app on EC2 and am using RDS(Mysql) as the backend.
However when I try to run gunicorn with this, the server does not respond, and the if I run python manage.py dbshell I get the error:
CommandError: You appear not to have the 'mysql' program installed or on your path.
It seems to be trying to connect to a local server of mysql when I have clearly changed the host setting the Database dict to my RDS deployment
Things I have done for solving this and trouble shooting:
1. I have changed the database settings so that they point to the RDS database.
Both the EC2 and the RDS instance are in the same zone of AWS(read this might have been the issue)
Permission could have been a problem, but I checked by trying to login from my local machine, and I was able to access the mysql commandline on my server.
Checked the database settings which django is picking up at runtime,they are correct.
Install Mysql-python, it would not install without a local installation of Mysql, so googled that , people suggested install libmysqlclient-dev first and then you should be able to install Mysql-python.
Has someone face a similar problem? What am I doing wrong here?

Python Anywhere access denied to MySQL database

I started to use Python Anywhere today. I created the database MySQL following the instructions. The problem is I can't do a simple manage.py syncdb because I get access denied error for my user 'irgmedeiros' in my mysql database. I can't grant privileges to my user neither create another user with privileges. How to solve it? Couldn't find solution in their forum and I'm waiting a answer from email. Anybody experienced this before?
Some possible troubleshooting steps:
check the server address - mysql.server
double-check the password - is it the same as the one you configured on the pythonanywhere MySQL config screens
double-check the database name - this follows the format username$database_name
check if you can open a normal mysql console, firstly from the MySQL tab, and then manually in a bash shell with
.
mysql -u my_username -h mysql.server -p
[edit] - the final solution was:
* double-check the database name - this follows the format username$database_name
don't forget that username$ folks!

Categories