我正在尝试在 Docker 环境中部署 Hyperledger Iroha 以按照 5.3.1 部分中给出的指南运行单个实例
https://iroha.readthedocs.io/en/latest/guides/deployment.html#running-single-instance
但是,我遇到了错误。
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?
但是我使用 psql 命令测试了 postgres 服务器是否在我的系统中运行。我可以使用 psql 命令从命令提示符连接到 postgres 服务器。
iroha 配置文件内容如下。
{
"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
}
我用于运行 iroha 守护程序的命令如下。
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