【Blockchain】HyperLedger Besu Q&A

I believe that you will encounter various problems when building Besu. Here I summarize some of the most common ones for your reference, hoping to help you.

Q1:

An exception is thrown when the Besu node interacts with other nodes through Docker Swarm (the Docker network has been confirmed to be normal)

Error response from daemon: rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection error: desc = "transport: Error while dialing dial tcp 92.168.1.164:2377: connect: no route to host"

A1:

According to the Internet, this is caused by the system firewall, try to turn off the host firewall to solve this problem

systemctl stop firewalld.service
systemctl disable firewalld.service

Q2:

Exception thrown after restarting Docker

docker: Error response from daemon: error creating external connectivity network: Failed to Setup IP tables: Unable to enable SKIP DNAT rule:  (iptables failed: iptables --wait -t nat -I DOCKER -i docker_gwbridge -j RETURN: iptables: No chain/target/match by that name.
 (exit status 1)).

A2:

If the gateway is closed when the docker service is started, then docker will not operate the gateway configuration (chain docker). If the gateway is restarted afterwards, the docker network will not be able to configure the network for the new container, that is, it will not have the operation authority of the network management system, so it needs to be restarted. as follows:

service docker restart 

Q3:

When I first started learning Docker Swarm, repeatedly creating nodes and joining nodes threw the following error

Error response from daemon: rpc error: code = FailedPrecondition desc = network y2r9sn2ntcafv7uq7wema52vr is in use by task 9bhrcs4p8vtg9kuihd1djxhmi

A3:

# 先查看docker集群节点
docker node ls

# 释放节点
docker node update --availability drain y2qsyjdbfmm4tjwh4p9wqlmq1

# 删除节点
docker node rm y2qsyjdbfmm4tjwh4p9wqlmq1

Q4:

When I first started learning Docker Swarm, I repeatedly added nodes to the cluster and threw the following error

Error response from daemon: This node is already part of a swarm. Use "docker swarm leave" to leave this swarm and join another one.

A4:

# 先强制让节点脱离swarm模式
docker swarm leave --force

# 再使用join将节点加入到别的swarm网络
docker swarm join --token SWMTKN-1-0j7cpk5ipfx11duvittzm1ke0oamnzgy9mkjzoqyc53c1yi67y-bc7jsrpzxaqlrnducznt8x0qn 92.168.1.164:2377

Q5:

Still in the network problem of Docker Swarm, this error often appears when creating Besu's signing node and appears "unable to join the network"

docker: Error response from daemon: attaching to network failed, make sure your network options are correct and check manager logs: context deadline exceeded.

A5:

# 先将节点释放
docker node update --availability drain xxxx

#之后重新将节点激活
docker node update --availability active xxxx

According to the above operations, there will still be a high probability of error recurrence (before I disconnected all nodes from the overlay network and then rejoined, the above error will still occur), so it is recommended to create a busybox container and join the overlay network before creating a signing node , and then create the signing node.


Q6:

Regarding the various problems that may arise when installing web3.js, here I directly publish a guide to let everyone avoid pitfalls.

A6:

# 先使用普通账号安装nodejs,一般来说CentOS通过yum安装会自动安装6.x版本的nodejs。
sudo yum install nodejs

# 接着就通过npm安装n(nodejs的管理工具,是为了后面升级nodejs使用的)
sudo npm i -g n

# 安装好n之后就通过n来对现有的nodejs进行升级,这里升级成lts版本
sudo n lts

# 升级lts后发现nodejs虽然已升级成功,但npm还是旧的版本。这时先不管这个直接通过npm装一个cnpm。
sudo npm install -g cnpm --registry=https://registry.npm.taobao.org

# cnpm安装完毕后切换到目标目录采用以下命令安装web3.js
sudo cnpm install [email protected]

# 为了生成package.json文件在目标目录下使用以下命令初始化项目目录,让其将编译包全部下载到本地。
sudo npm init

# 最后使用以下命令将当前目录转换成可执行目录后就可以使用web3.js了
sudo cnpm install -g [email protected] --save

おすすめ

転載: blog.csdn.net/kida_yuan/article/details/129256090
おすすめ