오류 상황
Hyperledger Fabric Network를 구축하고 'COMPOSE_PROJECT_NAME=net docker-compsoe up -d' 명령어를 통해 도커 컨테이너를 실행시키는 과정에서 Orderer가 계속 꺼지는 상황이 발생했다.
백그라운드에서 실행하지 않고 로그를 정상동작하는 도커컨에티너와 비교해본 결과 Orderer에 TLS가 계속 Warning이 나면서 일정시간이 지나면 Orderer가 종료되었다.
오류 원인
오류원인이 정확하지는 않지만 이전에 다른 Hyperledger Fabric 네트워크를 돌려놓고 컨테이너를 종료한 상태에서 Fabric Network의 이름과 Docker-Compose.yaml파일의 Peer들의 env중 'CORE_VM_DOCKER_HOSTCONFIT_NETWORKMODE'를 새로운 이름으로 바꿔서 실행했더니 문제없이 해결이 됐다.
이전에 사용했던 네트워크와 이름이 겹쳐서 문제였는지 정확한 이유는 모르겠으나 새로운 네트워크 이름으로 실행시키니 무리없이 컨테이너가 켜지고 블록과 채널을 생성하는데에 문제없었다.
# Docker-Compose.yaml파일내용
version: '2'
volumes:
orderer.example.com:
peer0.corp1.example.com:
peer0.corp2.example.com:
peer0.agency.example.com:
networks:
test3:
services:
orderer.example.com:
container_name: orderer.example.com
image: hyperledger/fabric-orderer:2.2
environment:
- FABRIC_LOGGING_SPEC=INFO
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
- ORDERER_GENERAL_LISTENPORT=7050
- ORDERER_GENERAL_GENESISMETHOD=file
- ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block
- ORDERER_GENERAL_LOCALMSPID=OrdererMSP
- ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
# enabled TLS
- ORDERER_GENERAL_TLS_ENABLED=true
- ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key
- ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt
- ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
- ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt
- ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key
- ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
working_dir: /opt/gopath/src/github.com/hyperledger/fabric
command: orderer
volumes:
- ../system-genesis-block/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
- ../organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp
- ../organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/:/var/hyperledger/orderer/tls
- orderer.example.com:/var/hyperledger/production/orderer
ports:
- 7050:7050
networks:
- test3
peer0.agency.example.com:
container_name: peer0.agency.example.com
image: hyperledger/fabric-peer:2.2
environment:
#Generic peer variables
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=anet_test3
- FABRIC_LOGGING_SPEC=INFO
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_PROFILE_ENABLED=true
- CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
# Peer specific variabes
- CORE_PEER_ID=peer0.agency.example.com
- CORE_PEER_ADDRESS=peer0.agency.example.com:10051
- CORE_PEER_LISTENADDRESS=0.0.0.0:10051
- CORE_PEER_CHAINCODEADDRESS=peer0.agency.example.com:10052
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:10052
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.agency.example.com:10051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.agency.example.com:10051
- CORE_PEER_LOCALMSPID=agencyMSP
volumes:
- /var/run/docker.sock:/host/var/run/docker.sock
- ../organizations/peerOrganizations/agency.example.com/peers/peer0.agency.example.com/msp:/etc/hyperledger/fabric/msp
- ../organizations/peerOrganizations/agency.example.com/peers/peer0.agency.example.com/tls:/etc/hyperledger/fabric/tls
- peer0.agency.example.com:/var/hyperledger/production
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: peer node start
ports:
- 10051:10051
networks:
- test3
해결 방법
Fabric network의 이름을 원하는 이름으로 변경('여기선 test3' 으로 지정)
CORE_VM_DOCKER_HOSTCONFIT_NETWORKMODE='{도커이름}_{패브릭 네트워크이름}'
peer0.agency.example.com:
container_name: peer0.agency.example.com
image: hyperledger/fabric-peer:2.2
environment:
#Generic peer variables
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
# NETWORKMODE를 anet_test3으로 변경
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=anet_test3
- FABRIC_LOGGING_SPEC=INFO
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_PROFILE_ENABLED=true
- CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
# Peer specific variabes
- CORE_PEER_ID=peer0.agency.example.com
- CORE_PEER_ADDRESS=peer0.agency.example.com:10051
- CORE_PEER_LISTENADDRESS=0.0.0.0:10051
- CORE_PEER_CHAINCODEADDRESS=peer0.agency.example.com:10052
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:10052
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.agency.example.com:10051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.agency.example.com:10051
- CORE_PEER_LOCALMSPID=agencyMSP
volumes:
- /var/run/docker.sock:/host/var/run/docker.sock
- ../organizations/peerOrganizations/agency.example.com/peers/peer0.agency.example.com/msp:/etc/hyperledger/fabric/msp
- ../organizations/peerOrganizations/agency.example.com/peers/peer0.agency.example.com/tls:/etc/hyperledger/fabric/tls
- peer0.agency.example.com:/var/hyperledger/production
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: peer node start
ports:
- 10051:10051
networks:
- test3
docker-compose.yaml 디렉토리가 있는 경로이동 후
'anet'부분을 지정한 '도커이름' 으로 변경 후 컨테이너 실행
COMPOSE_PEOJECT_NAME=anet docker-compose up -d
'보안 및 블록체인 > 블록체인' 카테고리의 다른 글
하이퍼레저 패브릭(Hyperledger Fabric) v2.2 - 체인코드 go.mod 설정 (0) | 2022.08.04 |
---|---|
하이퍼레저 패브릭(Hyperledger Fabric) v2.2 - but chaincode is not installed 에러 (0) | 2022.08.04 |
하이퍼레저 패브릭(Hyperledger Fabric) v2.2 - 채널에 Org 추가 (0) | 2022.07.16 |
하이퍼레저 패브릭(Hyperledger Fabric) v2.2 - #3 Docker-compose.yaml 네트워크 설정 & 채널생성 (0) | 2022.07.13 |
하이퍼레저 패브릭(Hyperledger Fabric) v2.2 - #1 Peer 키생성 - Cryptogen (0) | 2022.07.12 |