티스토리 뷰

반응형

해당 글은 Hyperledger Fabric 페이지의 게시글을 번역 및 정리한 자료입니다.

원본 사이트 : http://hyperledger-fabric.readthedocs.io/en/release-1.1/commands/configtxlator.html


Description

configtxlator 명령을 사용하여 사용자는 protobuf와 JSON 버전의 fabric 데이터 구조 사이를 변환하고 구성 업데이트를 만들 수 있습니다. 이 명령은 REST서버를 시작하여 HTTP를 통해 해당 기능을 표시하거나 명령줄 도구로 직접 사용할 수 있습니다.


Syntax

configtxlator는 4개의 하위 명령이 있습니다.

configtxlator start

REST 서버를 시작합니다.

usage: configtxlator start [<flags>]

Start the configtxlator REST server

Flags:
  --help                Show context-sensitive help (also try --help-long and --help-man).
  --hostname="0.0.0.0"  The hostname or IP on which the REST server will listen
  --port=7059           The port on which the REST server will listen

configtxlator proto_encode

JSON 문서를 protobuf 메시지로 변환합니다.

usage: configtxlator proto_encode --type=TYPE [<flags>]

Converts a JSON document to protobuf.

Flags:
  --help                Show context-sensitive help (also try --help-long and --help-man).
  --type=TYPE           The type of protobuf structure to encode to. For example, 'common.Config'.
  --input=/dev/stdin    A file containing the JSON document.
  --output=/dev/stdout  A file to write the output to.

configtxlator proto_decode

protobuf 메시지를 JSON 문서로 변환합니다.

usage: configtxlator proto_decode --type=TYPE [<flags>]

Converts a proto message to JSON.

Flags:
  --help                Show context-sensitive help (also try --help-long and --help-man).
  --type=TYPE           The type of protobuf structure to decode from. For example, 'common.Config'.
  --input=/dev/stdin    A file containing the proto message.
  --output=/dev/stdout  A file to write the JSON document to.

configtxlator compute_update

기존 config와 수정된 config에 기반하여 config 업데이트를 계산합니다.

usage: configtxlator compute_update --channel_id=CHANNEL_ID [<flags>]

Takes two marshaled common.Config messages and computes the config update which transitions between the two.

Flags:
  --help                   Show context-sensitive help (also try --help-long and --help-man).
  --original=ORIGINAL      The original config message.
  --updated=UPDATED        The updated config message.
  --channel_id=CHANNEL_ID  The name of the channel for this update.
  --output=/dev/stdout     A file to write the JSON document to.

configtxlator version

버전을 표시합니다.

usage: configtxlator version

Show version information

Flags:
  --help  Show context-sensitive help (also try --help-long and --help-man).


Examples

Decoding

fabric_block.c블록을 JSON으로 디코딩하고 stdout에 인쇄하십시오.

configtxlator proto_decode --input fabric_block.pb --type common.Block

또는 REST서버를 시작한 후 다음 벤딩 명령이 REST API를 통해 동일한 작업을 수행합니다.

curl -X POST --data-binary @fabric_block.pb "${CONFIGTXLATOR_URL}/protolator/decode/common.Block"

Ending

정책에 대한 JSON문서를 stdin에서 policy.snmp라는 파일로 변환합니다.

configtxlator proto_encode --type common.Policy --output policy.pb

또는 REST서버를 시작한 후 다음 벤딩 명령이 REST API를 통해 동일한 작업을 수행합니다.

curl -X POST --data-binary /dev/stdin "${CONFIGTXLATOR_URL}/protolator/encode/common.Policy" > policy.pb

Pipelines

original_config.pbmodified_config.pb의 config 업데이트를 계산하여 JSON에 맞게 stdout에 디코딩 합니다.

configtxlator compute_update --channel_id testchan --original original_config.pb --updated modified_config.pb | configtxlator proto_decode --type common.ConfigUpdate

또는 REST서버를 시작한 후 다음 벤딩 명령이 REST API를 통해 동일한 작업을 수행합니다.

curl -X POST -F channel=testchan -F "original=@original_config.pb" -F "updated=@modified_config.pb" "${CONFIGTXLATOR_URL}/configtxlator/compute/update-from-configs" | curl -X POST --data-binary /dev/stdin "${CONFIGTXLATOR_URL}/protolator/encode/common.ConfigUpdate"

도구 이름은 configtx 및 translator 의 portmanteau이며 도구가 단순히 다른 동등한 데이터 표현 사이에서 변환된다는 것을 전달하기 위한 것이다. 구성을 생성하지 않습니다. configuration을 제출하거나 검색하지 않습니다. 구성 자체를 수정하지 않고, configtx 형식의 다른 보기 사이에서 일부 임의 작업만 제공할 뿐입니다.

configtxlatorREST 서버에 포함 된 구성 파일 이나 인증 또는 권한 부여 기능 은 없습니다. config.lator는 민감한 데이터, 주요 정보 또는 기타 정보에 대한 액세스 권한이 없기 때문에 서버 소유자가 다른 클라이언트에 노출될 위험이 없습니다. 그러나 사용자가 REST 서버로 보낸 데이터는 기밀 일 수 있으므로 사용자는 서버 관리자를 신뢰하거나 로컬 인스턴스를 실행하거나 CLI를 통해 작동해야합니다.

반응형
댓글
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함