运行Chainlink节点-无法连接到数据库 [英] Running a Chainlink Node - Can't connect to database

查看:79
本文介绍了运行Chainlink节点-无法连接到数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在macOS上使用docker-desktop.

Using docker-desktop on macOS.

我正在尝试按照此页面上的说明运行节点.

数据库名称为 node ,与用户名 node 相同.用户有权访问数据库,并且可以使用 psql 客户端登录.

The database name is node, which is the same as the username: node. The user has access to the database and can log in using psql client.

我在.env文件中尝试过的连接字符串:

Connection strings I've tried in the .env file:

postgresql://node@localhost/node
postgresql://node:password@localhost/node
postgresql://node:password@localhost:5432/node
postgresql://node:password@127.0.0.1:5432/node
postgresql://node:password@127.0.0.1/node

当我运行启动命令: cd〜/.chainlink-kovan&&docker run -p 6688:6688 -v〜/.chainlink-kovan:/chainlink -it --env-file = .env smartcontract/chainlink local n ,在macOS上使用docker-desktop,我得到以下堆栈跟踪:

When I run the start command: cd ~/.chainlink-kovan && docker run -p 6688:6688 -v ~/.chainlink-kovan:/chainlink -it --env-file=.env smartcontract/chainlink local n , using docker-desktop on macOS, I get the following stack trace:

2020-09-15T14:24:41Z [INFO]  Starting Chainlink Node 0.8.15 at commit a904730bd62c7174b80a2c4ccf885de3e78e3971 cmd/local_client.go:50
2020-09-15T14:24:41Z [INFO]  SGX enclave *NOT* loaded                           cmd/enclave.go:11
2020-09-15T14:24:41Z [INFO]  This version of chainlink was not built with support for SGX tasks cmd/enclave.go:12
2020-09-15T14:24:41Z [INFO]  Locking postgres for exclusive access with 500ms timeout orm/orm.go:69
2020-09-15T14:24:41Z [ERROR] unable to lock ORM: dial tcp 127.0.0.1:5432: connect: connection refused logger/default.go:139   stacktrace=github.com/smartcontractkit/chainlink/core/logger.Error
    /chainlink/core/logger/default.go:117
...

有人知道我该如何解决吗?

Does anyone know how I can resolve this?

推荐答案

问题出在docker网络上.

The problem is with docker networking.

-网络主机添加到docker run命令中,以便:

Add --network host to the docker run command so that it is:

cd ~/.chainlink-kovan && docker run -p 6688:6688 -v ~/.chainlink-kovan:/chainlink -it --env-file=.env smartcontract/chainlink --network host local n

这解决了该问题.

这篇关于运行Chainlink节点-无法连接到数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆