Hyperledger Explorer 不同步 HLF-fabric 交易
Hyperledger Explorer not syncing HLF-fabric transaction
我已经创建了 Kubernetes 集群。
配置:4 CPU X 16 GB 内存
在上面的 Kubernetes 集群上,我使用 Hyperledger Explorer(作为 pod)部署了一个 hyperledger 区块链网络。区块链网络运行良好。 Hyperledger Explorer 也在工作,但仅在几个小时后停止,既不显示错误也不显示警告,并且 pod 也处于“运行”状态。但不同步区块链交易数据。
我创建了两个 pods,一个用于 explorer,一个用于 explorer-DB。我检查了 explorer-db pod 的日志并得到以下行
2021-12-24 17:12:58.232 UTC [31] LOG: aborting any active
transactions 2021-12-24 17:12:58.269 UTC [31] LOG: worker process:
logical replication launcher (PID 38) exited with exit code 1
2021-12-24 17:12:58.289 UTC [33] LOG: shutting down 2021-12-24
17:12:58.490 UTC [31] LOG: database system is shut down done server
stopped PostgreSQL init process complete; ready for start up.
2021-12-24 17:12:58.691 UTC [1] LOG: listening on IPv4 address
"0.0.0.0", port 5432 2021-12-24 17:12:58.691 UTC [1] LOG: listening
on IPv6 address "::", port 5432 2021-12-24 17:12:58.709 UTC [1] LOG:
listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2021-12-24 17:12:58.989 UTC [65] LOG: database system was shut down
at 2021-12-24 17:12:58 UTC 2021-12-24 17:12:59.089 UTC [1] LOG:
database system is ready to accept connections
我用 Kubernetes sidecar pattern
找到了上述问题的解决方案。因此,每当我的主容器由于内存问题而重新启动时,它的 sidecar 容器也会自动重新启动。
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
我已经创建了 Kubernetes 集群。
配置:4 CPU X 16 GB 内存
在上面的 Kubernetes 集群上,我使用 Hyperledger Explorer(作为 pod)部署了一个 hyperledger 区块链网络。区块链网络运行良好。 Hyperledger Explorer 也在工作,但仅在几个小时后停止,既不显示错误也不显示警告,并且 pod 也处于“运行”状态。但不同步区块链交易数据。
我创建了两个 pods,一个用于 explorer,一个用于 explorer-DB。我检查了 explorer-db pod 的日志并得到以下行
2021-12-24 17:12:58.232 UTC [31] LOG: aborting any active transactions 2021-12-24 17:12:58.269 UTC [31] LOG: worker process: logical replication launcher (PID 38) exited with exit code 1 2021-12-24 17:12:58.289 UTC [33] LOG: shutting down 2021-12-24 17:12:58.490 UTC [31] LOG: database system is shut down done server stopped PostgreSQL init process complete; ready for start up. 2021-12-24 17:12:58.691 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 2021-12-24 17:12:58.691 UTC [1] LOG: listening on IPv6 address "::", port 5432 2021-12-24 17:12:58.709 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" 2021-12-24 17:12:58.989 UTC [65] LOG: database system was shut down at 2021-12-24 17:12:58 UTC 2021-12-24 17:12:59.089 UTC [1] LOG: database system is ready to accept connections
我用 Kubernetes sidecar pattern
找到了上述问题的解决方案。因此,每当我的主容器由于内存问题而重新启动时,它的 sidecar 容器也会自动重新启动。
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