问题描述
在macOS上使用docker-desktop。
我正在尝试按照this page上的说明运行节点。
数据库名称为node
,与用户名node
相同。用户有权访问数据库,并且可以使用psql
客户端登录。
我在.env文件中尝试过的连接字符串:
postgresql://node@localhost/node
postgresql://node:password@localhost/node
postgresql://node:password@localhost:5432/node
postgresql://node:[email protected]:5432/node
postgresql://node:[email protected]/node
在macOS上使用docker-desktop运行start command:cd ~/.chainlink-kovan && docker run -p 6688:6688 -v ~/.chainlink-kovan:/chainlink -it --env-file=.env smartcontract/chainlink local n
时,我得到以下堆栈跟踪:
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
...
有人知道我该如何解决吗?
解决方法
问题出在docker网络上。
将--network host
添加到docker run命令,使其为:
cd ~/.chainlink-kovan && docker run -p 6688:6688 -v ~/.chainlink-kovan:/chainlink -it --env-file=.env smartcontract/chainlink --network host local n
这可以解决问题。
,该问题可能是由于您的链链接数据库已被Exclusive Lock
锁定并且在停止从未删除的锁定节点之前造成的。
在这种情况下(对我而言有效),您要执行的操作是使用PgAdmin Ui或类似方法找到所有锁,然后找到链链接数据库上持有的互斥锁并记下其进程ID(如果有多个)链锁数据库上有排他锁)
登录到pg客户端并运行SELECT pg_terminate_backend(<pid>)
或SELECT pg_cancel_backend(<pid>);
,在此处输入这些锁的PID(不带引号),同时继续刷新pg admin URL,以查看那些进程是否停止。如果停止,则重新运行链链接节点。