Swarm bzz bee docker單機(jī)器多節(jié)點(diǎn)方案-ubuntu

1. 下載安裝docker

sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

2. 驗(yàn)證docker安裝成功

sudo docker run hello-world

3. 安裝compose

sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

4. 驗(yàn)證compose安裝

docker-compose --version

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

5. 安裝bee

進(jìn)入根目錄

cd ~

創(chuàng)建bee文件夾

mkdir bee

將發(fā)給你的docker-compose.yaml文件放入bee文件夾。

使用命令如下命令進(jìn)入bee文件夾

cd ~/bee

下載.env文件

wget -q https://raw.githubusercontent.com/ethersphere/bee/v0.5.3/packaging/docker/env -O .env

6. 運(yùn)行bee

docker-compose up -d

7. 查看節(jié)點(diǎn)運(yùn)行狀態(tài)

使用如下命令查看各個(gè)節(jié)點(diǎn)運(yùn)行情況:
第一個(gè)節(jié)點(diǎn):

docker-compose logs -f bee-1

第二個(gè)節(jié)點(diǎn):

docker-compose logs -f bee-2

第三個(gè)節(jié)點(diǎn):

docker-compose logs -f bee-3
!注意:第一次運(yùn)行需要水,查看每個(gè)節(jié)點(diǎn)運(yùn)行狀況時(shí),會(huì)出現(xiàn)如下信息,表示需要充水,地址就是單詞“on”后面的那一串字符串,比如如下信息顯示的地址就是071b7b336a00938de88b9db1dc7fc4301079d513,將水充入這個(gè)地址就可以:
time="2021-05-21T09:37:31Z" level=warning msg="cannot continue until there is at least 10 BZZ available on 071b7b336a00938de88b9db1dc7fc4301079d513"
bee-1_1
time="2021-05-21T09:37:31Z" level=warning msg="get your Goerli ETH and Goerli BZZ now via the bzzaar at https://bzz.ethswarm.org/?transaction=buy&amount=10&slippage=30&receiver=0x071b7b336a00938de88b9db1dc7fc4301079d513"

同理,三個(gè)節(jié)點(diǎn)都需要充水。

充水完畢后,運(yùn)行如下命令停止所有bee:

docker stop $(docker ps -a -q)

然后使用如下命令重新運(yùn)行bee節(jié)點(diǎn):

docker-compose up -d
  1. 查看節(jié)點(diǎn)數(shù)和獲票情況
    查看第一個(gè)節(jié)點(diǎn)連接數(shù)量:
curl -s http://localhost:1635/peers | jq '.peers | length'

查看第二個(gè)節(jié)點(diǎn)連接數(shù)量:

curl -s http://localhost:1735/peers | jq '.peers | length'

查看第三個(gè)節(jié)點(diǎn)連接數(shù)量:

curl -s http://localhost:1835/peers | jq '.peers | length'

查看第一個(gè)節(jié)點(diǎn)獲得的票:

curl localhost:1635/chequebook/cheque | jq

查看第二個(gè)節(jié)點(diǎn)獲得的票:

curl localhost:1735/chequebook/cheque | jq

查看第三個(gè)節(jié)點(diǎn)獲得的票:

curl localhost:1835/chequebook/cheque | jq

LordDW原創(chuàng)教程,禁止轉(zhuǎn)載!有疑問(wèn)或者需要配置文件私信我(有償)。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容