하이퍼레저v1.4 멀티 채널2 (1부)

min71·2021년 8월 11일
0

하이퍼레저

목록 보기
5/12
post-thumbnail

> 네트워크 구조

  • Org1, Org2, Org3 3개의 그룹 생성 (서로 다른 머신에 존재)
  • 각 조직별로 1개의 피어노드 존재
  • Org1, Org2, Org3가 참여하는 채널1 생성
  • Org1, Org2 만 참여하는 채널2 생성

하이퍼레저 패브릭 1.4 설치

1. 소스 다운로드

curl -sSL http://bit.ly/2ysbOFE | bash -s -- 1.4.12 1.4.9 0.4.22
export PATH=/home/hyperledger/fabric-samples/bin:$PATH

- orderer.example.com

2. 인증파일, 네트워크 아티팩트 생성

- orderer.example.com

cd fabric-samples
mkdir 3node2channel && cd 3node2channel
mkdir channel-artifacts
mkdir deployment

2-1. crypto-config.yaml, configtx.yaml 생성

- orderer.example.com

# crypto-config.yaml 파일 생성

# configtx.yaml 파일 생성

2-2. 아티팩트 생성

- orderer.example.com

# 암호자료 생성
../bin/cryptogen generate --config=./crypto-config.yaml

# 제네시스 블록 생성
export FABRIC_CFG_PATH=$PWD
../bin/configtxgen -profile ThreeOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block

# 채널 설정 블록 생성
../bin/configtxgen -profile Channel1 -outputCreateChannelTx ./channel-artifacts/channel1.tx -channelID channel1
../bin/configtxgen -profile Channel2 -outputCreateChannelTx ./channel-artifacts/channel2.tx -channelID channel2

3. 도커파일 생성

- orderer.example.com

3-1. docker-compose-base.yml

오더러와 피어의 베이스, 다른 도커파일에서 참조하는 파일
deployment 디렉터리에 내부에 생성

3-2. docker-compose-orderer.yml

오더러 노드를 위한 도커파일

다른 노드의 아이피를 명시하는 extra hosts라는 엔트리가 있다.
이 엔트리는 컨테이너의 /etc/hosts안에 설정될 것이다.

3-3. docker-compose-node#.yml

Org1, Org2, Org3의 노드를 위한 도커파일
deployment 디렉터리에 내부에 생성

  • docker-compose-node1.yml

  • docker-compose-node2.yml

  • docker-compose-node3.yml

4. 모든 노드에게 3node2channel 디렉터리 업로드

- orderer.example.com

4-1. 3node2channel 디렉터리 압축

# fabric-samples directory
tar cf 3node2channel.tar 3node2channel/

4-2. 모든 노드에게 3node2channel.tar 전송

# update to all nodes (use your own key file and public IP addresses)
scp 3node2channel.tar hyperledger@192.168.2.101:~/fabric-samples/
scp 3node2channel.tar hyperledger@192.168.2.102:~/fabric-samples/
scp 3node2channel.tar hyperledger@192.168.2.103:~/fabric-samples/

4-3. 모든 노드에서 3node2channel.tar 압축해제

# in fabric-samples
tar xf 3node2channel.tar
cd 3node2channel/deployment

4-4. 모든 노드에서 컨테이너 실행

- orderer.example.com

docker-compose -f docker-compose-orderer.yml up -d
docker ps

- peer0.org1.example.com

docker-compose -f docker-compose-node1.yml up -d
docker ps

- peer0.org2.example.com

docker-compose -f docker-compose-node2.yml up -d
docker ps

- peer0.org3.example.com

docker-compose -f docker-compose-node3.yml up -d
docker ps

Hits

profile
한 줄 소개

0개의 댓글

관련 채용 정보