fabric配置文件讲解整理(一) core.yaml

梳理了一下core.yaml配置文件的内容,都是大概地标注了一下,方便自己日后更改项目配置。如果整理的有错误,欢迎评论和私信!

core.yaml文件分为几大section:Peer section(节点配置),VM section(链码运行环境配置),chaincode section(链码配置),ledger section(账本配置),operations section(操作服务器),metrics section(度量配置)

下面是部分注释

##################################################################

                                         Peer section

##################################################################

peer:

id: jdoe

    networkId: dev

    listenAddress: 0.0.0.0:7051  //监听的网络接口,默认为所有接口

    address: 0.0.0.0:7051

    addressAutoDetect: false

    keepalive:    //节点存活设置

        interval: 7200s

        timeout: 20s     //超时时间

        minInterval: 60s   //client之间ping的最小时间

        client:

            interval: 60s

            timeout: 20s

        deliveryClient:

            interval: 60s

            timeout: 20s

    gossip:   //gossip配置

        bootstrap: 127.0.0.1:7051

    //下面的orgLeader和useLeaderElection参数互斥,是否动态选举

        useLeaderElection: false

        orgLeader: true

        membershipTrackerInterval: 5s

        endpoint:

        maxBlockCountToStore: 10    //内存中存储的块的最大数

        maxPropagationBurstLatency: 10ms

        maxPropagationBurstSize: 10

        propagateIterations: 1

        propagatePeerNum: 3

        pullInterval: 4s

        pullPeerNum: 3

        requestStateInfoInterval: 4s

        publishStateInfoInterval: 4s

        stateInfoRetentionInterval:

        publishCertPeriod: 10s

        skipBlockVerification: false

        dialTimeout: 3s

        connTimeout: 2s     //连接超时时间

        recvBuffSize: 20      //接收缓存大小

        sendBuffSize: 200     //发送缓存大小

        digestWaitTime: 1s

        requestWaitTime: 1500ms

        responseWaitTime: 2s

        aliveTimeInterval: 5s

        aliveExpirationTimeout: 25s

        reconnectInterval: 25s      //重连间隔时间

        maxConnectionAttempts: 120    //一个节点尝试连接的最大数

        msgExpirationFactor: 20

        //被发布到组织外部的peer。若不设置,就不会被其他组织known

        externalEndpoint:

             //选举leader的配置:

        election:

            startupGracePeriod: 15s

            membershipSampleInterval: 1s

            leaderAliveThreshold: 10s

            leaderElectionDuration: 5s

        pvtData:            //私有数据

            pullRetryThreshold: 60s

            transientstoreMaxBlockRetention: 1000

            pushAckTimeout: 3s

            btlPullMargin: 10

            reconcileBatchSize: 10

            reconcileSleepInterval: 1m

            reconciliationEnabled: true

            skipPullingInvalidTransactionsDuringCommit: false

            implicitCollectionDisseminationPolicy:

               requiredPeerCount: 0

               maxPeerCount: 1

         //gossip状态传送配置

        state:

           //状态传输是否启用,默认为true

            enabled: false

            checkInterval: 10s

            responseTimeout: 3s

            batchSize: 10        //状态传输请求的块数

            blockBufferSize: 20

            maxRetries: 3

    tls:   //TLS设置

        enabled:  false

        clientAuthRequired: false

        cert:       //用于TLS服务器的X.509证书

            file: tls/server.crt

        key:      // TLS服务器使用的私钥

            file: tls/server.key

        rootcert:   // 根证书

            file: tls/ca.crt

        clientRootCAs:

            files:

              - tls/ca.crt

        clientKey:

            file:

        clientCert:

            file:

    authentication:  //身份认证

        timewindow: 15m

    //peer存储数据的路径。这个位置必须受到访问控制保护

    fileSystemPath: /var/hyperledger/production

    BCCSP:  // BCCSP (Blockchain crypto provider) 区块链加密提供者

        Default: SW

        SW:    //SW密码提供的设置

            Hash: SHA2

            Security: 256

            FileKeyStore:  //密钥库的位置,默认为 'mspConfigPath'/keystore

                KeyStore:

        PKCS11:  // PKCS#11 密码提供的设置

            Library:

            Label:

            Pin:

            Hash:

            Security:

    mspConfigPath: msp    //msp本地配置路径

    # ----!!!!IMPORTANT!!!-!!!IMPORTANT!!!-!!!IMPORTANT!!!!----

 //需要更改localMspId字符串的值。peer的本地MSP ID的名称需要匹配该peer所属的每个通道中的一个MSP的名称。否则,该peer消息将不会被其他节点识别为有效的。

    localMspId: SampleOrg

    client:     // CLI客户端配置

        connTimeout: 3s

    // 分发服务设置

    deliveryclient:

        reconnectTotalTimeThreshold: 3600s

        connTimeout: 3s

        reConnectBackoffThreshold: 3600s

        addressOverrides:

        #  - from:

        #    to:

        #    caCertsFile:

        #  - from:

        #    to:

        #    caCertsFile:

  

    localMspType: bccsp     //本地msp类型,默认为BCCSP

    profile:

        enabled:     false

        listenAddress: 0.0.0.0:6060

    handlers:     //handlers设置

        authFilters:

          -

            name: DefaultAuth

          -

            name: ExpirationCheck   

        decorators:

          -

            name: DefaultDecorator

        endorsers:

          escc:

            name: DefaultEndorsement

            library:

        validators:

          vscc:

            name: DefaultValidation

            library:

validatorPoolSize:

    discovery:    //discovery服务:用于客户端查询peer信息

        enabled: true

        authCacheEnabled: true

        authCacheMaxSize: 1000

        authCachePurgeRetentionRatio: 0.75

        // 是否允许非管理员执行非通道范围的查询。

//为false时,只有peer管理员可以执行非通道范围的查询。

        orgMembersAllowedAccess: false

    

    limits:    // Limits:用于配置一些内部资源限制。

        concurrency:

            endorserService: 2500

            deliverService: 2500

##################################################################

               VM section  链码运行环境

##################################################################

vm:

    endpoint: unix:///var/run/docker.sock

    docker:    //docker环境设置

        tls:

            enabled: false

            ca:

                file: docker/ca.crt

            cert:

                file: docker/tls.crt

            key:

                file: docker/tls.key

        attachStdout: false  //是否启用绑定到标准输出

        hostConfig:   //主机配置

            NetworkMode: host

            Dns:

               # - 192.168.0.1

            LogConfig:

                Type: json-file

                Config:

                    max-size: "50m"

                    max-file: "5"

            Memory: 2147483648

##################################################################

   Chaincode section   链码部分

##################################################################

chaincode:

    id:

        path:

        name:

    builder: $(DOCKER_NS)/fabric-ccenv:$(TWO_DIGIT_VERSION)

    pull: false    //是否强制拉取镜像

    golang:

        runtime: $(DOCKER_NS)/fabric-baseos:$(TWO_DIGIT_VERSION)

        dynamicLink: false    //是否动态链接链码

    java:

        runtime: $(DOCKER_NS)/fabric-javaenv:$(TWO_DIGIT_VERSION)

    node:

        runtime: $(DOCKER_NS)/fabric-nodeenv:$(TWO_DIGIT_VERSION)

    externalBuilders: []

        # - path: /path/to/directory

        #   name: descriptive-builder-name

        #   propagateEnvironment:

        #      - ENVVAR_NAME_TO_PROPAGATE_FROM_PEER

        #      - GOPROXY

    installTimeout: 300s    //安装链码超时时间

    startuptimeout: 300s

    executetimeout: 30s

    mode: net   //执行链码的模式,dev: 允许本地运行链码  net:在容器中运行链码

    keepalive: 0       //<=0表示关闭

    system:

        _lifecycle: enable

        cscc: enable

        lscc: enable

        qscc: enable

    logging:   //链码日志配置

      level:  info

      shim:   warning

      format: '%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}'

##################################################################

#    Ledger section - ledger configuration encompasses both the blockchain

#    and the state   账本部分

##################################################################

ledger:

  blockchain:

  state:

     //数据库:goleveldb或者CouchDB

    stateDatabase: goleveldb

    totalQueryLimit: 100000

    couchDBConfig:       //couchdb设置

       couchDBAddress: 127.0.0.1:5984

       username:

       password:

       maxRetries: 3

       maxRetriesOnStartup: 10

       requestTimeout: 35s

       internalQueryLimit: 1000

       maxBatchUpdateSize: 1000

       warmIndexesAfterNBlocks: 1

       createGlobalChangesDB: false

       cacheSize: 64

  history:      //是否开启历史数据库

    enableHistoryDatabase: true

  pvtdataStore:  //私有数据存储

    collElgProcMaxDbBatchSize: 5000

    collElgProcDbBatchesInterval: 1000

    deprioritizedDataReconcilerInterval: 60m

  snapshots:   //快照存储位置

rootDir: /var/hyperledger/production/snapshots

##################################################################

#         Operations section

##################################################################

operations:

    listenAddress: 127.0.0.1:9443  //operation server的主机端口号

    tls:

        enabled: false

        cert:

            file:

        key:

            file:

        clientAuthRequired: false

        clientRootCAs:

            files: []

##################################################################

#    Metrics section

##################################################################

metrics:

    provider: disabled

    statsd:

        network: udp     //网络类型:tcp/udp

        address: 127.0.0.1:8125

        writeInterval: 10s

        prefix:

上一篇:iOS tableView类似携程/美团城市筛选,自定义sectionIndex


下一篇:NetCore-缓存文件上传和文件流上传