【问题标题】:Hyperledger Explorer not syncing HLF-fabric transactionHyperledger Explorer 未同步 HLF-fabric 交易
【发布时间】:2022-05-06 22:40:27
【问题描述】:
我已经创建了 Kubernetes 集群。
配置:4 CPU X 16 GB 内存
在上面的 Kubernetes 集群上,我使用 Hyperledger Explorer(作为 pod)部署了一个超级账本区块链网络。区块链网络运行良好。 Hyperledger Explorer 也在工作,但仅在几个小时后才停止,既不显示错误也不显示警告,并且 Pod 也处于“运行”状态。但不同步区块链交易数据。
我创建了两个 pod,一个用于 explorer,一个用于 explorer-DB。我检查了 explorer-db pod 的日志并得到以下行
2021-12-24 17:12:58.232 UTC [31] 日志:中止任何活动
事务 2021-12-24 17:12:58.269 UTC [31] 日志:工作进程:
逻辑复制启动器 (PID 38) 以退出代码 1 退出
2021-12-24 17:12:58.289 UTC [33] 日志:关闭 2021-12-24
17:12:58.490 UTC [31] LOG:数据库系统已关闭完成服务器
停止 PostgreSQL 初始化进程完成;准备启动。
2021-12-24 17:12:58.691 UTC [1] 日志:侦听 IPv4 地址
“0.0.0.0”,端口 5432 2021-12-24 17:12:58.691 UTC [1] 日志:监听
在 IPv6 地址“::”上,端口 5432 2021-12-24 17:12:58.709 UTC [1] 日志:
监听 Unix 套接字“/var/run/postgresql/.s.PGSQL.5432”
2021-12-24 17:12:58.989 UTC [65] LOG:数据库系统已关闭
在 2021-12-24 17:12:58 UTC 2021-12-24 17:12:59.089 UTC [1] 日志:
数据库系统已准备好接受连接
【问题讨论】:
标签:
kubernetes
hyperledger
hyperledger-explorer
【解决方案1】:
我通过 Kubernetes 边车模式找到了上述问题的解决方案。因此,每当我的主容器由于某些内存问题而重新启动时,它的边车容器也会自动重新启动。
containers:
- name: peer
image: hyperledger/fabric-peer:2.3
imagePullPolicy: "Always"
command: ["sh", "-c", "peer node start"]
env:
- name: CORE_PEER_ADDRESSAUTODETECT
value: "true"
- name: CORE_PEER_ID
value: peer0-org1
- name: CORE_PEER_ADDRESS
value: peer0-org1:7051
- name: CORE_PEER_LISTENADDRESS
value: 0.0.0.0:7051
- name: CORE_PEER_EVENTS_ADDRESS
value: 0.0.0.0:7061
- name: CORE_PEER_GOSSIP_BOOTSTRAP
value: peer0-org1:7051
- name: CORE_PEER_GOSSIP_USELEADERELECTION
value: "true"
- name: CORE_PEER_PROFILE_ENABLED
value: "true"
- name: CORE_PEER_LOCALMSPID
value: Org1MSP
- name: CORE_PEER_MSPCONFIGPATH
value: /organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp
- name: FABRIC_LOGGING_SPEC
value: debug
- name: CORE_PEER_TLS_ENABLED
value: "true"
- name: CORE_PEER_TLS_CERT_FILE
value: /organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
- name: CORE_PEER_TLS_KEY_FILE
value: /organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
- name: CORE_PEER_TLS_ROOTCERT_FILE
value: /organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
- name: CORE_LEDGER_STATE_STATEDATABASE
value: "CouchDB"
- name: CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS
value: "localhost:5984"
- name: FABRIC_CFG_PATH
value: /etc/hyperledger/fabric
- name: CORE_OPERATIONS_LISTENADDRESS
value: 0.0.0.0:9443
- name: CORE_METRICS_PROVIDER
value: prometheus
ports:
- containerPort: 7051
- containerPort: 7052
- containerPort: 7053
- containerPort: 9443
resources:
limits:
memory: "450Mi"
cpu: "300m"
requests:
memory: "150Mi"
cpu: "100m"
volumeMounts:
- mountPath: /opt/gopath/src/github.com/chaincode/
name: fabricfiles
subPath: chaincode/
- mountPath: /organizations
name: fabricfiles
subPath: organizations
- mountPath: /var/hyperledger/production
name: fabricfiles
subPath: state/org1/peer0
- mountPath: /etc/hyperledger/fabric/core.yaml
name: builders-config
subPath: core.yaml
- mountPath: /builders/external/bin/detect
name: external-builder-detect
subPath: detect
- mountPath: /builders/external/bin/build
name: external-builder-build
subPath: build
- mountPath: /builders/external/bin/release
name: external-builder-release
subPath: release
- name: couchdb
image: hyperledger/fabric-couchdb:0.4.15
resources:
limits:
memory: "450Mi"
cpu: "400m"
volumeMounts:
- mountPath: /var/lib/couchdb
name: fabricfiles
subPath: state/org1/peer0-couchdb
- name: explorer
image: hyperledger/explorer:1.1.8
# startupProbe:
# failureThreshold: 30
# periodSeconds: 30
env:
- name: DATABASE_HOST
value: "explorerdb-service"
- name: DATABASE_DATABASE
value: "fabricexplorer"
- name: DATABASE_USERNAME
value: "hppoc"
- name: DATABASE_PASSWD
value: "password"
- name: LOG_LEVEL_APP
value: "warn"
- name: LOG_LEVEL_DB
value: "debug"
- name: LOG_LEVEL_CONSOLE
value: "warn"
- name: LOG_CONSOLE_STDOUT
value: "true"
- name: DISCOVERY_AS_LOCALHOST
value: "false"
- name: NODE_TLS_REJECT_UNAUTHORIZED
value: "0"
resources:
limits:
memory: "300Mi"
cpu: "300m"
ports:
- containerPort: 8080
# command: ["sh","-c","/opt/explorer/syncstart.sh"]
volumeMounts:
- mountPath: /organizations
name: fabricfiles
subPath: organizations
- mountPath: /opt/explorer/app/platform/fabric/config.json
name: explorer-config
subPath: config.json
- mountPath: /opt/explorer/app/platform/fabric/first-network.json
name: explorer-config
subPath: network.json