2 CA在同一端口7054上侦听

时间:2019-08-18 21:13:58

标签: hyperledger-fabric hyperledger hyperledger-fabric-ca

我为2个单位(1个CA / 1个单位)配置了2个CA。我已经将Port- 7054:7054用于第一个CA,将Port- 8054:8054用于第二个CA。但是当我为第二个CA容器执行docker log时,我会收到此信息-2019/08/18 19:54:19 [INFO]侦听http://0.0.0.0:7054,是不是应该是8054,因为我在docker-compose文件中为第二个CA配置了端口8054:8054?如果是,我在哪里做错了,应该在哪里更新?

我在docker-compose文件中的CA服务---

services:
  ca0:
    image: hyperledger/fabric-ca
    environment:
      - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
      - FABRIC_CA_SERVER_CA_NAME=ca-org1
      - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem
      - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/9a834d764f3ec2ee602e073dc27a971add2052c84024efe3e5224fa5485053e9_sk
    ports:
      - "7054:7054"
    command: sh -c 'fabric-ca-server start --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/9a834d764f3ec2ee602e073dc27a971add2052c84024efe3e5224fa5485053e9_sk -b admin:adminpw -d'
    volumes:
      - ./crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
    container_name: ca_peerOrg1
    networks:
      - basic

  ca1:
    image: hyperledger/fabric-ca
    environment:
      - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
      - FABRIC_CA_SERVER_CA_NAME=ca-org2
      - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org2.example.com-cert.pem
      - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/557164d9dc484f634bc058938bac0c68fb56f60ab0359f369ececfe6c7199a53_sk
    ports:
      - "8054:8054"
    command: sh -c 'fabric-ca-server start --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.org2.example.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/557164d9dc484f634bc058938bac0c68fb56f60ab0359f369ececfe6c7199a53_sk -b admin:adminpw -d' 
    volumes:
      - ./crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
    container_name: ca_peerOrg2
    networks:
      - basic

2 个答案:

答案 0 :(得分:2)

@Subhra Sankha Bose @Nipun Tharuksha

我们可以在每个开源项目中更改默认值

您缺少一个环境变量来覆盖默认端口7054

将此添加到环境

- FABRIC_CA_SERVER_PORT=8054

添加环境后,请参阅下面的日志

2019/08/19 08:34:15 [INFO] Home directory for default CA: /etc/hyperledger/fabric-ca-server
2019/08/19 08:34:15 [DEBUG] 1 CA instance(s) running on server
2019/08/19 08:34:15 [INFO] Operation Server Listening on 127.0.0.1:9443
2019/08/19 08:34:15 [DEBUG] TLS is enabled
2019/08/19 08:34:15 [DEBUG] TLS Certificate: /etc/hyperledger/fabric-ca-server-config/ca.nbd-cert.pem, TLS Key: /etc/hyperledger/fabric-ca-server-config/8b3bb8a74b5901f03c8d0901233f5b0ea2b2800e4176dcada7ade4932df565e1_sk
2019/08/19 08:34:15 [DEBUG] Client authentication type requested: noclientcert
2019/08/19 08:34:15 [INFO] Listening on https://0.0.0.0:8054

答案 1 :(得分:0)

只需使用端口8054:7054配置第二个CA,因为内部CA被配置为仅侦听端口7054,因此您只需为CA定义外部端口(此处为8054)即可。