Hyperledger Iroha not connecting to postgres database?












0















I am trying to deploy Hyperledger Iroha in Docker environment for running a single instance as per the guidelines given in 5.3.1 section at



https://iroha.readthedocs.io/en/latest/guides/deployment.html#running-single-instance 


However, I am getting below error.



NOTE: IROHA_POSTGRES_HOST should match 'host' option in config file
wait-for-it.sh: waiting 30 seconds for 127.0.0.1:5432
wait-for-it.sh: timeout occurred after waiting 30 seconds for 127.0.0.1:5432
[2019-01-02 11:33:20.406202853][th:80][info] MAIN start
[2019-01-02 11:33:20.406373949][th:80][info] MAIN config initialized
[2019-01-02 11:33:20.407157701][th:80][info] IROHAD created
[2019-01-02 11:33:20.407215609][th:80][info] StorageImpl:initConnection Start st
[2019-01-02 11:33:20.407363960][th:80][info] StorageImpl:initConnection block st
terminate called after throwing an instance of 'soci::soci_error'
what(): Cannot establish connection to the database.
could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?


But I tested whether postgres server is running in my system or not using psql command. I am able to connect to postgres server from command prompt using psql command.



The iroha config file contents are as follows.



{ 
"block_storage_path":"/tmp/block_store",
"torii_port" : 50051,
"internal_port" : 10001,
"pg_opt" : "host=127.0.0.1 port=5432 user=postgres password=abc123",
"max_proposal_size" : 10,
"proposal_delay" : 5000,
"vote_delay" : 5000,
"mst_enable" : false
}


And the command i used for running iroha daemon is as follows.



iroha$ sudo docker run --name iroha2 -p 50051:50051 -v /home/user/iroha/example:/opt/iroha_data -v blockstore:/tmp/block_store -e IROHA_POSTGRES_HOST='127.0.0.1' -e POSTGRES_PORT='5432' -e POSTGRES_PASSWORD='abc123' -e POSTGRES_USER='postgres' -e KEY=node0 --network=iroha-network hyperledger/iroha:latest









share|improve this question



























    0















    I am trying to deploy Hyperledger Iroha in Docker environment for running a single instance as per the guidelines given in 5.3.1 section at



    https://iroha.readthedocs.io/en/latest/guides/deployment.html#running-single-instance 


    However, I am getting below error.



    NOTE: IROHA_POSTGRES_HOST should match 'host' option in config file
    wait-for-it.sh: waiting 30 seconds for 127.0.0.1:5432
    wait-for-it.sh: timeout occurred after waiting 30 seconds for 127.0.0.1:5432
    [2019-01-02 11:33:20.406202853][th:80][info] MAIN start
    [2019-01-02 11:33:20.406373949][th:80][info] MAIN config initialized
    [2019-01-02 11:33:20.407157701][th:80][info] IROHAD created
    [2019-01-02 11:33:20.407215609][th:80][info] StorageImpl:initConnection Start st
    [2019-01-02 11:33:20.407363960][th:80][info] StorageImpl:initConnection block st
    terminate called after throwing an instance of 'soci::soci_error'
    what(): Cannot establish connection to the database.
    could not connect to server: Connection refused
    Is the server running on host "127.0.0.1" and accepting
    TCP/IP connections on port 5432?


    But I tested whether postgres server is running in my system or not using psql command. I am able to connect to postgres server from command prompt using psql command.



    The iroha config file contents are as follows.



    { 
    "block_storage_path":"/tmp/block_store",
    "torii_port" : 50051,
    "internal_port" : 10001,
    "pg_opt" : "host=127.0.0.1 port=5432 user=postgres password=abc123",
    "max_proposal_size" : 10,
    "proposal_delay" : 5000,
    "vote_delay" : 5000,
    "mst_enable" : false
    }


    And the command i used for running iroha daemon is as follows.



    iroha$ sudo docker run --name iroha2 -p 50051:50051 -v /home/user/iroha/example:/opt/iroha_data -v blockstore:/tmp/block_store -e IROHA_POSTGRES_HOST='127.0.0.1' -e POSTGRES_PORT='5432' -e POSTGRES_PASSWORD='abc123' -e POSTGRES_USER='postgres' -e KEY=node0 --network=iroha-network hyperledger/iroha:latest









    share|improve this question

























      0












      0








      0








      I am trying to deploy Hyperledger Iroha in Docker environment for running a single instance as per the guidelines given in 5.3.1 section at



      https://iroha.readthedocs.io/en/latest/guides/deployment.html#running-single-instance 


      However, I am getting below error.



      NOTE: IROHA_POSTGRES_HOST should match 'host' option in config file
      wait-for-it.sh: waiting 30 seconds for 127.0.0.1:5432
      wait-for-it.sh: timeout occurred after waiting 30 seconds for 127.0.0.1:5432
      [2019-01-02 11:33:20.406202853][th:80][info] MAIN start
      [2019-01-02 11:33:20.406373949][th:80][info] MAIN config initialized
      [2019-01-02 11:33:20.407157701][th:80][info] IROHAD created
      [2019-01-02 11:33:20.407215609][th:80][info] StorageImpl:initConnection Start st
      [2019-01-02 11:33:20.407363960][th:80][info] StorageImpl:initConnection block st
      terminate called after throwing an instance of 'soci::soci_error'
      what(): Cannot establish connection to the database.
      could not connect to server: Connection refused
      Is the server running on host "127.0.0.1" and accepting
      TCP/IP connections on port 5432?


      But I tested whether postgres server is running in my system or not using psql command. I am able to connect to postgres server from command prompt using psql command.



      The iroha config file contents are as follows.



      { 
      "block_storage_path":"/tmp/block_store",
      "torii_port" : 50051,
      "internal_port" : 10001,
      "pg_opt" : "host=127.0.0.1 port=5432 user=postgres password=abc123",
      "max_proposal_size" : 10,
      "proposal_delay" : 5000,
      "vote_delay" : 5000,
      "mst_enable" : false
      }


      And the command i used for running iroha daemon is as follows.



      iroha$ sudo docker run --name iroha2 -p 50051:50051 -v /home/user/iroha/example:/opt/iroha_data -v blockstore:/tmp/block_store -e IROHA_POSTGRES_HOST='127.0.0.1' -e POSTGRES_PORT='5432' -e POSTGRES_PASSWORD='abc123' -e POSTGRES_USER='postgres' -e KEY=node0 --network=iroha-network hyperledger/iroha:latest









      share|improve this question














      I am trying to deploy Hyperledger Iroha in Docker environment for running a single instance as per the guidelines given in 5.3.1 section at



      https://iroha.readthedocs.io/en/latest/guides/deployment.html#running-single-instance 


      However, I am getting below error.



      NOTE: IROHA_POSTGRES_HOST should match 'host' option in config file
      wait-for-it.sh: waiting 30 seconds for 127.0.0.1:5432
      wait-for-it.sh: timeout occurred after waiting 30 seconds for 127.0.0.1:5432
      [2019-01-02 11:33:20.406202853][th:80][info] MAIN start
      [2019-01-02 11:33:20.406373949][th:80][info] MAIN config initialized
      [2019-01-02 11:33:20.407157701][th:80][info] IROHAD created
      [2019-01-02 11:33:20.407215609][th:80][info] StorageImpl:initConnection Start st
      [2019-01-02 11:33:20.407363960][th:80][info] StorageImpl:initConnection block st
      terminate called after throwing an instance of 'soci::soci_error'
      what(): Cannot establish connection to the database.
      could not connect to server: Connection refused
      Is the server running on host "127.0.0.1" and accepting
      TCP/IP connections on port 5432?


      But I tested whether postgres server is running in my system or not using psql command. I am able to connect to postgres server from command prompt using psql command.



      The iroha config file contents are as follows.



      { 
      "block_storage_path":"/tmp/block_store",
      "torii_port" : 50051,
      "internal_port" : 10001,
      "pg_opt" : "host=127.0.0.1 port=5432 user=postgres password=abc123",
      "max_proposal_size" : 10,
      "proposal_delay" : 5000,
      "vote_delay" : 5000,
      "mst_enable" : false
      }


      And the command i used for running iroha daemon is as follows.



      iroha$ sudo docker run --name iroha2 -p 50051:50051 -v /home/user/iroha/example:/opt/iroha_data -v blockstore:/tmp/block_store -e IROHA_POSTGRES_HOST='127.0.0.1' -e POSTGRES_PORT='5432' -e POSTGRES_PASSWORD='abc123' -e POSTGRES_USER='postgres' -e KEY=node0 --network=iroha-network hyperledger/iroha:latest






      postgresql database-connection hyperledger-iroha






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 2 at 11:51









      Satya NarayanaSatya Narayana

      147113




      147113
























          1 Answer
          1






          active

          oldest

          votes


















          1














          Please note that you are trying to run Iroha node inside docker container, thus inside docker network. Postgres instance running on host machine will not be reachable from docker container.
          I suggest you running two docker containers: Postgres and Iroha. They will be in the same network, thus they will see each other.



          In the link that you provided above, there are instructions for that.



          docker run --name some-postgres 
          -e POSTGRES_USER=postgres
          -e POSTGRES_PASSWORD=mysecretpassword
          -p 5432:5432
          --network=iroha-network
          -d postgres:9.5

          And do not forget to change postgres host in your config file




          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54005849%2fhyperledger-iroha-not-connecting-to-postgres-database%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            Please note that you are trying to run Iroha node inside docker container, thus inside docker network. Postgres instance running on host machine will not be reachable from docker container.
            I suggest you running two docker containers: Postgres and Iroha. They will be in the same network, thus they will see each other.



            In the link that you provided above, there are instructions for that.



            docker run --name some-postgres 
            -e POSTGRES_USER=postgres
            -e POSTGRES_PASSWORD=mysecretpassword
            -p 5432:5432
            --network=iroha-network
            -d postgres:9.5

            And do not forget to change postgres host in your config file




            share|improve this answer




























              1














              Please note that you are trying to run Iroha node inside docker container, thus inside docker network. Postgres instance running on host machine will not be reachable from docker container.
              I suggest you running two docker containers: Postgres and Iroha. They will be in the same network, thus they will see each other.



              In the link that you provided above, there are instructions for that.



              docker run --name some-postgres 
              -e POSTGRES_USER=postgres
              -e POSTGRES_PASSWORD=mysecretpassword
              -p 5432:5432
              --network=iroha-network
              -d postgres:9.5

              And do not forget to change postgres host in your config file




              share|improve this answer


























                1












                1








                1







                Please note that you are trying to run Iroha node inside docker container, thus inside docker network. Postgres instance running on host machine will not be reachable from docker container.
                I suggest you running two docker containers: Postgres and Iroha. They will be in the same network, thus they will see each other.



                In the link that you provided above, there are instructions for that.



                docker run --name some-postgres 
                -e POSTGRES_USER=postgres
                -e POSTGRES_PASSWORD=mysecretpassword
                -p 5432:5432
                --network=iroha-network
                -d postgres:9.5

                And do not forget to change postgres host in your config file




                share|improve this answer













                Please note that you are trying to run Iroha node inside docker container, thus inside docker network. Postgres instance running on host machine will not be reachable from docker container.
                I suggest you running two docker containers: Postgres and Iroha. They will be in the same network, thus they will see each other.



                In the link that you provided above, there are instructions for that.



                docker run --name some-postgres 
                -e POSTGRES_USER=postgres
                -e POSTGRES_PASSWORD=mysecretpassword
                -p 5432:5432
                --network=iroha-network
                -d postgres:9.5

                And do not forget to change postgres host in your config file





                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 9 at 13:47









                Dima SavvaDima Savva

                512




                512
































                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54005849%2fhyperledger-iroha-not-connecting-to-postgres-database%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Can a sorcerer learn a 5th-level spell early by creating spell slots using the Font of Magic feature?

                    Does disintegrating a polymorphed enemy still kill it after the 2018 errata?

                    A Topological Invariant for $pi_3(U(n))$