当前位置: 首页 > 知识库问答 >
问题:

Hyperledger Fabric:如何使组织既是对等节点又是订购节点?

莫誉
2023-03-14

我正在构建一个Hyperledger结构网络,并试图让一个组织同时拥有一个对等节点和一个订购节点。我使用cryptogen生成证书和密钥,并且只创建一个组织作为“对等组织”。我有一个网络,有6个组织——其中5个有一个对等组织,一个有一个订购者的订购者组织。然后,我获取了这些配置文件,删除了order组织,并将orderendpoint添加到一个对等组织中。我现在犯了一个错误。

打印到屏幕上:

错误:未能为订购者创建交付客户端:订购者客户端未能连接到本地主机:7050:未能创建新连接:超出上下文截止日期

运行“docker logs Order.orgname.domain”时出现错误消息

2020-08-17 23:56:43.834 UTC[order.common.server]Main-

2020-08-17 23:56:51.317 UTC[核心通信]服务器握手-

我的configtx.yaml档案

Organizations:
- &orgname
    Name: orgnameMSP
    SkipAsForeign: false
    ID: orgnameMSP
    MSPDir: crypto-config/peerOrganizations/orgname.domain/msp
    Policies:
        Readers:
            Type: Signature
            Rule: "OR('orgnameMSP.admin', 'orgnameMSP.peer', 'PSUMSP.client')"
        Writers:
            Type: Signature
            Rule: "OR('orgnameMSP.admin', 'orgnameMSP.client')"
        Admins:
            Type: Signature
            Rule: "OR('orgnameMSP.admin')"
        Endorsement:
            Type: Signature
            Rule: "OR('orgnameMSP.member')"

    OrdererEndpoints:
            - orderer.orgname.domain:7050
    AnchorPeers:
        - Host: peer0.orgname.domain
          Port: 7051

- &orgname2
    Name: orgname2MSP
    ID: orgname2MSP
    MSPDir: crypto-config/peerOrganizations/orgname2.domain/msp
    Policies:
        Readers:
            Type: Signature
            Rule: "OR('orgname2MSP.admin', 'orgname2MSP.peer', 'orgname2MSP.client')"
        Writers:
            Type: Signature
            Rule: "OR('orgname2MSP.admin', 'orgname2MSP.client')"
        Admins:
            Type: Signature
            Rule: "OR('orgname2MSP.admin')"
        Endorsement:
            Type: Signature
            Rule: "OR('orgname2MSP.peer')"

    AnchorPeers:
        - Host: peer0.orgname2.domain
          Port: 8051

- &orgname3
    Name: orgname3MSP
    ID: orgname3MSP
    MSPDir: crypto-config/peerOrganizations/orgname3.domain/msp
    Policies:
        Readers:
            Type: Signature
            Rule: "OR('orgname3MSP.admin', 'orgname3MSP.peer', 'orgname3MSP.client')"
        Writers:
            Type: Signature
            Rule: "OR('orgname3MSP.admin', 'orgname3MSP.client')"
        Admins:
            Type: Signature
            Rule: "OR('orgname3MSP.admin')"
        Endorsement:
            Type: Signature
            Rule: "OR('orgname3MSP.peer')"
    AnchorPeers:
        - Host: peer0.orgname3.domain
          Port: 9051

- &orgname4
    Name: orgname4
    ID: orgname4MSP

    MSPDir: crypto-config/peerOrganizations/orgname4.domain/msp
    Policies:
        Readers:
            Type: Signature
            Rule: "OR('orgname4MSP.admin', 'orgname4MSP.peer', 'orgname4MSP.client')"
        Writers:
            Type: Signature
            Rule: "OR('orgname4MSP.admin', 'orgname4MSP.client')"
        Admins:
            Type: Signature
            Rule: "OR('orgname4MSP.admin')"
        Endorsement:
            Type: Signature
            Rule: "OR('orgname4MSP.peer')"
    AnchorPeers:
        - Host: peer0.orgname4.domain
          Port: 10051

- &orgname5
    Name: Fly-Us-HospitalityMSP
    ID: Fly-Us-HospitalityMSP
    MSPDir: crypto-config/peerOrganizations/orgname5.domain/msp

    Policies:
        Readers:
            Type: Signature
            Rule: "OR('orgname5MSP.admin', 'orgname5MSP.peer', 'orgname5MSP.client')"
        Writers:
            Type: Signature
            Rule: "OR('orgname5MSP.admin', 'orgname5MSP.client')"
        Admins:
            Type: Signature
            Rule: "OR('orgname5MSP.admin')"
        Endorsement:
            Type: Signature
            Rule: "OR('orgname5MSP.peer')"
    AnchorPeers:
        - Host: peer0.orgname5.domain
          Port: 11051

Capabilities:
Channel: &ChannelCapabilities
    #        V2_0: true
    V1_4_2: true

Orderer: &OrdererCapabilities
    #        V2_0: true
    V1_4_2: true

Application: &ApplicationCapabilities
    #        V2_0: true
    V1_4_2: true

Application: &ApplicationDefaults

Organizations:

Policies:
    Readers:
        Type: ImplicitMeta
        Rule: "ANY Readers"
    Writers:
        Type: ImplicitMeta
        Rule: "ANY Writers"
    Admins:
        Type: ImplicitMeta
        Rule: "MAJORITY Admins"
    LifecycleEndorsement:
        Type: ImplicitMeta
        Rule: "MAJORITY Endorsement"
    Endorsement:
        Type: ImplicitMeta
        Rule: "MAJORITY Endorsement"

Capabilities:
    <<: *ApplicationCapabilities

Orderer: &OrdererDefaults

OrdererType: solo

EtcdRaft:
    Consenters:
    - Host: orderer.orgname.domain
      Port: 7050
      ClientTLSCert: crypto-config/peerOrganizations/orgname.domain/peers/peer0.orgname.domain/tls/server.crt
      ServerTLSCert: crypto-config/peerOrganizations/orgname.domain/peers/peer0.orgname.domain/tls/server.crt

Addresses:
    - orderer.orgname.domain:7050
BatchTimeout: 2s
BatchSize:
    MaxMessageCount: 10
    AbsoluteMaxBytes: 99 MB
    PreferredMaxBytes: 512 KB
Organizations:
Policies:
    Readers:
        Type: ImplicitMeta
        Rule: "ANY Readers"
    Writers:
        Type: ImplicitMeta
        Rule: "ANY Writers"
    Admins:
        Type: ImplicitMeta
        Rule: "MAJORITY Admins"
    BlockValidation:
        Type: ImplicitMeta
        Rule: "ANY Writers"

Channel: &ChannelDefaults
Policies:
    Readers:
        Type: ImplicitMeta
        Rule: "ANY Readers"
    Writers:
        Type: ImplicitMeta
        Rule: "ANY Writers"
    Admins:
        Type: ImplicitMeta
        Rule: "MAJORITY Admins"
Capabilities:
    <<: *ChannelCapabilities

Profiles:
BasicChannel:
    Consortium: MyConsortium
    <<: *ChannelDefaults
    Application:
        <<: *ApplicationDefaults
        Organizations:
            - *orgname
            - *orgname2
            - *orgname3
            - *orgname4
            - *orgname5
        Capabilities:
            <<: *ApplicationCapabilities

OrdererGenesis:
    <<: *ChannelDefaults
    Orderer:
        <<: *OrdererDefaults
        Organizations:
            - *orgname
        Capabilities:
            <<: *ChannelCapabilities
    Consortiums:
        MyConsortium:
            Organizations:
            - *orgname
            - *orgname2
            - *orgname3
            - *orgname4
            - *orgname5

我的docker-compose.yaml档案

version: "2"
networks:
  network2.3:

services:
  ca-orgname:
    container_name: ca.orgname.domain
    hostname: ca.orgname.domain
    extends:
      file: docker-ca-base.yaml
      service: ca-base
    environment:
      - FABRIC_CA_SERVER_CA_NAME=ca.orgname.domain
      - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.orgname.domain-cert.pem
      - FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-tls/tlscs.orgname.domain-cert.pem
      - FABRIC_CA_SERVER_PORT=7054
    ports:
      - "7054:7054"
    volumes:
      - ./crypto-config/peerOrganizations/orgname.domain/ca/:/etc/hyperledger/fabric-ca-server-config
      - ./crypto-config/peerOrganizations/orgname.domain/tslca/:/etc/hyperledger/fabric-ca-server-tls

  ca-orgname2:
    container_name: ca.orgname2.domain
    hostname: ca.orgname2.domain
    extends:
      file: docker-ca-base.yaml
      service: ca-base
    environment:
      - FABRIC_CA_SERVER_CA_NAME=ca.orgname2.domain
      - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.orgname2.domain-cert.pem
      - FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-tls/tlscs.orgname2.domain-cert.pem
      - FABRIC_CA_SERVER_PORT=8054
    ports:
      - "8054:7054"
    volumes:
      - ./crypto-config/peerOrganizations/orgname2.domain/ca/:/etc/hyperledger/fabric-ca-server-config
      - ./crypto-config/peerOrganizations/orgname2.domain/tslca/:/etc/hyperledger/fabric-ca-server-tls

  ca-orgname3:
    container_name: ca.orgname3.domain
    hostname: ca.orgname3.domain
    extends:
      file: docker-ca-base.yaml
      service: ca-base
    environment:
      - FABRIC_CA_SERVER_CA_NAME=ca.orgname3.domain
      - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.orgname3.domain-cert.pem
      - FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-tls/tlscs.orgname3.domain-cert.pem
      - FABRIC_CA_SERVER_PORT=9054
    ports:
      - "9054:7054"
    volumes:
      - ./crypto-config/peerOrganizations/orgname3.domain/ca/:/etc/hyperledger/fabric-ca-server-config
      - ./crypto-config/peerOrganizations/orgname3.domain/tslca/:/etc/hyperledger/fabric-ca-server-tls

  ca-orgname4:
    container_name: ca.orgname4.domain
    hostname: ca.orgname4.domain
    extends:
      file: docker-ca-base.yaml
      service: ca-base
    environment:
      - FABRIC_CA_SERVER_CA_NAME=ca.orgname4.domain
      - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.orgname4.domain-cert.pem
      - FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-tls/tlscs.orgname4.domain-cert.pem
      - FABRIC_CA_SERVER_PORT=10054
    ports:
      - "10054:7054"
    volumes:
      - ./crypto-config/peerOrganizations/orgname4.domain/ca/:/etc/hyperledger/fabric-ca-server-config
      - ./crypto-config/peerOrganizations/orgname4.domain/tslca/:/etc/hyperledger/fabric-ca-server-tls

  ca-orgname5:
    container_name: ca.orgname5.domain
    hostname: ca.orgname5.domain
    extends:
      file: docker-ca-base.yaml
      service: ca-base
    environment:
      - FABRIC_CA_SERVER_CA_NAME=ca.orgname5.domain
      - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.orgname5.domain-cert.pem
      - FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-tls/tlscs.orgname5.domain-cert.pem
      - FABRIC_CA_SERVER_PORT=11054
    ports:
      - "11054:7054"
    volumes:
      - ./crypto-config/peerOrganizations/orgname5.domain/ca/:/etc/hyperledger/fabric-ca-server-config
      - ./crypto-config/peerOrganizations/orgname5.domain/tslca/:/etc/hyperledger/fabric-ca-server-tls

  orderer.orgname.domain
    container_name: orderer.orgname.domain
    image: hyperledger/fabric-orderer:latest
    dns_search: .
    environment:
      - ORDERER_GENERAL_LOGLEVEL=debug
      - FABRIC_LOGGING_SPEC=INFO
      - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
      - ORDERER_GENERAL_GENESISMETHOD=file
      - ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/genesis.block
      - ORDERER_GENERAL_LOCALMSPID=PSUMSP
      - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
      - ORDERER_GENERAL_TLS_ENABLED=true
      - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key
      - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt
      - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
      - ORDERER_GENERAL_LISTENPORT=7050
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/orderers
    command: orderer
    volumes:
      - ../channel-artifacts/genesis.block:/var/hyperledger/orderer/genesis.block
      - ./crypto-config/peerOrganizations/orgname.domain/peers/peer0.orgname.domain/msp:/var/hyperledger/orderer/msp
      - ./crypto-config/peerOrganizations/orgname.domain/peers/peer0.orgname.domain/tls:/var/hyperledger/orderer/tls
    ports:
      - 7050:7050

  peer0.orgname.domain:
    container_name: peer0.orgname.domain
    extends:
      file: docker-peer-base.yaml
      service: peer-base
    environment:
      - CORE_PEER_LOCALMSPID=orgnameMSP
      - CORE_PEER_ID=peer0.orgname.domain
      - CORE_PEER_ADDRESS=peer0.orgname.domain:7051
      - CORE_PEER_LISTENADDRESS=0.0.0.0:7051
      - CORE_PEER_CHAINCODEADDRESS=peer0.orgname.domain:7052
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052
      - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.orgname.domain:7051
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.orgname.domain:7051
    volumes:
      - ./crypto-config/peerOrganizations/orgname.domain/peers/peer0.orgname.domain/msp:/etc/hyperledger/crypto/peer/msp
      - ./crypto-config/peerOrganizations/orgname.domain/peers/peer0.orgname.domain/tls:/etc/hyperledger/crypto/peer/tls
      - /var/run:/host/var/run
      - ../channel-artifacts:/etc/hyperledger/channel
    ports:
      - 7051:7051

  peer0.orgname2.domain:
    container_name: peer0.orgname2.domain
    extends:
      file: docker-peer-base.yaml
      service: peer-base
    environment:
      - CORE_PEER_LOCALMSPID=orgname2MSP
      - CORE_PEER_ID=peer0.orgname2.domain
      - CORE_PEER_ADDRESS=peer0.orgname2.domain:8051
      - CORE_PEER_LISTENADDRESS=0.0.0.0:8051
      - CORE_PEER_CHAINCODEADDRESS=peer0.orgname2.domain:8052
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:8052
      - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.orgname2.domain:8051
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.orgname2.domain:8051
    volumes:
      - ./crypto-config/peerOrganizations/orgname2.domain/peers/peer0.orgname2.domain/msp:/etc/hyperledger/crypto/peer/msp
      - ./crypto-config/peerOrganizations/orgname2.domain/peers/peer0.orgname2.domain/tls:/etc/hyperledger/crypto/peer/tls
      - /var/run:/host/var/run
      - ../channel-artifacts:/etc/hyperledger/channel
    ports:
      - 8051:8051

  peer0.orgname3.domain:
    container_name: peer0.orgname3.domain
    extends:
      file: docker-peer-base.yaml
      service: peer-base
    environment:
      - CORE_PEER_LOCALMSPID=orgname3MSP
      - CORE_PEER_ID=peer0.orgname3.domain
      - CORE_PEER_ADDRESS=peer0.orgname3.domain:9051
      - CORE_PEER_LISTENADDRESS=0.0.0.0:9051
      - CORE_PEER_CHAINCODEADDRESS=peer0.orgname3.domain:9052
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:9052
      - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.orgname3.domain:9051
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.orgname3.domain:9051
    volumes:
      - ./crypto-config/peerOrganizations/orgname3.domain/peers/peer0.orgname3.domain/msp:/etc/hyperledger/crypto/peer/msp
      - ./crypto-config/peerOrganizations/orgname3.domain/peers/peer0.orgname3.domain/tls:/etc/hyperledger/crypto/peer/tls
      - /var/run:/host/var/run
      - ../channel-artifacts:/etc/hyperledger/channel
    ports:
      - 9051:9051

  peer0.orgname4.domain:
    container_name: peer0.orgname4.domain
    extends:
      file: docker-peer-base.yaml
      service: peer-base
    environment:
      - CORE_PEER_LOCALMSPID=orgname4MSP
      - CORE_PEER_ID=peer0.orgname4.domain
      - CORE_PEER_ADDRESS=peer0.orgname4.domain:10051
      - CORE_PEER_LISTENADDRESS=0.0.0.0:10051
      - CORE_PEER_CHAINCODEADDRESS=peer0.orgname4.domain:10052
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:10052
      - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.orgname4.domain:10051
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.orgname4.domain:10051
    volumes:
      - ./crypto-config/peerOrganizations/orgname4.domain/peers/peer0.orgname4.domain/msp:/etc/hyperledger/crypto/peer/msp
      - ./crypto-config/peerOrganizations/orgname4.domain/peers/peer0.orgname4.domain/tls:/etc/hyperledger/crypto/peer/tls
      - /var/run:/host/var/run
      - ../channel-artifacts:/etc/hyperledger/channel
    ports:
      - 10051:10051

  peer0.orgname5.domain:
    container_name: peer0.orgname5.domain
    extends:
      file: docker-peer-base.yaml
      service: peer-base
    environment:
      - CORE_PEER_LOCALMSPID=orgname5MSP
      - CORE_PEER_ID=peer0.orgname5.domain
      - CORE_PEER_ADDRESS=peer0.orgname5.domain:11051
      - CORE_PEER_LISTENADDRESS=0.0.0.0:11051
      - CORE_PEER_CHAINCODEADDRESS=peer0.orgname5.domain:11052
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:11052
      - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.orgname5.domain:11051
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.orgname5.domain:11051
    volumes:
      - ./crypto-config/peerOrganizations/orgname5.domain/peers/peer0.orgname5.domain/msp:/etc/hyperledger/crypto/peer/msp
      - ./crypto-config/peerOrganizations/orgname5.domain/peers/peer0.orgname5.domain/tls:/etc/hyperledger/crypto/peer/tls
      - /var/run:/host/var/run
      - ../channel-artifacts:/etc/hyperledger/channel
    ports:
      - 11051:11051

我的crypto-config.yaml档案

    PeerOrgs:
      - Name: orgname
        Domain: orgname.domain
        EnableNodeOUs: true

        Template:
          Count: 1
          SANS:
            - "localhost"
          Users:
            Count: 1

      - Name: orgname2
        Domain: orgname2.domain
        EnableNodeOUs: true

        Template:
          Count: 1
          SANS:
            - "localhost"
        Users:
          Count: 1

      - Name: orgname3
        Domain: orgname3.domain
        EnableNodeOUs: true

        Template:
          Count: 1
          SANS:
            - "localhost"
        Users:
          Count: 1

      - Name: orgname4
        Domain: orgname4.domain
        EnableNodeOUs: true

        Template:
          Count: 1
          SANS:
            - "localhost"
        Users:
          Count: 1

      - Name: orgname5
        Domain: orgname5.domain
        EnableNodeOUs: true

        Template:
          Count: 1
          SANS:
            - "localhost"
        Users:
          Count: 1

任何帮助都将不胜感激。

更新:所以我改变了加密配置的配置。yaml在对等方/订购方组织中创建两个对等方。一个是我指定的订购者,另一个是同行。这消除了TLS错误,但现在我的背书政策有一个错误。

020-08-20 14:29:09.699 PDT[channelCmd]InitCmdFactory-

其余的文件都是相同的,只是我更改了orderer TLS文件,以指向新指定的“orderer”(就cryptogen而言,实际上是对等的)文件。

共有1个答案

弓华茂
2023-03-14

TLS的问题是通过在组织机构名下创建两个对等节点并为订购者指定一个来解决的。我不明白为什么我不能对对等节点和订购者节点使用相同的证书,但是它现在正在工作。

我在更新中遇到的第二个问题是通过使背书政策更加宽松而得到解决。对于我的configtx中的每个组织。yaml文件,我设置读者、作者和背书要求任何成员签名。

 类似资料:
  • 我在一个数据帧中有一个数据结构,它有3列:节点、父节点、前一个兄弟节点 我想创建完整数据结构的树文件夹,父节点和节点之间的级别不同,节点和previous_sibling之间的级别相同,兄弟节点之间的顺序正确。 因此,一个新的数据框、重新排序和一个新的列“级别” 当parent为null时,节点处于根级别当previous_sibling为null时这是第一个同级 下面是一个例子: 数据帧 应给出

  • 问题内容: 我目前正在阅读正式的Microsoft书籍“数据库管理基础知识”,以准备参加考试。 我了解什么是DDL和DML,但Microsoft会将DELETE视为DDL和DML语句。我已经用谷歌搜索过,但是我无法证实或否认这一点。 对此问题的一个很好的参考:什么是DDL和DML,将其显示为DML。以下是本书中的部分: 数据操作语言(DML)是一种语言元素,它使您可以使用核心语句INSERT,UP

  • 本文向大家介绍DOM节点的根节点是不是body?相关面试题,主要包含被问及DOM节点的根节点是不是body?时的应答技巧和注意事项,需要的朋友参考一下 文档对象模型 (DOM) 是HTML和XML文档的编程接口。它提供了对文档的结构化的表述,并定义了一种方式可以使从程序中对该结构进行访问,从而改变文档的结构,样式和内容。DOM 将文档解析为一个由节点和对象(包含属性和方法的对象)组成的结构集合。简

  • 问题内容: 我正在寻找一个使用序列化ORM的示例nodejs应用程序。 我主要担心的是,如果由于require()依赖关系循环而导致模型之间具有复杂的关系,那么几乎不可能在单独的js文件中定义模型。也许人们在一个非常长的文件中定义了所有模型? 我主要对模型的定义和在整个应用程序中的使用感兴趣。我想验证一下我自己正在做的事情是“好的”做事方式。 问题答案: 短篇小说 这种情况下的诀窍不是初始化文件中

  • 所以我环顾了一下网络,在stackoverflow中有几个问题是定义: 通常,内部节点是任何不是叶子的节点(没有子节点) 非叶/非末端/内部节点-至少有一个度不等于0的子节点或后代节点 据我所知,它是一个节点,而不是一片叶子。 我即将得出结论,根也是一个内部节点,但它的定义似乎有些模糊,如图所示: 二元搜索树中的“内部节点”是什么? 正如这张精彩的图片所示,内部节点是位于树根和树叶之间的节点 如果

  • 问题内容: 我正在使用nltk的Tree数据结构来处理parsetree字符串。 但是,数据结构似乎受到限制。是否可以通过其字符串值获取节点,然后导航至顶部或底部? 例如,假设您要获取字符串值为 ‘nice’ 的节点,然后查看其父级,子级等是什么?可以通过nltk的Tree实现该节点吗? 问题答案: 对于NLTK 3.0,您想使用ParentedTree子类。 http://www.nltk.or