1. 下载安装docker


sudo apt-get update

sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release

curl -fsSL <span class="hljs-symbol">https:</span>/<span class="hljs-regexp">/download.docker.com/linux</span><span class="hljs-regexp">/ubuntu/gpg</span> <span class="hljs-params">| sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
</span>

<span class="hljs-keyword">echo</span> \
  <span class="hljs-string">"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable"</span> | sudo tee /etc/apt/sources.<span class="hljs-keyword">list</span>.d/docker.<span class="hljs-keyword">list</span> &gt; /dev/<span class="hljs-keyword">null</span>

sudo apt-get update

<span class="hljs-selector-tag">sudo</span> <span class="hljs-selector-tag">apt-get</span> <span class="hljs-selector-tag">install</span> <span class="hljs-selector-tag">docker-ce</span> <span class="hljs-selector-tag">docker-ce-cli</span> <span class="hljs-selector-tag">containerd</span><span class="hljs-selector-class">.io</span>

2. 验证docker安装成功


sudo docker run hello-world

3. 安装compose


sudo curl -L <span class="hljs-string">"https://github.com/docker/compose/releases/download/1.29.2/docker-compose-<span class="hljs-variable">$(uname -s)</span>-<span class="hljs-variable">$(uname -m)</span>"</span> -o /usr/<span class="hljs-built_in">local</span>/bin/docker-compose

sudo chmod +x /usr/<span class="hljs-built_in">local</span>/bin/docker-compose

4. 验证compose安装


docker-compose --version
# 输出docker-compose version x.xx.x, build xxxxx表示成功

5. 安装bee

进入根目录


<span class="hljs-built_in">cd</span> ~

创建bee文件夹


mkdir bee

将发给你的docker-compose.yaml文件放入bee文件夹。

使用命令如下命令进入bee文件夹


<span class="hljs-built_in">cd</span> ~/bee

下载.env文件


wget -q <span class="hljs-symbol">https:</span>/<span class="hljs-regexp">/raw.githubusercontent.com/ethersphere</span><span class="hljs-regexp">/bee/v</span><span class="hljs-number">0</span>.<span class="hljs-number">5.3</span>/packaging/docker/env -O .env

6. 运行bee

.yaml file – > https://blog.csdn.net/Z1404686551/article/details/117486604


docker-compose up -d

7. 查看节点运行状态

使用如下命令查看各个节点运行情况:
第一个节点:


docker-compose logs -f bee-1

第二个节点:


docker-compose logs -f bee-2

第三个节点:


docker-compose logs -f bee-3
!注意:第一次运行需要水,查看每个节点运行状况时,会出现如下信息,表示需要充水,地址就是单词“on”后面的那一串字符串,比如如下信息显示的地址就是

071b7b336a00938de88b9db1dc7fc4301079d513

,将水充入这个地址就可以:


time=<span class="hljs-string">"2021-05-21T09:37:31Z"</span> level=warning msg=<span class="hljs-string">"cannot continue until there is at least 10 BZZ available on 071b7b336a00938de88b9db1dc7fc4301079d513"</span>
bee-1_1
time=<span class="hljs-string">"2021-05-21T09:37:31Z"</span> level=warning msg=<span class="hljs-string">"get your Goerli ETH and Goerli BZZ now via the bzzaar at https://bzz.ethswarm.org/?transaction=buy&amp;amount=10&amp;slippage=30&amp;receiver=0x071b7b336a00938de88b9db1dc7fc4301079d513"</span>

同理,三个节点都需要充水。

充水完毕后,运行如下命令停止所有bee:


docker stop $(docker ps -a -q)

然后使用如下命令重新运行bee节点:


docker-compose up -d
  1. 查看节点数和获票情况
    查看第一个节点连接数量:

curl -s <span class="hljs-symbol">http:</span>/<span class="hljs-regexp">/localhost:1635/peers</span> <span class="hljs-params">| jq '.peers |</span> length<span class="hljs-string">'
</span>

查看第二个节点连接数量:


curl -s <span class="hljs-symbol">http:</span>/<span class="hljs-regexp">/localhost:1735/peers</span> <span class="hljs-params">| jq '.peers |</span> length<span class="hljs-string">'
</span>

查看第三个节点连接数量:


curl -s <span class="hljs-symbol">http:</span>/<span class="hljs-regexp">/localhost:1835/peers</span> <span class="hljs-params">| jq '.peers |</span> length<span class="hljs-string">'
</span>

查看第一个节点获得的票:


curl localhost:1635/chequebook/cheque | jq

查看第二个节点获得的票:


curl localhost:1735/chequebook/cheque | jq

查看第三个节点获得的票:


curl localhost:1835/chequebook/cheque | jq

发表评论

邮箱地址不会被公开。 必填项已用*标注