Skip to content

Commit

Permalink
modify docker
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyShi22 committed May 16, 2018
1 parent 99465a9 commit c2ec957
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 102 deletions.
192 changes: 97 additions & 95 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -1,95 +1,97 @@
# FISCO BCOS Docker节点部署

本文档能够让初学者快速体验FISCO BCOS平台。初学者无需部署FISCO BCOS平台,仅需在安装了Docker的机器上运行本文档中的命令,即可启动两个FISCO BCOS节点。

推荐使用Docker 17.03以上版本,安装方法参照[官方文档][Docker-Install]或本文档附录。

## 启动节点

> 直接执行命令,第一次执行时需下载镜像,请耐心等待
```shell
sudo -s #务必切换到root下
chmod +x start_fisco_docker.sh
./start_fisco_docker.sh
```

> 执行后可看到提示
```log
--------------已尝试启动区块链docker节点--------------
节点信息:
节点名 IP rpcport p2pport channelPort 日志目录
node0 0.0.0.0 35500 53300 54300 /log-fisco-bcos/node0
node1 0.0.0.0 35501 53301 54301 /log-fisco-bcos/node1
验证区块链节点是否启动:
# ps -ef |grep fisco-bcos
验证一个区块链节点是否连接了另一个:
# cat /log-fisco-bcos/node0/* | grep peers
验证区块链节点是否能够进行共识:
# tail -f /log-fisco-bcos/node0/* | grep ++++
```

## 验证节点正常运行

### 1. 验证进程

```sh
ps -ef |grep fisco-bcos
```

> 可看到2个节点正在运行
```
root 9509 9507 10 15:26 ? 00:00:02 fisco-bcos --genesis /bcos-data/node0/genesis.json --config /bcos-data/node0/config.json
root 9510 9508 10 15:26 ? 00:00:02 fisco-bcos --genesis /bcos-data/node1/genesis.json --config /bcos-data/node1/config.json
```

### 2. 验证已连接

> 执行命令
```sh
cat /log-fisco-bcos/node0/* | grep peers
```

> 可以看到如下日志,表示日志对应的节点已经与另一个节点连接(Connected to 1 peers),连接正常:
```
INFO|2017-11-29 07:26:48|Connected to 1 peers
```

### 3. 验证可共识

> 执行命令
```sh
tail -f /log-fisco-bcos/node0/* | grep ++++
```

> 可看到周期性的出现如下日志,表示节点间在周期性的进行共识,节点运行正确
```
INFO|2017-11-29 07:27:39|+++++++++++++++++++++++++++ Generating seal on6eafa4cd3ecb1e80a57588d3ea4ce95b3b4e807bb3da07c35a3931d0f25cda14#1tx:0,maxtx:1000,tq.num=0time:1511940459437
INFO|2017-11-29 07:27:41|+++++++++++++++++++++++++++ Generating seal on972ead626ee8df0f4f6750076733507430de7d020e3844704f600f2fb1d75a9c#1tx:0,maxtx:1000,tq.num=0time:1511940461448
```

## 附录

### 1. docker部署

以CentOS/Fedora为例

> 安装
```shell
sudo yum install docker
```

> 启动服务
```shell
sudo -s
service docker start
```

# FISCO BCOS Docker节点部署

[FISCO BCOS Docker Installation Manual](https://github.com/FISCO-BCOS/Wiki/tree/master/en/FISCO%20BCOS%20Docker%20Installation%20Manual)

本文档能够让初学者快速体验FISCO BCOS平台。初学者无需部署FISCO BCOS平台,仅需在安装了Docker的机器上运行本文档中的命令,即可启动两个FISCO BCOS节点。

推荐使用Docker 17.03以上版本,安装方法参照[官方文档][Docker-Install]或本文档附录。

## 启动节点

> 直接执行命令,第一次执行时需下载镜像,请耐心等待
```shell
sudo -s #务必切换到root下
chmod +x start_fisco_docker.sh
./start_fisco_docker.sh
```

> 执行后可看到提示
```log
--------------Nodes info in docker--------------
Nodes info:
node name IP rpcport p2pport channelPort log dir
node0 0.0.0.0 35500 53300 54300 /log-fisco-bcos/node0
node1 0.0.0.0 35501 53301 54301 /log-fisco-bcos/node1
To check whether the nodes are started:
# ps -ef |grep fisco-bcos
To check whether the nodes are connected each other:
# cat /log-fisco-bcos/node0/* | grep peers
To check whether the nodes can seal:
# tail -f /log-fisco-bcos/node0/* | grep ++++
```

## 验证节点正常运行

### 1. 验证进程

```sh
ps -ef |grep fisco-bcos
```

> 可看到2个节点正在运行
```
root 9509 9507 10 15:26 ? 00:00:02 fisco-bcos --genesis /bcos-data/node0/genesis.json --config /bcos-data/node0/config.json
root 9510 9508 10 15:26 ? 00:00:02 fisco-bcos --genesis /bcos-data/node1/genesis.json --config /bcos-data/node1/config.json
```

### 2. 验证已连接

> 执行命令
```sh
cat /log-fisco-bcos/node0/* | grep peers
```

> 可以看到如下日志,表示日志对应的节点已经与另一个节点连接(Connected to 1 peers),连接正常:
```
INFO|2017-11-29 07:26:48|Connected to 1 peers
```

### 3. 验证可共识

> 执行命令
```sh
tail -f /log-fisco-bcos/node0/* | grep ++++
```

> 可看到周期性的出现如下日志,表示节点间在周期性的进行共识,节点运行正确
```
INFO|2017-11-29 07:27:39|+++++++++++++++++++++++++++ Generating seal on6eafa4cd3ecb1e80a57588d3ea4ce95b3b4e807bb3da07c35a3931d0f25cda14#1tx:0,maxtx:1000,tq.num=0time:1511940459437
INFO|2017-11-29 07:27:41|+++++++++++++++++++++++++++ Generating seal on972ead626ee8df0f4f6750076733507430de7d020e3844704f600f2fb1d75a9c#1tx:0,maxtx:1000,tq.num=0time:1511940461448
```

## 附录

### 1. docker部署

以CentOS/Fedora为例

> 安装
```shell
sudo yum install docker
```

> 启动服务
```shell
sudo -s
service docker start
```

14 changes: 7 additions & 7 deletions docker/start_fisco_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ channelPort1=54300
channelPort2=54301
local_ip="0.0.0.0"

echo -e "--------------区块链docker节点信息--------------"
echo -e "节点信息:"
echo -e " 节点名 \tIP\t\trpcport\t\tp2pport\t\tchannelPort\t日志目录"
echo -e "--------------Nodes info in docker--------------"
echo -e "Nodes info:"
echo -e " node name \tIP\t\trpcport\t\tp2pport\t\tchannelPort\tlog dir"
echo -e " node0\t\t"$local_ip"\t\t"$rpcport1"\t\t"$p2pport1"\t\t"$channelPort1"\t\t"$log_dir/node0
echo -e " node1\t\t"$local_ip"\t\t"$rpcport2"\t\t"$p2pport2"\t\t"$channelPort2"\t\t"$log_dir/node1
echo -e "验证区块链节点是否启动:"
echo -e "To check whether the nodes are started:"
echo -e " # ps -ef |grep fisco-bcos"
echo -e "验证一个区块链节点是否连接了另一个:"
echo -e "To check whether the nodes are connected each other:"
echo -e " # cat "$log_dir"/node0/* | grep peers"
echo -e "验证区块链节点是否能够进行共识: "
echo -e "To check whether the nodes can seal: "
echo -e " # tail -f "$log_dir"/node0/* | grep ++++"
echo -e ""
echo -e "尝试启动区块链docker节点..."
echo -e "Trying to start nodes in docker..."
docker run -v $log_dir:/bcos-data/log -p 35500:35500 -p 35501:35501 -p 53300:53300 -p 53301:53301 -p 54300:54300 -p 54301:54301 -i docker.io/fiscoorg/fiscobcos:latest /bcos-data/start_node.sh &

0 comments on commit c2ec957

Please sign in to comment.