我创建了Kubernetes星系团。
配置:4 CPU X 16 GB内存
在上面的Kubernetes集群上,我使用hyperledger (作为pod)部署了一个超级分类器块链网络。Blockchain网络运行良好。超级分类器资源管理器也在工作,但只有几个小时后,它就停止了,既没有显示错误,也没有警告,而且吊舱也处于“运行”状态。但不是同步块链事务数据。
我创建了两个吊舱,一个用于资源管理器,一个用于资源管理器-DB。我检查了资源管理器-db吊舱的日志,并得到了下面的行。
2021-12-24 17:12:58.232 UTC 31日志:中止任何活动事务2021-12-24 17: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日志:数据库系统已关闭,服务器在进程中停止了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日志:数据库系统在2021-12-24 17:12:58 UTC 2021-24 17:12:59.089 UTC 1日志:数据库系统已准备好接受连接
发布于 2022-05-06 14:40:27
我用Kubernetes sidecar pattern找出了上述问题的解决方案。因此,每当我的主容器由于内存问题而重新启动时,它的侧容器也会自动重新启动。
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 https://stackoverflow.com/questions/70496044
复制相似问题