Skip to content

Commit

Permalink
1.1.2
Browse files Browse the repository at this point in the history
* 脚本自动分发到各个服务器
* orderer增加kafka集群
* 账本存储使用couchdb
  • Loading branch information
Trekkiii committed Jul 11, 2018
1 parent 8520731 commit be73c54
Show file tree
Hide file tree
Showing 13 changed files with 730 additions and 98 deletions.
81 changes: 46 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,40 +16,24 @@
```bash
root@vm10-249-0-4:~/fabric-web/fabric-ca# chmod +x *.sh
root@vm10-249-0-4:~/fabric-web/fabric-ca#
root@vm10-249-0-4:~/fabric-web/fabric-ca#
root@vm10-249-0-4:~/fabric-web/fabric-ca# chmod +x scripts/*.sh
```

### 0. 网络拓扑
### Z、网络拓扑

通过`fabric.config`定义网络拓扑结构。

通过`fabric.config`定义网络拓扑结构
> 💡 确认`setup`节点的IP与第一个Peer组织的第一个peer节点一致(`setup`脚本是基于第一个节点身份的),
> 否则在执行实例化链码时报错:Timeout ***
### 1.构建项目,为不同节点打包脚本
### 一、构建项目,为不同节点打包脚本

```bash
./network_builder.sh
```

再正式开始前,确保你已经正确完成下列步骤执行:
**在正式开始前,确保你已经正确完成下列步骤执行**

为了方便起见,我们拿代码中提供的示例`fabric.config`配置文件做说明:

*`build`目录下生成的文件夹分别拷贝到相应节点的 **_`fabric.config`配置中指定用户的指定目录_** 下;

```bash
scp -r ica ubuntu@<IP>:~/fabric/ica
scp -r rca ubuntu@<IP>:~/fabric/rca
scp -r peer ubuntu@<IP>:~/fabric/peer
scp -r orderer ubuntu@<IP>:~/fabric/orderer
scp -r setup ubuntu@<IP>:~/fabric/setup
```

> 务必将`setup`拷贝到第一个Peer组织的第一个peer节点上执行,否则在执行实例化链码时报错:Timeout...

所有节点的目录应该类似这个样子:

![](./ica-tree.png)

* 每个节点都已下载所需的fabric镜像;

可执行如下命令下载镜像:
Expand All @@ -58,7 +42,7 @@ root@vm10-249-0-4:~/fabric-web/fabric-ca# chmod +x scripts/*.sh
./down-images.sh
```

### 2.启动CA服务
### 二、启动CA服务

对于每一个组织都要启动一个rca和ica服务。

Expand Down Expand Up @@ -118,7 +102,7 @@ root@vm10-249-0-4:~/fabric-web/fabric-ca# chmod +x scripts/*.sh
这些工作脚本也已经帮我们完成了!~ ✌
### 3. 启动setup
### 三、启动setup
setup容器用于:
Expand Down Expand Up @@ -155,15 +139,41 @@ setup-bootstrap.sh [-h] [-?] [-d]
~~脚本会将编译生成的`fabric-ca-server``fabric-ca-client`保存在`$GOPATH/bin`目录下。~~
* 此外,你还需要配置当前机器的`/etc/host`,内容参见`build/host.config`
* 将安装的**_链码_**复制到'setup'同级目录下。
如果你执行完上述,那么来启动`setup`吧!~😍
```bash
./setup-bootstrap.sh
sudo ./setup-bootstrap.sh
```
### 4. 启动orderer
### 四、启动Zookeeper 与 Kafka集群
```text
zk-kafka-bootstrap.sh <-z|-k> [-?] <ID>
-h|-? 获取此帮助信息
-z 启动zookeeper节点
-k 启动kafka节点
```
假设zookeeper与kafka个配置3台。那么启动脚本如下:
**启动Zookeeper**
```bash
./zk-kafka-bootstrap.sh -z 1
./zk-kafka-bootstrap.sh -z 2
./zk-kafka-bootstrap.sh -z 3
```
**启动Kafka**
```bash
./zk-kafka-bootstrap.sh -k 1
./zk-kafka-bootstrap.sh -k 2
./zk-kafka-bootstrap.sh -k 3
```
### 五、启动orderer
```text
orderer-bootstrap.sh [-h] [-?] <ORG> <NUM>
Expand All @@ -176,7 +186,7 @@ orderer-bootstrap.sh [-h] [-?] <ORG> <NUM>
./orderer-bootstrap.sh <ORG> <NUM>
```
### 5. 启动peer
### 六、启动peer
```text
peer-bootstrap.sh [-h] [-?] <ORG> <NUM>
Expand All @@ -189,13 +199,14 @@ peer-bootstrap.sh [-h] [-?] <ORG> <NUM>
./peer-bootstrap.sh <ORG> <NUM>
```
## TODO
## 版本历史
- orderer增加kafka集群
- 账本存储使用couchdb
### v1.1.1
## 版本历史
* 新增`expect`,免去手动输入密码的烦恼;
### v1.0.1
### v1.1.2
* 新增`expect`,免去手动输入密码的烦恼;
* 脚本自动分发到各个服务器
* orderer增加kafka集群
* 账本存储使用couchdb
94 changes: 70 additions & 24 deletions fabric-ca/fabric.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,90 +3,136 @@
"PEER_ORGS": "org1 org2",
"NUM_PEERS": 2,
"NUM_ORDERERS": 1,
"NUM_ZOOKEEPER": 3,
"NUM_KAFKA": 3,
"NET_CONFIG": {
"ZOOKEEPER_CLUSTER": [
{
"USER_NAME": "ubuntu",
"IP": "127.0.0.84",
"PATH": "~/fabric/zk",
"PWD": "***"
},
{
"USER_NAME": "ubuntu",
"IP": "127.0.0.85",
"PATH": "~/fabric/zk",
"PWD": "***"
},
{
"USER_NAME": "ubuntu",
"IP": "127.0.0.86",
"PATH": "~/fabric/zk",
"PWD": "***"
}
],
"KAFKA_CLUSTER": [
{
"USER_NAME": "ubuntu",
"IP": "127.0.0.87",
"PATH": "~/fabric/zk",
"PWD": "***"
},
{
"USER_NAME": "ubuntu",
"IP": "127.0.0.88",
"PATH": "~/fabric/zk",
"PWD": "***"
},
{
"USER_NAME": "ubuntu",
"IP": "127.0.0.89",
"PATH": "~/fabric/zk",
"PWD": "***"
}
],
"org0": {
"RCA": {
"USER_NAME": "ubuntu",
"IP": "120.131.13.90",
"IP": "127.0.0.90",
"PATH": "~/fabric/rca",
"PWD": "qwe123456"
"PWD": "***"
},
"ICA": {
"USER_NAME": "ubuntu",
"IP": "120.131.13.91",
"IP": "127.0.0.91",
"PATH": "~/fabric/ica",
"PWD": "qwe123456"
"PWD": "***"
},
"ORDERERS": [
{
"USER_NAME": "ubuntu",
"IP": "120.131.13.92",
"IP": "127.0.0.92",
"PATH": "~/fabric/orderer",
"PWD": "qwe123456"
"PWD": "***"
}
]
},
"org1": {
"RCA": {
"USER_NAME": "ubuntu",
"IP": "120.131.13.93",
"IP": "127.0.0.93",
"PATH": "~/fabric/rca",
"PWD": "qwe123456"
"PWD": "***"
},
"ICA": {
"USER_NAME": "ubuntu",
"IP": "120.131.13.94",
"IP": "127.0.0.94",
"PATH": "~/fabric/ica",
"PWD": "qwe123456"
"PWD": "***"
},
"PEERS": [
{
"USER_NAME": "ubuntu",
"IP": "120.131.13.95",
"IP": "127.0.0.95",
"PATH": "~/fabric/peer",
"PWD": "qwe123456"
"PWD": "***",
"COUCHDB_IP": "127.0.0.1"
},
{
"USER_NAME": "ubuntu",
"IP": "120.131.13.96",
"IP": "127.0.0.96",
"PATH": "~/fabric/peer",
"PWD": "qwe123456"
"PWD": "***",
"COUCHDB_IP": "127.0.0.1"
}
]
},
"org2": {
"RCA": {
"USER_NAME": "ubuntu",
"IP": "120.131.13.97",
"IP": "127.0.0.97",
"PATH": "~/fabric/rca",
"PWD": "qwe123456"
"PWD": "***"
},
"ICA": {
"USER_NAME": "ubuntu",
"IP": "120.131.13.98",
"IP": "127.0.0.98",
"PATH": "~/fabric/ica",
"PWD": "qwe123456"
"PWD": "***"
},
"PEERS": [
{
"USER_NAME": "ubuntu",
"IP": "120.131.13.99",
"IP": "127.0.0.99",
"PATH": "~/fabric/peer",
"PWD": "qwe123456"
"PWD": "***",
"COUCHDB_IP": "127.0.0.1"
},
{
"USER_NAME": "ubuntu",
"IP": "120.131.13.100",
"IP": "127.0.0.100",
"PATH": "~/fabric/peer",
"PWD": "qwe123456"
"PWD": "***",
"COUCHDB_IP": "127.0.0.1"
}
]
},
"SETUP": {
"USER_NAME": "ubuntu",
"IP": "120.131.13.101",
"IP": "127.0.0.95",
"PATH": "~/fabric/setup",
"PWD": "qwe123456"
"PWD": "***"
}
}
}
Loading

0 comments on commit be73c54

Please sign in to comment.