我在哪里可以找到 Hyperledger Fabric peer 命令的可能环境变量?
Where can I find out the possible environment variables for Hyperledger Fabric peer command?
将对等节点配置为 运行 时,示例 docker-compose 文件中包含许多环境变量。有什么地方可以找到它们的全部记录吗?
例如
environment:
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_PEER_ID=peer0.org1.example.com
- CORE_LOGGING_PEER=debug
- CORE_CHAINCODE_LOGGING_LEVEL=DEBUG
- CORE_PEER_LOCALMSPID=Org1MSP
- CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/peer/
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051
Hyperledger Fabric 提供了一个 sample configuration file,它基本上包含了 peer
组件的所有可能属性。当然,你需要将yaml属性转换为对应的环境变量名,公式为:
foo:
bar: baz
变成CORE_FOO_BAR=baz
这同样适用于 orderer
组件,它有自己的 sample configuration file。
Hyperledger Fabric 提供了一个名为 core.yaml 的配置文件,您可以在文件夹 /etc/hyperledger/fabric/
Fabric 使用 Viper 作为配置框架,它提供了通过环境变量覆盖配置文件值的能力。基本上它初始化如下:
// used to prefix config keys to prevent possible collisions
viper.SetEnvPrefix("core")
// enforces to check values configured via environmental variables first
viper.AutomaticEnv()
这使得 viper 在以 CORE
字符串为前缀的环境变量中寻找所有配置键。
现在,如果我们看一下示例配置中的 peer section(已更新):
peer:
id: jdoe
networkId: dev
listenAddress: 0.0.0.0:7051
address: 0.0.0.0:7051
这些值中的任何一个都可以通过导出适当的环境变量来覆盖,例如对等网络 ID:
export CORE_PEER_NETWORKID=mypeerID
同样适用于其他部分,例如,如果我们想控制不同组件的日志记录级别:
logging:
peer: info
cauthdsl: warning
gossip: warning
ledger: info
msp: warning
policies: warning
grpc: error
要使 msp 组件记录调试级别消息,我们需要导出以下变量:
export PEER_LOGGING_MSP=debug
请注意,只有在对等启动之前导出才会生效。
环境实际上是 core.yaml 中的项目,替换“.”用“_”
一些环境变量可以在官方文档的Environment variables for the binaries部分找到。
对等环境变量
CORE_PEER_TLS_ENABLED=true
CORE_PEER_GOSSIP_USELEADERELECTION=true
CORE_PEER_GOSSIP_ORGLEADER=false
CORE_PEER_PROFILE_ENABLED=true
CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
CORE_PEER_ID=peer0.org1.example.com
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
CORE_PEER_LISTENADDRESS=0.0.0.0:7051
CORE_PEER_CHAINCODEADDRESS=peer0.org1.example.com:7052
CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052
CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7051
CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051
CORE_PEER_LOCALMSPID=Org1MSP
排序节点变量
ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
ORDERER_GENERAL_GENESISMETHOD=file
ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block
ORDERER_GENERAL_LOCALMSPID=OrdererMSP
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_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt
ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key
ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
将对等节点配置为 运行 时,示例 docker-compose 文件中包含许多环境变量。有什么地方可以找到它们的全部记录吗?
例如
environment:
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_PEER_ID=peer0.org1.example.com
- CORE_LOGGING_PEER=debug
- CORE_CHAINCODE_LOGGING_LEVEL=DEBUG
- CORE_PEER_LOCALMSPID=Org1MSP
- CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/peer/
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051
Hyperledger Fabric 提供了一个 sample configuration file,它基本上包含了 peer
组件的所有可能属性。当然,你需要将yaml属性转换为对应的环境变量名,公式为:
foo:
bar: baz
变成CORE_FOO_BAR=baz
这同样适用于 orderer
组件,它有自己的 sample configuration file。
Hyperledger Fabric 提供了一个名为 core.yaml 的配置文件,您可以在文件夹 /etc/hyperledger/fabric/
Fabric 使用 Viper 作为配置框架,它提供了通过环境变量覆盖配置文件值的能力。基本上它初始化如下:
// used to prefix config keys to prevent possible collisions
viper.SetEnvPrefix("core")
// enforces to check values configured via environmental variables first
viper.AutomaticEnv()
这使得 viper 在以 CORE
字符串为前缀的环境变量中寻找所有配置键。
现在,如果我们看一下示例配置中的 peer section(已更新):
peer:
id: jdoe
networkId: dev
listenAddress: 0.0.0.0:7051
address: 0.0.0.0:7051
这些值中的任何一个都可以通过导出适当的环境变量来覆盖,例如对等网络 ID:
export CORE_PEER_NETWORKID=mypeerID
同样适用于其他部分,例如,如果我们想控制不同组件的日志记录级别:
logging:
peer: info
cauthdsl: warning
gossip: warning
ledger: info
msp: warning
policies: warning
grpc: error
要使 msp 组件记录调试级别消息,我们需要导出以下变量:
export PEER_LOGGING_MSP=debug
请注意,只有在对等启动之前导出才会生效。
环境实际上是 core.yaml 中的项目,替换“.”用“_”
一些环境变量可以在官方文档的Environment variables for the binaries部分找到。
对等环境变量
CORE_PEER_TLS_ENABLED=true
CORE_PEER_GOSSIP_USELEADERELECTION=true
CORE_PEER_GOSSIP_ORGLEADER=false
CORE_PEER_PROFILE_ENABLED=true
CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
CORE_PEER_ID=peer0.org1.example.com
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
CORE_PEER_LISTENADDRESS=0.0.0.0:7051
CORE_PEER_CHAINCODEADDRESS=peer0.org1.example.com:7052
CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052
CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7051
CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051
CORE_PEER_LOCALMSPID=Org1MSP
排序节点变量
ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
ORDERER_GENERAL_GENESISMETHOD=file
ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block
ORDERER_GENERAL_LOCALMSPID=OrdererMSP
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_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt
ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key
ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]