hyperledger-archives / fabric

THIS IS A READ-ONLY historic repository. Current development is at https://gerrit.hyperledger.org/r/#/admin/projects/fabric . pull requests not accepted
https://gerrit.hyperledger.org/
Apache License 2.0
1.17k stars 1.01k forks source link

Four Peer PBFT Network Not Storing Blockchain Data #1764

Open jusrah opened 8 years ago

jusrah commented 8 years ago

Description: When running a four peer network using pbft consensus inside one Vagrant instance, the /var/hyperledger/production/db file is not being created or updated. When one peer using noops is run, the file is created after running 'make peer.'

My blockchain data is stored in RAM, and is not moved to a permanent storage location. So that when the peers are turned off, the data is lost.

I have not run this with each peer on its own computer.

To recreate: In fabric/peer/core.yaml -privacy: false -security: false -peer.id: vp0, vp1, vp2, vp3 -peer.consensus.plugin: pbft In fabric/consensus/obcpbft/config.yaml -general.mode: batch -general."N": 4 -general.f: 1 follow instruction from DevNet-Setup See if /var/hyperledger/production/db exists.

yacovm commented 8 years ago

What commit are you using? I can't seem to reproduce it:

username@host:~/OBC/shared/gopath/src/github.com/hyperledger/fabric$ sudo rm -rf  /var/hyperledger/production/db/
username@host:~/OBC/shared/gopath/src/github.com/hyperledger/fabric$ grep privacy peer/core.yaml 
    # To enable privacy of transactions (requires security to be enabled). This
    privacy: false
username@host:~/OBC/shared/gopath/src/github.com/hyperledger/fabric$ head -400 peer/core.yaml  | tail -20

        # configurations for 'trie'
        # 'tire' has no additional configurations exposed as yet

###############################################################################
#
#    Security section - Applied to all entities (client, NVP, VP)
#
###############################################################################
security:
    # Enable security will force every entity on the network to enroll with obc-ca
    # and maintain a valid set of certificates in order to communicate with
    # other peers
    enabled: false
    # To enroll NVP or VP with membersrvc. These parameters are for 1 time use.
    # They will not be valid on subsequent times without un-enroll first.
    # The values come from off-line registration with obc-ca. For testing, make
    # sure the values are in membersrvc/membersrvc.yaml file eca.users
    enrollID: vp
username@host:~/OBC/shared/gopath/src/github.com/hyperledger/fabric$ grep plugin peer/core.yaml 
    # it is enabled, what consensus plugin to load
            # Consensus plugin to use. The value is the name of the plugin, e.g. pbft, noops ( this value is case-insensitive)
            plugin: pbft
username@host:~/OBC/shared/gopath/src/github.com/hyperledger/fabric$ egrep "mode|N" consensus/obcpbft/config.yaml 
#   - Nest keys where appropriate, and sort alphabetically for easier parsing.
    # Operational mode: batch, classic, or sieve ( this value is case-insensitive)
    mode: batch
    # Keep the "N" in quotes, or it will be interpreted as "false".
    "N": 4
    # Number of byzantine nodes we will tolerate
    # How many requests should the primary send per pre-prepare when in "batch" mode
#   SECTION: EXECUTOR
username@host:~/OBC/shared/gopath/src/github.com/hyperledger/fabric$ egrep "f:" consensus/obcpbft/config.yaml 
    f: 1
username@host:~/OBC/shared/gopath/src/github.com/hyperledger/fabric$ ll /var/hyperledger/production/db
ls: cannot access /var/hyperledger/production/db: No such file or directory
username@host:~/OBC/shared/gopath/src/github.com/hyperledger/fabric$ CORE_VM_ENDPOINT=http://172.17.0.1:2375  CORE_PEER_ID=vp0  CORE_PEER_ADDRESSAUTODETECT=true peer/peer node start &> /dev/null &
[1] 6589
username@host:~/OBC/shared/gopath/src/github.com/hyperledger/fabric$ 
username@host:~/OBC/shared/gopath/src/github.com/hyperledger/fabric$ ll /var/hyperledger/production/db
total 8876
drwxr-xr-x 2 username username  4096 יונ 13 11:30 ./
drwxr-xr-x 3 username username  4096 יונ 13 11:30 ../
-rw-r--r-- 1 username username   152 יונ 13 11:30 000006.log
-rw-r--r-- 1 username username    16 יונ 13 11:30 CURRENT
-rw-r--r-- 1 username username    37 יונ 13 11:30 IDENTITY
-rw-r--r-- 1 username username     0 יונ 13 11:30 LOCK
-rw-r--r-- 1 username username 44225 יונ 13 11:30 LOG
-rw-r--r-- 1 username username 11806 יונ 13 11:30 LOG.old.1465806600436468
-rw-r--r-- 1 username username   343 יונ 13 11:30 MANIFEST-000005
jusrah commented 8 years ago

I was using commit 64037b9 previously.

I'm rebuilding now using commit 5b6e766 now. Once my rebuild is complete, I'll change my config files, and report back with screen shots if there is still an issue.

Are you developing outside of Vagrant? I see that your lines start with hostname@host instead of vagrant@hyperledger. Could that potentially cause my problem?

yacovm commented 8 years ago

Yeah, outside.

It's really weird the DB isn't being created. What is the filesystemPath config set to? According to: https://github.com/hyperledger/fabric/blob/5f39a0566e9f7bbf7e31ffcd898716edf4c4330e/core/db/db.go#L101 You should notice that the db folder isn't created

jusrah commented 8 years ago

I've done vagrant destroy -> vagrant up -> vagrant ssh Following your example:

vagrant@hyperledger-devenv:v0.0.10-5b6e766:/opt/gopath/src/github.com/hyperledger/fabric$ sudo rm -rf /var/hyperledger/production/db vagrant@hyperledger-devenv:v0.0.10-5b6e766:/opt/gopath/src/github.com/hyperledger/fabric$ egrep "fileSystemPath" peer/core.yaml fileSystemPath: /var/hyperledger/production vagrant@hyperledger-devenv:v0.0.10-5b6e766:/opt/gopath/src/github.com/hyperledger/fabric$ grep privacy peer/core.yaml privacy: false vagrant@hyperledger-devenv:v0.0.10-5b6e766:/opt/gopath/src/github.com/hyperledger/fabric$ head -400 peer/core.yaml | tail -20 security:

Enable security will force every entity on the network to enroll with obc-ca

# and maintain a valid set of certificates in order to communicate with
# other peers
enabled: false
# To enroll NVP or VP with membersrvc. These parameters are for 1 time use.
# They will not be valid on subsequent times without un-enroll first.
# The values come from off-line registration with obc-ca. For testing, make
# sure the values are in membersrvc/membersrvc.yaml file eca.users
enrollID: vp
enrollSecret: f3489fy98ghf
# To enable privacy of transactions (requires security to be enabled). This
# encrypts the transaction content during transit and at rest. The state
# data is also encrypted
privacy: false

vagrant@hyperledger-devenv:v0.0.10-5b6e766:/opt/gopath/src/github.com/hyperledger/fabric$ grep plugin peer/core.yaml plugin: pbft vagrant@hyperledger-devenv:v0.0.10-5b6e766:/opt/gopath/src/github.com/hyperledger/fabric$ egrep "mode|N" consensus/obcpbft/config.yaml

Operational mode: batch, classic, or sieve ( this value is case-insensitive)

mode: batch
# Keep the "N" in quotes, or it will be interpreted as "false".
"N": 4

vagrant@hyperledger-devenv:v0.0.10-5b6e766:/opt/gopath/src/github.com/hyperledger/fabric$ egrep "f:" consensus/obcpbft/config.yaml f: 1 vagrant@hyperledger-devenv:v0.0.10-5b6e766:/opt/gopath/src/github.com/hyperledger/fabric$ ll /var/hyperledger/production/db ls: cannot access /var/hyperledger/production/db: No such file or directory

vagrant@hyperledger-devenv:v0.0.10-5b6e766:/opt/gopath/src/github.com/hyperledger/fabric$ make peer-image Building build/docker/bin/peer Building docker peer-image cp build/docker/bin/peer build/image/peer/bin docker build -t hyperledger/fabric-peer:latest build/image/peer Sending build context to Docker daemon 26.88 MB Step 1 : FROM hyperledger/fabric-src:latest ---> 9ad8b6a8b8da Step 2 : RUN mkdir -p /var/hyperledger/db ---> Running in 010aa6086ba1 ---> 9a6683282fc5 Removing intermediate container 010aa6086ba1 Step 3 : COPY bin/* $GOPATH/bin/ ---> ebb1728e5e3c Removing intermediate container ef0bfaf5afb9 Step 4 : WORKDIR $GOPATH/src/github.com/hyperledger/fabric ---> Running in f0fabd45af16 ---> 9ffc04deed6a Removing intermediate container f0fabd45af16 Successfully built 9ffc04deed6a rm build/docker/bin/peer vagrant@hyperledger-devenv:v0.0.10-5b6e766:/opt/gopath/src/github.com/hyperledger/fabric$ ll /var/hyperledger/db ls: cannot access /var/hyperledger/db: No such file or directory vagrant@hyperledger-devenv:v0.0.10-5b6e766:/opt/gopath/src/github.com/hyperledger/fabric$ ll /var/hyperledger/production/db ls: cannot access /var/hyperledger/production/db: No such file or directory vagrant@hyperledger-devenv:v0.0.10-5b6e766:/opt/gopath/src/github.com/hyperledger/fabric$ ll /var/hyperledger/db ls: cannot access /var/hyperledger/db: No such file or directory

I can see where it's things that it is creating a folder in the /var/hyperledger/db location, but there is no folder there. There is a mismatch in the file system path and what make peer-image tries to create, but these configurations come straight from commit 5b6e766.

christo4ferris commented 8 years ago

@jusrah can you please try to reproduce with https://github.com/hyperledger/fabric/tree/v0.5-developer-preview?