mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-22 01:25:10 +00:00
[FAB-16132] Remove Kafka consensus from BYFN
Remove Kafka as a consensus mechanism option in BYFN, including all related configuration. Users wishing to configure Kafka (not best practice) in Fabric v2.0 can consult the Fabric v1.4 and earlier samples. Signed-off-by: Simon Stone <sstone1@uk.ibm.com> Change-Id: I3bbffc876a6b64831cb6b2bdfac28a88cc013bdf
This commit is contained in:
parent
3996db59dc
commit
b62d5bd77b
6 changed files with 7 additions and 100 deletions
|
|
@ -7,7 +7,7 @@ FAB_IMAGES_LIST=ca peer orderer ccenv tools baseos nodeenv javaenv
|
||||||
# Set fabric if you would like pull only fabric binaries
|
# Set fabric if you would like pull only fabric binaries
|
||||||
FAB_BINARY_REPO=fabric fabric-ca
|
FAB_BINARY_REPO=fabric fabric-ca
|
||||||
# Pull below list of images from Hyperledger DockerHub
|
# Pull below list of images from Hyperledger DockerHub
|
||||||
FAB_THIRDPARTY_IMAGES_LIST=kafka zookeeper couchdb
|
FAB_THIRDPARTY_IMAGES_LIST=couchdb
|
||||||
# Pull latest binaries of latest commit of release-1.4 from nexus snapshots
|
# Pull latest binaries of latest commit of release-1.4 from nexus snapshots
|
||||||
# Applicable only when set IMAGE_SOURCE to "nexus"
|
# Applicable only when set IMAGE_SOURCE to "nexus"
|
||||||
FAB_BINARY_VER=latest
|
FAB_BINARY_VER=latest
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,6 @@ services:
|
||||||
- ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key
|
- ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key
|
||||||
- ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt
|
- ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt
|
||||||
- ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
|
- ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
|
||||||
- ORDERER_KAFKA_TOPIC_REPLICATIONFACTOR=1
|
|
||||||
- ORDERER_KAFKA_VERBOSE=true
|
|
||||||
- ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt
|
- ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt
|
||||||
- ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key
|
- ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key
|
||||||
- ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
|
- ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ function printHelp() {
|
||||||
echo " -f <docker-compose-file> - specify which docker-compose file use (defaults to docker-compose-cli.yaml)"
|
echo " -f <docker-compose-file> - specify which docker-compose file use (defaults to docker-compose-cli.yaml)"
|
||||||
echo " -s <dbtype> - the database backend to use: goleveldb (default) or couchdb"
|
echo " -s <dbtype> - the database backend to use: goleveldb (default) or couchdb"
|
||||||
echo " -l <language> - the programming language of the chaincode to deploy: go (default), javascript, or java"
|
echo " -l <language> - the programming language of the chaincode to deploy: go (default), javascript, or java"
|
||||||
echo " -o <consensus-type> - the consensus-type of the ordering service: solo (default), kafka, or etcdraft"
|
echo " -o <consensus-type> - the consensus-type of the ordering service: solo (default) or etcdraft"
|
||||||
echo " -i <imagetag> - the tag to be used to launch the network (defaults to \"latest\")"
|
echo " -i <imagetag> - the tag to be used to launch the network (defaults to \"latest\")"
|
||||||
echo " -a - launch certificate authorities (no certificate authorities are launched by default)"
|
echo " -a - launch certificate authorities (no certificate authorities are launched by default)"
|
||||||
echo " -n - do not deploy chaincode (abstore chaincode is deployed by default)"
|
echo " -n - do not deploy chaincode (abstore chaincode is deployed by default)"
|
||||||
|
|
@ -164,9 +164,7 @@ function networkUp() {
|
||||||
export BYFN_CA1_PRIVATE_KEY=$(cd crypto-config/peerOrganizations/org1.example.com/ca && ls *_sk)
|
export BYFN_CA1_PRIVATE_KEY=$(cd crypto-config/peerOrganizations/org1.example.com/ca && ls *_sk)
|
||||||
export BYFN_CA2_PRIVATE_KEY=$(cd crypto-config/peerOrganizations/org2.example.com/ca && ls *_sk)
|
export BYFN_CA2_PRIVATE_KEY=$(cd crypto-config/peerOrganizations/org2.example.com/ca && ls *_sk)
|
||||||
fi
|
fi
|
||||||
if [ "${CONSENSUS_TYPE}" == "kafka" ]; then
|
if [ "${CONSENSUS_TYPE}" == "etcdraft" ]; then
|
||||||
COMPOSE_FILES="${COMPOSE_FILES} -f ${COMPOSE_FILE_KAFKA}"
|
|
||||||
elif [ "${CONSENSUS_TYPE}" == "etcdraft" ]; then
|
|
||||||
COMPOSE_FILES="${COMPOSE_FILES} -f ${COMPOSE_FILE_RAFT2}"
|
COMPOSE_FILES="${COMPOSE_FILES} -f ${COMPOSE_FILE_RAFT2}"
|
||||||
fi
|
fi
|
||||||
if [ "${IF_COUCHDB}" == "couchdb" ]; then
|
if [ "${IF_COUCHDB}" == "couchdb" ]; then
|
||||||
|
|
@ -179,12 +177,6 @@ function networkUp() {
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$CONSENSUS_TYPE" == "kafka" ]; then
|
|
||||||
sleep 1
|
|
||||||
echo "Sleeping 10s to allow $CONSENSUS_TYPE cluster to complete booting"
|
|
||||||
sleep 9
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$CONSENSUS_TYPE" == "etcdraft" ]; then
|
if [ "$CONSENSUS_TYPE" == "etcdraft" ]; then
|
||||||
sleep 1
|
sleep 1
|
||||||
echo "Sleeping 15s to allow $CONSENSUS_TYPE cluster to complete booting"
|
echo "Sleeping 15s to allow $CONSENSUS_TYPE cluster to complete booting"
|
||||||
|
|
@ -222,9 +214,7 @@ function upgradeNetwork() {
|
||||||
export BYFN_CA1_PRIVATE_KEY=$(cd crypto-config/peerOrganizations/org1.example.com/ca && ls *_sk)
|
export BYFN_CA1_PRIVATE_KEY=$(cd crypto-config/peerOrganizations/org1.example.com/ca && ls *_sk)
|
||||||
export BYFN_CA2_PRIVATE_KEY=$(cd crypto-config/peerOrganizations/org2.example.com/ca && ls *_sk)
|
export BYFN_CA2_PRIVATE_KEY=$(cd crypto-config/peerOrganizations/org2.example.com/ca && ls *_sk)
|
||||||
fi
|
fi
|
||||||
if [ "${CONSENSUS_TYPE}" == "kafka" ]; then
|
if [ "${CONSENSUS_TYPE}" == "etcdraft" ]; then
|
||||||
COMPOSE_FILES="${COMPOSE_FILES} -f ${COMPOSE_FILE_KAFKA}"
|
|
||||||
elif [ "${CONSENSUS_TYPE}" == "etcdraft" ]; then
|
|
||||||
COMPOSE_FILES="${COMPOSE_FILES} -f ${COMPOSE_FILE_RAFT2}"
|
COMPOSE_FILES="${COMPOSE_FILES} -f ${COMPOSE_FILE_RAFT2}"
|
||||||
fi
|
fi
|
||||||
if [ "${IF_COUCHDB}" == "couchdb" ]; then
|
if [ "${IF_COUCHDB}" == "couchdb" ]; then
|
||||||
|
|
@ -274,8 +264,7 @@ function upgradeNetwork() {
|
||||||
# Tear down running network
|
# Tear down running network
|
||||||
function networkDown() {
|
function networkDown() {
|
||||||
# stop org3 containers also in addition to org1 and org2, in case we were running sample to add org3
|
# stop org3 containers also in addition to org1 and org2, in case we were running sample to add org3
|
||||||
# stop kafka and zookeeper containers in case we're running with kafka consensus-type
|
docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_COUCH -f $COMPOSE_FILE_RAFT2 -f $COMPOSE_FILE_CA -f $COMPOSE_FILE_ORG3 down --volumes --remove-orphans
|
||||||
docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_COUCH -f $COMPOSE_FILE_KAFKA -f $COMPOSE_FILE_RAFT2 -f $COMPOSE_FILE_CA -f $COMPOSE_FILE_ORG3 down --volumes --remove-orphans
|
|
||||||
|
|
||||||
# Don't remove the generated artifacts -- note, the ledgers are always removed
|
# Don't remove the generated artifacts -- note, the ledgers are always removed
|
||||||
if [ "$MODE" != "restart" ]; then
|
if [ "$MODE" != "restart" ]; then
|
||||||
|
|
@ -425,8 +414,6 @@ function generateChannelArtifacts() {
|
||||||
set -x
|
set -x
|
||||||
if [ "$CONSENSUS_TYPE" == "solo" ]; then
|
if [ "$CONSENSUS_TYPE" == "solo" ]; then
|
||||||
configtxgen -profile TwoOrgsOrdererGenesis -channelID byfn-sys-channel -outputBlock ./channel-artifacts/genesis.block
|
configtxgen -profile TwoOrgsOrdererGenesis -channelID byfn-sys-channel -outputBlock ./channel-artifacts/genesis.block
|
||||||
elif [ "$CONSENSUS_TYPE" == "kafka" ]; then
|
|
||||||
configtxgen -profile SampleDevModeKafka -channelID byfn-sys-channel -outputBlock ./channel-artifacts/genesis.block
|
|
||||||
elif [ "$CONSENSUS_TYPE" == "etcdraft" ]; then
|
elif [ "$CONSENSUS_TYPE" == "etcdraft" ]; then
|
||||||
configtxgen -profile SampleMultiNodeEtcdRaft -channelID byfn-sys-channel -outputBlock ./channel-artifacts/genesis.block
|
configtxgen -profile SampleMultiNodeEtcdRaft -channelID byfn-sys-channel -outputBlock ./channel-artifacts/genesis.block
|
||||||
else
|
else
|
||||||
|
|
@ -495,8 +482,6 @@ COMPOSE_FILE=docker-compose-cli.yaml
|
||||||
COMPOSE_FILE_COUCH=docker-compose-couch.yaml
|
COMPOSE_FILE_COUCH=docker-compose-couch.yaml
|
||||||
# org3 docker compose file
|
# org3 docker compose file
|
||||||
COMPOSE_FILE_ORG3=docker-compose-org3.yaml
|
COMPOSE_FILE_ORG3=docker-compose-org3.yaml
|
||||||
# kafka and zookeeper compose file
|
|
||||||
COMPOSE_FILE_KAFKA=docker-compose-kafka.yaml
|
|
||||||
# two additional etcd/raft orderers
|
# two additional etcd/raft orderers
|
||||||
COMPOSE_FILE_RAFT2=docker-compose-etcdraft2.yaml
|
COMPOSE_FILE_RAFT2=docker-compose-etcdraft2.yaml
|
||||||
# certificate authorities compose file
|
# certificate authorities compose file
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,7 @@ Application: &ApplicationDefaults
|
||||||
Orderer: &OrdererDefaults
|
Orderer: &OrdererDefaults
|
||||||
|
|
||||||
# Orderer Type: The orderer implementation to start
|
# Orderer Type: The orderer implementation to start
|
||||||
# Available types are "solo" and "kafka"
|
# Available types are "solo" and "etcdraft"
|
||||||
OrdererType: solo
|
OrdererType: solo
|
||||||
|
|
||||||
Addresses:
|
Addresses:
|
||||||
|
|
@ -244,12 +244,6 @@ Orderer: &OrdererDefaults
|
||||||
# max bytes will result in a batch larger than preferred max bytes.
|
# max bytes will result in a batch larger than preferred max bytes.
|
||||||
PreferredMaxBytes: 512 KB
|
PreferredMaxBytes: 512 KB
|
||||||
|
|
||||||
Kafka:
|
|
||||||
# Brokers: A list of Kafka brokers to which the orderer connects
|
|
||||||
# NOTE: Use IP:port notation
|
|
||||||
Brokers:
|
|
||||||
- 127.0.0.1:9092
|
|
||||||
|
|
||||||
# Organizations is the list of orgs which are defined as participants on
|
# Organizations is the list of orgs which are defined as participants on
|
||||||
# the orderer side of the network
|
# the orderer side of the network
|
||||||
Organizations:
|
Organizations:
|
||||||
|
|
@ -339,31 +333,6 @@ Profiles:
|
||||||
Capabilities:
|
Capabilities:
|
||||||
<<: *ApplicationCapabilities
|
<<: *ApplicationCapabilities
|
||||||
|
|
||||||
SampleDevModeKafka:
|
|
||||||
<<: *ChannelDefaults
|
|
||||||
Capabilities:
|
|
||||||
<<: *ChannelCapabilities
|
|
||||||
Orderer:
|
|
||||||
<<: *OrdererDefaults
|
|
||||||
OrdererType: kafka
|
|
||||||
Kafka:
|
|
||||||
Brokers:
|
|
||||||
- kafka.example.com:9092
|
|
||||||
|
|
||||||
Organizations:
|
|
||||||
- *OrdererOrg
|
|
||||||
Capabilities:
|
|
||||||
<<: *OrdererCapabilities
|
|
||||||
Application:
|
|
||||||
<<: *ApplicationDefaults
|
|
||||||
Organizations:
|
|
||||||
- <<: *OrdererOrg
|
|
||||||
Consortiums:
|
|
||||||
SampleConsortium:
|
|
||||||
Organizations:
|
|
||||||
- *Org1
|
|
||||||
- *Org2
|
|
||||||
|
|
||||||
SampleMultiNodeEtcdRaft:
|
SampleMultiNodeEtcdRaft:
|
||||||
<<: *ChannelDefaults
|
<<: *ChannelDefaults
|
||||||
Capabilities:
|
Capabilities:
|
||||||
|
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
# 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'
|
|
||||||
|
|
||||||
networks:
|
|
||||||
byfn:
|
|
||||||
|
|
||||||
services:
|
|
||||||
zookeeper.example.com:
|
|
||||||
container_name: zookeeper.example.com
|
|
||||||
image: hyperledger/fabric-zookeeper:$IMAGE_TAG
|
|
||||||
environment:
|
|
||||||
ZOOKEEPER_CLIENT_PORT: 32181
|
|
||||||
ZOOKEEPER_TICK_TIME: 2000
|
|
||||||
networks:
|
|
||||||
- byfn
|
|
||||||
|
|
||||||
kafka.example.com:
|
|
||||||
container_name: kafka.example.com
|
|
||||||
image: hyperledger/fabric-kafka:$IMAGE_TAG
|
|
||||||
depends_on:
|
|
||||||
- zookeeper.example.com
|
|
||||||
environment:
|
|
||||||
- KAFKA_BROKER_ID=1
|
|
||||||
- KAFKA_ZOOKEEPER_CONNECT=zookeeper.example.com:2181
|
|
||||||
- KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://kafka.example.com:9092
|
|
||||||
- KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1
|
|
||||||
- KAFKA_MESSAGE_MAX_BYTES=1048576 # 1 * 1024 * 1024 B
|
|
||||||
- KAFKA_REPLICA_FETCH_MAX_BYTES=1048576 # 1 * 1024 * 1024 B
|
|
||||||
- KAFKA_UNCLEAN_LEADER_ELECTION_ENABLE=false
|
|
||||||
- KAFKA_LOG_RETENTION_MS=-1
|
|
||||||
- KAFKA_MIN_INSYNC_REPLICAS=1
|
|
||||||
- KAFKA_DEFAULT_REPLICATION_FACTOR=1
|
|
||||||
networks:
|
|
||||||
- byfn
|
|
||||||
|
|
@ -127,7 +127,7 @@ function networkUp () {
|
||||||
|
|
||||||
# Tear down running network
|
# Tear down running network
|
||||||
function networkDown () {
|
function networkDown () {
|
||||||
docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_KAFKA -f $COMPOSE_FILE_RAFT2 -f $COMPOSE_FILE_ORG3 -f $COMPOSE_FILE_COUCH down --volumes --remove-orphans
|
docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_RAFT2 -f $COMPOSE_FILE_ORG3 -f $COMPOSE_FILE_COUCH down --volumes --remove-orphans
|
||||||
# Don't remove containers, images, etc if restarting
|
# Don't remove containers, images, etc if restarting
|
||||||
if [ "$MODE" != "restart" ]; then
|
if [ "$MODE" != "restart" ]; then
|
||||||
#Cleanup the chaincode containers
|
#Cleanup the chaincode containers
|
||||||
|
|
@ -233,8 +233,6 @@ COMPOSE_FILE_COUCH=docker-compose-couch.yaml
|
||||||
COMPOSE_FILE_ORG3=docker-compose-org3.yaml
|
COMPOSE_FILE_ORG3=docker-compose-org3.yaml
|
||||||
#
|
#
|
||||||
COMPOSE_FILE_COUCH_ORG3=docker-compose-couch-org3.yaml
|
COMPOSE_FILE_COUCH_ORG3=docker-compose-couch-org3.yaml
|
||||||
# kafka and zookeeper compose file
|
|
||||||
COMPOSE_FILE_KAFKA=docker-compose-kafka.yaml
|
|
||||||
# two additional etcd/raft orderers
|
# two additional etcd/raft orderers
|
||||||
COMPOSE_FILE_RAFT2=docker-compose-etcdraft2.yaml
|
COMPOSE_FILE_RAFT2=docker-compose-etcdraft2.yaml
|
||||||
# use go as the default language for chaincode
|
# use go as the default language for chaincode
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue