适当配置Kubernetes中的Fabric Peers

时间:2017-10-10 21:03:28

标签: kubernetes hyperledger-fabric hyperledger-composer

我正在尝试将Fabric配置为在Kubernetes集群内部工作,虽然我已经站起来了,但我正在使用difficulting将链代码(使用composer-cli)部署到网络中。看起来链代码容器无法看到创建它们的对等方。

2017-10-10 20:51:12.590 UTC [ccprovider] NewCCContext -> DEBU 437 NewCCCC (chain=lynnhurst,chaincode=lynnhurst-composer,version=0.13.2,txid=14cc34b63f20838b904116a03d39fba2a0eabf8ab7076f51982c746a17c667f1,syscc=false,proposal=0xc42195c0f0,canname=lynnhurst-composer:0.13.2
2017-10-10 20:51:12.605 UTC [chaincode] Launch -> DEBU 438 launchAndWaitForRegister fetched 2902002 bytes from file system
2017-10-10 20:51:12.605 UTC [chaincode] launchAndWaitForRegister -> DEBU 439 chaincode lynnhurst-composer:0.13.2 is being launched
2017-10-10 20:51:12.605 UTC [chaincode] getArgsAndEnv -> DEBU 43a Executable is chaincode
2017-10-10 20:51:12.605 UTC [chaincode] getArgsAndEnv -> DEBU 43b Args [chaincode -peer.address=peer-0.peer:7052]
2017-10-10 20:51:12.605 UTC [chaincode] launchAndWaitForRegister -> DEBU 43c start container: lynnhurst-composer:0.13.2(networkid:dev,peerid:peer-0.peer)
2017-10-10 20:51:12.605 UTC [chaincode] launchAndWaitForRegister -> DEBU 43d start container with args: chaincode -peer.address=peer-0.peer:7052
2017-10-10 20:51:12.605 UTC [chaincode] launchAndWaitForRegister -> DEBU 43e start container with env:
    CORE_CHAINCODE_ID_NAME=lynnhurst-composer:0.13.2
    CORE_PEER_TLS_ENABLED=true
    CORE_CHAINCODE_LOGGING_LEVEL=info
    CORE_CHAINCODE_LOGGING_SHIM=warning
    CORE_CHAINCODE_LOGGING_FORMAT=%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}
2017-10-10 20:51:12.605 UTC [container] lockContainer -> DEBU 43f waiting for container(dev-peer-0.peer-lynnhurst-composer-0.13.2) lock
2017-10-10 20:51:12.605 UTC [container] lockContainer -> DEBU 440 got container (dev-peer-0.peer-lynnhurst-composer-0.13.2) lock
2017-10-10 20:51:12.606 UTC [dockercontroller] Start -> DEBU 441 Cleanup container dev-peer-0.peer-lynnhurst-composer-0.13.2
2017-10-10 20:51:12.607 UTC [dockercontroller] stopInternal -> DEBU 442 Stop container dev-peer-0.peer-lynnhurst-composer-0.13.2(No such container: dev-peer-0.peer-lynnhurst-composer-0.13.2)
2017-10-10 20:51:12.608 UTC [dockercontroller] stopInternal -> DEBU 443 Kill container dev-peer-0.peer-lynnhurst-composer-0.13.2 (No such container: dev-peer-0.peer-lynnhurst-composer-0.13.2)
2017-10-10 20:51:12.609 UTC [dockercontroller] stopInternal -> DEBU 444 Remove container dev-peer-0.peer-lynnhurst-composer-0.13.2 (No such container: dev-peer-0.peer-lynnhurst-composer-0.13.2)
2017-10-10 20:51:12.609 UTC [dockercontroller] Start -> DEBU 445 Start container dev-peer-0.peer-lynnhurst-composer-0.13.2
2017-10-10 20:51:12.609 UTC [dockercontroller] getDockerHostConfig -> DEBU 446 docker container hostconfig NetworkMode: bridge
2017-10-10 20:51:12.610 UTC [dockercontroller] createContainer -> DEBU 447 Create container: dev-peer-0.peer-lynnhurst-composer-0.13.2
2017-10-10 20:51:12.648 UTC [dockercontroller] createContainer -> DEBU 448 Created container: dev-peer-0.peer-lynnhurst-composer-0.13.2-49b014bf4f406b2b248c840a95c16be5a45845e67e4f7c1af9a5e7b7e69037bf
2017-10-10 20:51:12.836 UTC [dockercontroller] Start -> DEBU 449 Started container dev-peer-0.peer-lynnhurst-composer-0.13.2
2017-10-10 20:51:12.836 UTC [container] unlockContainer -> DEBU 44a container lock deleted(dev-peer-0.peer-lynnhurst-composer-0.13.2)
2017-10-10 20:51:12.955 UTC [dev-peer-0.peer-lynnhurst-composer-0.13.2] func2 -> INFO 44b 2017-10-10 20:51:12.955 UTC [Composer] Info -> INFO 001 Setting the Composer pool size to 8
2017-10-10 20:51:15.957 UTC [dev-peer-0.peer-lynnhurst-composer-0.13.2] func2 -> INFO 44c 2017-10-10 20:51:15.956 UTC [shim] userChaincodeStreamGetter -> ERRO 002 Error trying to connect to local peer: context deadline exceeded
2017-10-10 20:51:16.001 UTC [dockercontroller] func2 -> INFO 44d Container dev-peer-0.peer-lynnhurst-composer-0.13.2 has closed its IO channel
 2017-10-10 20:56:12.567 UTC [eventhub_producer] validateEventMessage -> DEBU 44e ValidateEventMessage starts for signed event 0xc421507680
2017-10-10 20:56:12.569 UTC [eventhub_producer] deRegisterHandler -> DEBU 44f deregistering event type: BLOCK
2017-10-10 20:56:12.578 UTC [eventhub_producer] Chat -> ERRO 450 error during Chat, stopping handler: rpc error: code = Canceled desc = context canceled
2017-10-10 20:56:12.836 UTC [chaincode] launchAndWaitForRegister -> DEBU 451 stopping due to error while launching Timeout expired while starting chaincode lynnhurst-composer:0.13.2(networkid:dev,peerid:peer-0.peer,tx:14cc34b63f20838b904116a03d39fba2a0eabf8ab7076f51982c746a17c667f1)
2017-10-10 20:56:12.836 UTC [container] lockContainer -> DEBU 452 waiting for container(dev-peer-0.peer-lynnhurst-composer-0.13.2) lock
2017-10-10 20:56:12.836 UTC [container] lockContainer -> DEBU 453 got container (dev-peer-0.peer-lynnhurst-composer-0.13.2) lock
2017-10-10 20:56:12.837 UTC [dockercontroller] stopInternal -> DEBU 454 Stop container dev-peer-0.peer-lynnhurst-composer-0.13.2(Container not running: dev-peer-0.peer-lynnhurst-composer-0.13.2)
2017-10-10 20:56:12.838 UTC [dockercontroller] stopInternal -> DEBU 455 Kill container dev-peer-0.peer-lynnhurst-composer-0.13.2 (API error (500): {"message":"Cannot kill container dev-peer-0.peer-lynnhurst-composer-0.13.2: Container db3e259d3c98fbb97a10a100724b71f861a7ee6b60317686329e1e6439be1ebd is not running"}
)
2017-10-10 20:56:12.843 UTC [dockercontroller] stopInternal -> DEBU 456 Removed container dev-peer-0.peer-lynnhurst-composer-0.13.2
2017-10-10 20:56:12.843 UTC [container] unlockContainer -> DEBU 457 container lock deleted(dev-peer-0.peer-lynnhurst-composer-0.13.2)
2017-10-10 20:56:12.844 UTC [chaincode] launchAndWaitForRegister -> DEBU 458 error on stop Error stopping container: context canceled(Timeout expired while starting chaincode lynnhurst-composer:0.13.2(networkid:dev,peerid:peer-0.peer,tx:14cc34b63f20838b904116a03d39fba2a0eabf8ab7076f51982c746a17c667f1))
2017-10-10 20:56:12.844 UTC [chaincode] func1 -> DEBU 459 chaincode lynnhurst-composer:0.13.2 launch seq completed
2017-10-10 20:56:12.844 UTC [chaincode] Launch -> ERRO 45a launchAndWaitForRegister failed Timeout expired while starting chaincode lynnhurst-composer:0.13.2(networkid:dev,peerid:peer-0.peer,tx:14cc34b63f20838b904116a03d39fba2a0eabf8ab7076f51982c746a17c667f1)
2017-10-10 20:56:12.844 UTC [endorser] callChaincode -> DEBU 45b Exit
2017-10-10 20:56:12.844 UTC [endorser] simulateProposal -> ERRO 45c failed to invoke chaincode name:"lscc"  on transaction 14cc34b63f20838b904116a03d39fba2a0eabf8ab7076f51982c746a17c667f1, error: Timeout expired while starting chaincode lynnhurst-composer:0.13.2(networkid:dev,peerid:peer-0.peer,tx:14cc34b63f20838b904116a03d39fba2a0eabf8ab7076f51982c746a17c667f1)
2017-10-10 20:56:12.844 UTC [endorser] simulateProposal -> DEBU 45d Exit
2017-10-10 20:56:12.844 UTC [lockbasedtxmgr] Done -> DEBU 45e Done with transaction simulation / query execution [f693a082-3404-4f01-98a1-bed5c3f6b24e]
2017-10-10 20:56:12.844 UTC [endorser] ProcessProposal -> DEBU 45f Exit

我的配置目前将主机的/var/run文件夹安装为/host/var/run并设置CORE_VM_DOCKER_ENDPOINT=unix:///host/var/run/docker.sock。我目前有CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=bridge,但我不确定这是否是正确的设置(我已尝试host)以允许这些链代码容器连接到对等方。任何提示将不胜感激。

Fabric版本1.0.3,Composer版本0.13.2

2 个答案:

答案 0 :(得分:2)

通过组合参数的组合,我能够实现这一目标:

CORE_PEER_ADDRESSAUTODETECT=true
CORE_PEER_TLS_SERVERHOSTOVERRIDE=%(hostname).peer

此外,我需要确保不设置CORE_PEER_CHAINCODELISTENADDRESS,以便将对等方的实际IP传递给链代码容器。

答案 1 :(得分:2)

正如@ christo4ferris所指出的,Kubenetes是IBM Blockchain开发人员体验的基础。

这里有所有脚本:

https://github.com/IBM-Blockchain/ibm-container-service/tree/master/cs-offerings/kube-configs