Skip to content
This repository has been archived by the owner on Jan 22, 2020. It is now read-only.

Unable to execute command ./horizon db init #417

Open
swetakedia opened this issue Dec 12, 2017 · 2 comments
Open

Unable to execute command ./horizon db init #417

swetakedia opened this issue Dec 12, 2017 · 2 comments

Comments

@swetakedia
Copy link

swetakedia commented Dec 12, 2017

I have set the DATABASE_URL, STELLAR_CORE_DATABASE_URL and STELLAR_CORE_URL variable.

I have created a blank database for horizon named as horizon_db.

When I execute echo $DATABASE_URL it prints proper url:


ubuntu@ip-172-31-31-211:~/Node1/horizon-snapshot-linux-amd64$ echo $DATABASE_URL
postgresql://horizon:pwd@localhost/horizon_db

When I try to execute ./horizon db init it is giving following error:

ERRO[0000] exec failed: pq: relation "gorp_migrations" already exists pid=6845

When I login to psql and check the horizon_db database, no relation exists.

postgres=# \c horizon_db You are now connected to database "horizon_db" as user "postgres". horizon_db=# \d+ No relations found. horizon_db=#

Is there any problem in latest release. I am using "horizon-snapshot-linux-amd64.tar.gz" from https://github.com/stellar/go/releases

@bphallad
Copy link

bphallad commented Jan 24, 2018

Try running horizon with the --db-url flag and the contents of $DATABASE_PATH on the command line.

./horizon --db-url 'postgres://horizon:pwd@localhost/horizon_db'

It will likely complain about an empty database, but it makes sure that horizon has your postgresql database path. Not sure why setting the environment variable doesn't automatically do this as it should. Just quit horizon at that point then run your command.

./horizon db init

I'm not sure this solves the problem, so please let me know. I just ran into this and these are the steps that worked for me.

@laxmankande
Copy link

Hi @bphallad @swetakedia ,
did you able to solve this issue? I am getting same error even I pass db-url, stellar-core-db and stellar-core server url.
I am using this build https://github.com/stellar/go/releases/download/horizon-v0.12.0-testing/horizon-v0.12.0-testing-linux-amd64.tar.gz

@bartekn Please help.

Best Regards
Laxman

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants