sudo apt-get install wget ca-certificates wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list' sudo apt-get update sudo apt-get install postgresql postgresql-contrib ##修改密码 sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';"
apt-get install jq jq --version
git clone https://github.com/hyperledger/blockchain-explorer.git & cd blockchain-explorer
修改 app/explorerconfig.jsongit
{ "persistence": "postgreSQL", "platforms": ["fabric"], "postgreSQL": { "host": "127.0.0.1", "port": "5432", "database": "fabricexplorer", "username": "postgres", "passwd": "postgres" } }
给 db 目录设置权限github
chmod -R 775 app/persistence/fabric/postgreSQL/db
执行数据库脚本sql
cd blockchain-explorer/app/persistence/fabric/postgreSQL/db su - postgres ./createdb.sh
这里的配置基于咱们上一篇搭建的 fabric 网络,进入blockchain-explorer/app/platform/fabric
目录作响应的修改config.json
:docker
{ "name": "fabric-network", "version": "1.0.0", "client": { "tlsEnable": true, "adminUser": "admin", "adminPassword": "adminpw", "enableAuthentication": false, "organization": "Org1MSP", "connection": { "timeout": { "peer": { "endorser": "300" }, "orderer": "300" } } }, "channels": { "mychannel": { "peers": { "peer0.org1.example.com": {}, "peer0.org2.example.com": {}, "orderer.example.com": {} }, "connection": { "timeout": { "peer": { "endorser": "6000", "eventHub": "6000", "eventReg": "6000" } } } } }, "organizations": { "Org1MSP": { "mspid": "Org1MSP", "fullpath": true, "adminPrivateKey": { "path": "/root/fabric/fabric-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/b04f0b81d66a714cb3fcf17206376eaa59dee8853e1cb1b501dca71e63d40fef_sk" }, "signedCert": { "path": "/root/fabric/fabric-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem" } }, "Org2MSP": { "mspid": "Org2MSP", "fullpath": true, "adminPrivateKey": { "path": "/root/fabric/fabric-network/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/keystore/b1ad20e44fba3b5095119796acb4480eddb5331c4fc42f461f46f3dfcb2334f9_sk" }, "signedCert": { "path": "/root/fabric/fabric-network/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/signcerts/Admin@org1.example.com-cert.pem" } }, "OrdererMSP": { "mspid": "OrdererMSP", "fullpath": true, "adminPrivateKey": { "path": "/root/fabric/fabric-network/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/keystore/2cf39d9293b690bcce3b427fde9590240a1f2a4734c05a7612e058ba5ff1de44_sk" }, "signedCert": { "path": "/root/fabric/fabric-network/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/signcerts/Admin@org1.example.com-cert.pem" } } }, "peers": { "peer0.org1.example.com": { "tlsCACerts": { "path": "/root/fabric/fabric-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" }, "url": "grpc://192.168.11.12:7051", "grpcOptions": { "ssl-target-name-override": "peer0.org1.example.com" } }, "peer0.org2.example.com": { "tlsCACerts": { "path": "/root/fabric/fabric-network/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" }, "url": "grpc://192.168.11.14:7051", "grpcOptions": { "ssl-target-name-override": "peer0.org2.example.com" } } }, "orderers": { "orderer.example.com": { "url": "grpc://localhost:7050" } } }
apt-get install build-essential cd blockchain-explorer ./main.sh install
直接在项目目录下执行启动脚本:shell
./start.sh debug #开启debug
经过加上 debug 参数能够在日志文件中查看启动过程当中的错误,默认服务器启动端口为8080
,经过浏览器能够直接 ip+端口访问数据库
中止服务json
./stop.sh
到此一个能够用于实际生产环境的多机 Hyperledger Fabric 区块链网络部署就完成了。浏览器
转载请注明: 转载自Ryan 是菜鸟 | LNMP 技术栈笔记服务器
若是以为本篇文章对您十分有益,何不 打赏一下网络
本文连接地址: Hyperledger Fabric Explorer 安装配置
<img alt="知识共享许可协议" style="border-width:0" src="https://i.creativecommons.org/l/by-nc/4.0/80x15.png" />
本做品采用知识共享署名-非商业性使用 4.0 国际许可协议进行许可