Unable to register user using Hyperledger membersrvc

0 投票
最新提问 用户: (120 分)

I have Hyperledger setup in Ubuntu using docker images for fabric-peer and membersrvc and I am trying to setup CA as per https://github.com/hyperledger/fabric/blob/master/docs/Setup/ca-setup.md

I started the docker containers using docker-compose up command but getting the following error when trying to login using POST /registrar API, with the following payload:

    {
  "enrollId": "test_vp0",
  "enrollSecret": "MwYpmSRjupbT"
}

But getting the following errors:

vp0_1         | 04:40:24.157 [rest] Register -> INFO 04c REST client login...
vp0_1         | 04:40:24.158 [rest] Register -> INFO 04d Local data store for client loginToken: /var/hyperledger/production/client/
vp0_1         | 04:40:24.158 [rest] Register -> INFO 04e Logging in user 'test_vp0' on REST interface...
vp0_1         | 04:40:24.158 [crypto] RegisterClient -> INFO 04f Registering client [test_vp0] with name [test_vp0]...
vp0_1         | 04:40:24.159 [crypto] Debugf -> DEBU 050 [client.test_vp0] Data will be stored at [/var/hyperledger/production/crypto/client/test_vp0]
vp0_1         | 04:40:24.159 [crypto] Debugf -> DEBU 051 [client.test_vp0] Keystore path [/var/hyperledger/production/crypto/client/test_vp0/ks] missing [true]: [<clean>]
vp0_1         | 04:40:24.159 [crypto] Debugf -> DEBU 052 [client.test_vp0] Creating Keystore at [/var/hyperledger/production/crypto/client/test_vp0/ks]...
vp0_1         | 04:40:24.160 [crypto] Debug -> DEBU 053 [client.test_vp0]  Open Keystore DB...
vp0_1         | 04:40:24.160 [crypto] Debug -> DEBU 054 [client.test_vp0]  Ping Keystore DB...
vp0_1         | 04:40:24.160 [crypto] Debugf -> DEBU 055 [client.test_vp0] Keystore created at [/var/hyperledger/production/crypto/client/test_vp0/ks].
vp0_1         | 04:40:24.160 [crypto] Debugf -> DEBU 056 [client.test_vp0] Keystore opened at [/var/hyperledger/production/crypto/client/test_vp0/ks]...done
vp0_1         | 04:40:24.160 [crypto] Debug -> DEBU 057 [client.test_vp0]  Registering node crypto engine...
vp0_1         | 04:40:24.160 [crypto] Debug -> DEBU 058 [client.test_vp0]  Initiliazing TLS...
vp0_1         | 04:40:24.161 [crypto] Debug -> DEBU 059 [client.test_vp0]  Initiliazing TLS...Disabled!!!
vp0_1         | 04:40:24.161 [crypto] Debug -> DEBU 05a [client.test_vp0]  Getting ECA client...
vp0_1         | 04:40:24.161 [crypto] Debugf -> DEBU 05b [client.test_vp0] Dial to addr:[localhost:7054], with serverName:[tlsca]...
vp0_1         | 04:40:24.161 [crypto] Debug -> DEBU 05c [client.test_vp0]  TLS disabled...
vp0_1         | 04:40:24.161 [crypto] Debug -> DEBU 05d [client.test_vp0]  Getting ECA client...done
**vp0_1         | 04:40:24.162 [crypto] Errorf -> ERRO 05e [client.test_vp0] Failed requesting read certificate [rpc error: code = 14 desc = grpc: RPC failed fast due to transport failure].
vp0_1         | 04:40:24.162 [crypto] Errorf -> ERRO 05f [client.test_vp0] Failed requesting ECA certificate [rpc error: code = 14 desc = grpc: RPC failed fast due to transport failure].
vp0_1         | 04:40:24.162 [crypto] Errorf -> ERRO 060 [client.test_vp0] Failed getting ECA certificate [rpc error: code = 14 desc = grpc: RPC failed fast due to transport failure].
vp0_1         | 04:40:24.162 [crypto] Errorf -> ERRO 061 [client.test_vp0] Failed retrieving ECA certs chain [rpc error: code = 14 desc = grpc: RPC failed fast due to transport failure].
vp0_1         | 04:40:24.163 [crypto] Errorf -> ERRO 062 [client.test_vp0] Failed registering node crypto engine [rpc error: code = 14 desc = grpc: RPC failed fast due to transport failure].
vp0_1         | 04:40:24.163 [crypto] Errorf -> ERRO 063 [client.test_vp0] Failed registering client [test_vp0]: [rpc error: code = 14 desc = grpc: RPC failed fast due to transport failure]
vp0_1         | 04:40:24.163 [crypto] RegisterClient -> ERRO 064 Failed registering client [test_vp0] with name [test_vp0] [rpc error: code = 14 desc = grpc: RPC failed fast due to transport failure].
vp0_1         | 04:40:24.163 [rest] Register -> ERRO 065 Error on client login: rpc error: code = 14 desc = grpc: RPC failed fast due to transport failure
vp0_1         | 2016/10/13 04:40:24 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: dial tcp [::1]:7054: getsockopt: connection refused"; Reconnecting to {"localhost:7054" <nil>}
vp0_1         | 2016/10/13 04:40:24 Failed to dial localhost:7054: grpc: the connection is closing; please retry.**

So how to resolve this issue?

发表于 用户: (120 分)
1) Created a docker-compose.yml file which contains: membersrvc: image: hyperledger/fabric-membersrvc command: membersrvc ports: - "7054:7054" vp0: image: hyperledger/fabric-peer ports: - "7050:7050" environment: - CORE_PEER_ADDRESSAUTODETECT=true - CORE_VM_ENDPOINT=172.17.0.1:2375 - CORE_PEER_ID=vp0 - CORE_LOGGING_LEVEL=DEBUG - CORE_SECURITY_ENROLLID=test_vp0 - CORE_SECURITY_ENROLLSECRET=MwYpmSRjupbT links: - membersrvc command: sh -c "sleep 5; peer node start"
发表于 用户: (120 分)
2) Use docker-compose up command to start docker containers for both membersrvc and fabric peer 3) Here is the output of docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1c06877729c3 hyperledger/fabric-peer "sh -c 'sleep 5; peer" About an hour ago Up 16 seconds 0.0.0.0:7050->7050/tcp docker_vp0_1 4c1e00d4fdc5 hyperledger/fabric-membersrvc "membersrvc" About an hour ago Up 17 seconds

1个回答

0 投票
最新回答 用户: (140 分)

Create a file called docker-compose.yml with the following content,

membersrvc:

  image: hyperledger/fabric-membersrvc:latest
  restart: unless-stopped
  expose:
    - "7054"
  volumes:
    - /var/run/docker.sock:/var/run/docker.sock
  command: membersrvc 
    vp0:
      extends:
        file: peer-noops.yml
        service: vp
      hostname: vp0
      environment:
        - CORE_PEER_ID=vp0
        - CORE_SECURITY_ENABLED=true
        - CORE_SECURITY_ENROLLID=test_vp0
        - CORE_SECURITY_ENROLLSECRET=MwYpmSRjupbT
        - CORE_PEER_PKI_ECA_PADDR=membersrvc:7054
        - CORE_PEER_PKI_TCA_PADDR=membersrvc:7054
        - CORE_PEER_PKI_TLSCA_PADDR=membersrvc:7054
      ports:
        - "7050:7050"
        - "7051:7051"
      links:
        - membersrvc
      command: sh -c "sleep 5; peer node start"

create another file in the same directory and name it peer-noops.yml,

vp:
  image: hyperledger/fabric-peer:latest
  restart: unless-stopped
  environment:
    - CORE_PEER_ADDRESSAUTODETECT=true
    - CORE_PEER_NETWORKID=dev
    - CORE_LOGGING_LEVEL=info  #critical, error, warning, notice, info, debug
    # The following section enables pbft consensus
    - CORE_PEER_VALIDATOR_CONSENSUS_PLUGIN=noops  # noops, pbft
    - CORE_NOOPS_BLOCK_TIMEOUT=2s
    - CORE_NOOPS_BLOCK_WAIT=2s
  expose:
    - "7051"
    - "7052"
    - "7053"
  volumes: 
    - /var/run/docker.sock:/var/run/docker.sock
  command: peer node start  

run docker-compose up from the same directory.

Please read this for more details.

发表于 用户: (120 分)
Tried your suggestion and now getting <br> vp0_1 | 12:56:08.371 vp0_1 | 12:56:08.382 [rest] Register -> ERRO 030 Error on client login: rpc error: code = 2 desc = Identity or token does not match.
发表于 用户: (140 分)
This is expected behavior. Please read this for more information, jira.hyperledger.org/projects/FAB/issues/FAB-2?filter=alliss‌​ues
发表于 用户: (120 分)
Thanks Sufiyan for all your help.
发表于 用户: (120 分)
To all starting out with hyperledger please refer to github.com/yeasy/docker-compose-files/tree/master/hyperledge‌​r
欢迎来到 Security Q&A ,有什么不懂的可以尽管在这里提问,你将会收到社区其他成员的回答。
...