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
- 查看節(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