无法在k8s

时间:2017-08-22 14:25:22

标签: kubernetes hyperledger-fabric

我试图在码头工人中启动布料并遇到错误:

2017-08-22 13:24:33.544 UTC [orderer/main] main -> INFO 001 Starting orderer:
 Version: 1.0.1
 Go version: go1.7.5
 OS/Arch: linux/amd64
2017-08-22 13:24:33.552 UTC [orderer/main] initializeSecureServerConfig -> INFO 002 Starting orderer with TLS enabled
2017-08-22 13:24:33.577 UTC [bccsp_sw] openKeyStore -> DEBU 003 KeyStore opened at [/var/hyperledger/orderer/msp/keystore]...done
2017-08-22 13:24:33.577 UTC [bccsp] initBCCSP -> DEBU 004 Initialize BCCSP [SW]
2017-08-22 13:24:33.577 UTC [msp] getPemMaterialFromDir -> DEBU 005 Reading directory /var/hyperledger/orderer/msp/signcerts
2017-08-22 13:24:33.577 UTC [msp] getPemMaterialFromDir -> DEBU 006 Inspecting file /var/hyperledger/orderer/msp/signcerts/orderer.example.com-cert.pem
2017-08-22 13:24:33.578 UTC [msp] getPemMaterialFromDir -> DEBU 007 Reading directory /var/hyperledger/orderer/msp/cacerts
2017-08-22 13:24:33.578 UTC [msp] getPemMaterialFromDir -> DEBU 008 Inspecting file /var/hyperledger/orderer/msp/cacerts/ca.example.com-cert.pem
2017-08-22 13:24:33.578 UTC [msp] getPemMaterialFromDir -> DEBU 009 Reading directory /var/hyperledger/orderer/msp/admincerts
2017-08-22 13:24:33.578 UTC [msp] getPemMaterialFromDir -> DEBU 00a Inspecting file /var/hyperledger/orderer/msp/admincerts/Admin@example.com-cert.pem
2017-08-22 13:24:33.578 UTC [msp] getPemMaterialFromDir -> DEBU 00b Reading directory /var/hyperledger/orderer/msp/intermediatecerts
2017-08-22 13:24:33.578 UTC [msp] getMspConfig -> DEBU 00c Intermediate certs folder not found at [/var/hyperledger/orderer/msp/intermediatecerts]. Skipping. [stat /var/hyperledger/orderer/msp/intermediatecerts: no such file or directory]
2017-08-22 13:24:33.578 UTC [msp] getPemMaterialFromDir -> DEBU 00d Reading directory /var/hyperledger/orderer/msp/tlscacerts
2017-08-22 13:24:33.578 UTC [msp] getPemMaterialFromDir -> DEBU 00e Inspecting file /var/hyperledger/orderer/msp/tlscacerts/tlsca.example.com-cert.pem
2017-08-22 13:24:33.579 UTC [msp] getPemMaterialFromDir -> DEBU 00f Reading directory /var/hyperledger/orderer/msp/tlsintermediatecerts
2017-08-22 13:24:33.579 UTC [msp] getMspConfig -> DEBU 010 TLS intermediate certs folder not found at [/var/hyperledger/orderer/msp/tlsintermediatecerts]. Skipping. [stat /var/hyperledger/orderer/msp/tlsintermediatecerts: no such file or directory]
2017-08-22 13:24:33.579 UTC [msp] getPemMaterialFromDir -> DEBU 011 Reading directory /var/hyperledger/orderer/msp/crls
2017-08-22 13:24:33.579 UTC [msp] getMspConfig -> DEBU 012 crls folder not found at [/var/hyperledger/orderer/msp/crls]. Skipping. [stat /var/hyperledger/orderer/msp/crls: no such file or directory]
2017-08-22 13:24:33.579 UTC [msp] getMspConfig -> DEBU 013 MSP configuration file not found at [/var/hyperledger/orderer/msp/config.yaml]: [stat /var/hyperledger/orderer/msp/config.yaml: no such file or directory]
2017-08-22 13:24:33.579 UTC [msp] NewBccspMsp -> DEBU 014 Creating BCCSP-based MSP instance
2017-08-22 13:24:33.579 UTC [msp] GetLocalMSP -> DEBU 015 Created new local MSP
2017-08-22 13:24:33.579 UTC [msp] Setup -> DEBU 016 Setting up MSP instance OrdererMSP
2017-08-22 13:24:33.579 UTC [msp/identity] newIdentity -> DEBU 017 Creating identity instance for ID &{OrdererMSP acdb2548cf319bf1f33343ca692b77e27c37ed62cbee54781f3eddd83b6a918f}
2017-08-22 13:24:33.580 UTC [msp/identity] newIdentity -> DEBU 018 Creating identity instance for ID &{OrdererMSP 1687c8eece2d3177a8edd5954c7705ca32d75d1ce9a3b5254ff36dffc4e873b4}
2017-08-22 13:24:33.580 UTC [msp/identity] newIdentity -> DEBU 019 Creating identity instance for ID &{OrdererMSP 1687c8eece2d3177a8edd5954c7705ca32d75d1ce9a3b5254ff36dffc4e873b4}
2017-08-22 13:24:33.581 UTC [msp/identity] newIdentity -> DEBU 01a Creating identity instance for ID &{OrdererMSP 36ef22e61bccb5f9f750732c35bcacbf60b7f098f5283ca6b04419a1c7901a21}
2017-08-22 13:24:33.581 UTC [bccsp_sw] loadPrivateKey -> DEBU 01b Loading private key [1ba4dfae43e9131da5c2ce3873b5f5530013d2c619e14fd76d867ed200fbefaf] at [/var/hyperledger/orderer/msp/keystore/1ba4dfae43e9131da5c2ce3873b5f5530013d2c619e14fd76d867ed200fbefaf_sk]...
2017-08-22 13:24:33.581 UTC [msp/identity] newIdentity -> DEBU 01c Creating identity instance for ID &{OrdererMSP 36ef22e61bccb5f9f750732c35bcacbf60b7f098f5283ca6b04419a1c7901a21}
2017-08-22 13:24:33.582 UTC [msp] Validate -> DEBU 01d MSP OrdererMSP validating identity
2017-08-22 13:24:33.582 UTC [orderer/main] createLedgerFactory -> DEBU 01e Ledger dir: /var/hyperledger/production/orderer
2017-08-22 13:24:33.582 UTC [kvledger.util] CreateDirIfMissing -> DEBU 01f CreateDirIfMissing [/var/hyperledger/production/orderer/index/]
2017-08-22 13:24:33.582 UTC [kvledger.util] logDirStatus -> DEBU 020 Before creating dir - [/var/hyperledger/production/orderer/index/] does not exist
2017-08-22 13:24:33.582 UTC [kvledger.util] logDirStatus -> DEBU 021 After creating dir - [/var/hyperledger/production/orderer/index/] exists
panic: Unable to bootstrap orderer. Error unmarshalling genesis block: proto: can't skip unknown wire type 7 for common.Block

goroutine 1 [running]:
panic(0xb62660, 0xc42037e3d0)
          /opt/go/src/runtime/panic.go:500 +0x1a1
github.com/hyperledger/fabric/orderer/common/bootstrap/file.    (*fileBootstrapper).GenesisBlock(0xc42037e2f0, 0xc42037e2f0)
          /opt/gopath/src/github.com/hyperledger/fabric/orderer/common/bootstrap/file/bootstrap.go:49 +0x198
main.initializeBootstrapChannel(0xc4201dd440, 0x122e2a0, 0xc420386160)
      /opt/gopath/src/github.com/hyperledger/fabric/orderer/main.go:161 +0x759
main.initializeMultiChainManager(0xc4201dd440, 0x122aea0, 0x1272e88, 0xc4201d9e30, 0x1)
      /opt/gopath/src/github.com/hyperledger/fabric/orderer/main.go:210 +0xa0
main.main()
      /opt/gopath/src/github.com/hyperledger/fabric/orderer/main.go:75 +0x392

在我的情况下,无法安装主机路径,因为群集可以在不同的机器上运行。由于k8不支持递归配置映射,我使用归档文件解决了它。

这是我的 rc 清单:

apiVersion: v1
kind: ReplicationController
metadata:
  creationTimestamp: null
  labels:
    service: orderer-example-com
  name: orderer-example-com
  namespace: fabric
spec:
  replicas: 1
  selector:
    service: orderer-example-com
  template:
    metadata:
      creationTimestamp: null
      labels:
        service: orderer-example-com
    spec:
      containers:
      - command: ["/bin/sh", "-c", "mkdir -p /var/hyperledger/orderer && chmod +x /root/start_orderer.sh && /root/start_orderer.sh"]
        env:
        - name: ORDERER_GENERAL_GENESISMETHOD
          value: file
        - name: ORDERER_GENERAL_GENESISFILE
          value: /var/hyperledger/orderer/genesis.block
        - name: ORDERER_GENERAL_LOCALMSPID
          value: OrdererMSP
        - name: ORDERER_GENERAL_LOCALMSPDIR
          value: /var/hyperledger/orderer/msp

        - name: ORDERER_GENERAL_LISTENADDRESS
          value: 0.0.0.0
        - name: ORDERER_GENERAL_LOGLEVEL
          value: DEBUG
        - name: ORDERER_GENERAL_TLS_ENABLED
          value: "true"

        - name: ORDERER_GENERAL_TLS_PRIVATEKEY
          value: "/var/hyperledger/orderer/tls/server.key"
        - name: ORDERER_GENERAL_TLS_CERTIFICATE
          value: "/var/hyperledger/orderer/tls/server.crt"
        - name: ORDERER_GENERAL_TLS_ROOTCAS
          value: "[/var/hyperledger/orderer/tls/ca.crt]"
        image: hyperledger/fabric-orderer:x86_64-1.0.1
        name: orderer-example-com
        volumeMounts:
        - name: orderer-stuff-vol
          mountPath: /var/hyperledger/
        - name: start-orderer-vol
          mountPath: /root
        ports:
        - containerPort: 7050
        resources: {}
      restartPolicy: Always
      serviceAccountName: ""
      volumes:
      - name: start-orderer-vol
        configMap:
          name: start-orderer-cm
      - name: orderer-stuff-vol
        configMap:
          name: orderer-stuff-cm
status:
  replicas: 0

服务清单

apiVersion: v1
kind: Service
metadata:
  creationTimestamp: null
  name: orderer-example-com
  namespace: fabric
spec:
  type: NodePort
  ports:
   - name: "7050"
     nodePort: 30001
     port: 7050
     targetPort: 7050
  selector:
    service: orderer-example-com
status:
  loadBalancer: {}

这是我的 ConfigMaps

user@DESKTOP:~/bx_fabric/Separete_nodes/k8s$ kubectl -n fabric get cm
orderer-stuff-cm           2         22h
start-orderer-cm           1         1h

user@DESKTOP-BJJGP5A:~/bx_fabric/Separete_nodes/k8s$ ls -l orderer_stuff
total 12
-rw-rw---x 1 user user 9076 Aug 21 18:11 genesis.block
drwxrwxrwx 0 user user 512 Aug  7 17:48 msp
drwxrwxrwx 0 user user 512 Aug  7 17:55 tls

oleks@DESKTOP-BJJGP5A:~/bx_fabric/Separete_nodes/k8s$ cat start_orderer.sh
mkdir -p /var/hyperledger/orderer
tar -xvf /var/hyperledger/orderer_stuff.tar -C /var/hyperledger/orderer
chown -R root.root /var/hyperledger/orderer
orderer

拜托,你能帮助我找出这个错误的根本原因吗? 如果有任何其他数据需要,请告诉我。 谢谢

1 个答案:

答案 0 :(得分:0)

它已经解决了。 Genesis.block是二进制文件,configmap与bin文件无法正常工作。因此,我将Genesis.block作为秘密安装并且它起作用。问题已关闭