修改configtx.yaml
配置文件
在SampleDevModeKafka
下增加kafka
的broker
节点,我增加后的内容如下
SampleDevModeKafka:
<<: *ChannelDefaults
Capabilities:
<<: *ChannelCapabilities
Orderer:
<<: *OrdererDefaults
OrdererType: kafka
Kafka:
Brokers:
- kafka1.example.com:9082
- kafka2.example.com:9083
- kafka3.example.com:9084
Organizations:
- *OrdererOrg
Capabilities:
<<: *OrdererCapabilities
Application:
<<: *ApplicationDefaults
Organizations:
- <<: *OrdererOrg
Consortiums:
SampleConsortium:
Organizations:
- *Org1
- *Org2
生成通道的创世区块
将原来solo
共识的命令改为如下命令
configtxgen -profile SampleDevModeKafka -channelID kafka-channel -outputBlock ./channel-artifacts/genesis.block
docker-compose-kafka.yaml
新建docker-compose-kafka.yaml
文件,内容如下:
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
# NOTE: This is not the way a Kafka cluster would normally be deployed in production, as it is not secure
# and is not fault tolerant. This example is a toy deployment that is only meant to exercise the Kafka code path
# of the ordering service.
version: '2'
services:
zookeeper1.example.com:
container_name: zookeeper1.example.com
hostname