tradle / multi-hyperbee

A LevelUP compatible leaderless multi-master database with eventual consistency, using hyperbee + CRDT + HLC. Similarly CockroachDB achieves replication on top of RocksDB, but here it is a pure P2P **streaming** database, with zero central management. LevelDB compatibility allows to use Dynalite on top to achieve DynamoDB compatibility with sophisticated auto-updated secondary indexes, and fairly complex queries. Work on Dynalite is almost completed to remove HTTP server, to make this combination perfect for serverless.
36 stars 5 forks source link

Data inserted in one machine is not replicated to another machine of the same local network (example.js) #14

Open raphael10-collab opened 3 years ago

raphael10-collab commented 3 years ago

I tried to execute example.js with two machines belonging to the same local network:

(laptop) :

(base) marco@marco-U36SG:~/hypercore/multi-hyperbee/examples$ node example.js -s laptop
laptop diff key: db4a84cb045286941aa499e3bce94b725cbf17ffc4115c3c76a2f84e558bedad

(pc) :

(base) raphy@pc:~/hypercore/multi-hyperbee/examples$ node example.js -s pc
pc diff key: fc733af1328096be2403d1b903f7f546d77fd5938e215cd8c3627e3b2682c5c7

And then, on the (pc) :

(base) raphy@pc:~/hypercore/multi-hyperbee/examples$ node example.js -s laptop,pc -k db4a84cb045286941aa499e3bce94b725cbf17ffc4115c3c76a2f84e558bedad,fc733af1328096be2403d1b903f7f546d77fd5938e215cd8c3627e3b2682c5c7
laptop,pc diff key: 9ea4dec61b2babd7573ab435d0f1e2a5ab1c08fdce5b68f33e4915b93981d378
Please enter some data
first_data
second_data
third_data

I get this folders structure on the (pc) :

(base) raphy@pc:~/hypercore/multi-hyperbee/examples$ ls -lah
total 44K
drwxrwxr-x  8 raphy raphy 4,0K set 24 17:56 .
drwxrwxr-x 15 raphy raphy 4,0K set 18 12:07 ..
-rw-rw-r--  1 raphy raphy 2,2K set 13 20:00 example.js
drwxrwxr-x  2 raphy raphy 4,0K set 24 17:56 laptop,pc
drwxrwxr-x  2 raphy raphy 4,0K set 24 17:56 laptop,pc_diff
drwxrwxr-x  2 raphy raphy 4,0K set 24 17:56 laptop,pc_peer_1
drwxrwxr-x  2 raphy raphy 4,0K set 24 17:56 laptop,pc_peer_2
-rw-rw-r--  1 raphy raphy  560 set 14 09:24 multi_hyperbee_usage.js
drwxrwxr-x  2 raphy raphy 4,0K set 24 17:54 pc
drwxrwxr-x  2 raphy raphy 4,0K set 24 17:54 pc_diff
-rw-rw-r--  1 raphy raphy  963 set 13 20:00 Readme.md

and in (pc) the content of laptop,pc/data :

(base) raphy@pc:~/hypercore/multi-hyperbee/examples/laptop,pc$ nano data :

^Hhyperbee^R
^G__peers
^E
^C
^A^A^R^G__peers^ZD["db4a84cb045286941aa499e3bce94b725cbf17ffc4115c3c76a2f84e558bedad"]
^E
^C
^A^B^R^G__peers^Z�^A["db4a84cb045286941aa499e3bce94b725cbf17ffc4115c3c76a2f84e558bedad","fc733af1328096be2403d1b903f7f546d77fd5938e215cd8c3627e3b2682c5c7"]
^F
^D
^B^B^C^R^Mlaptop,pc_123^Z�^A{"firstName":"J","lastName":"S","someField":0.8112948903023212,"friends":["Claire","Martha","Jake","Sean"],"_objectId":"laptop,pc_123","_timestamp":"2021-09-24T15:56:42>
^G
^E
^C^B^C^D^R^Slaptop,pc_firstdata^Zd{"text":"first_data","_objectId":"laptop,pc_firstdata","_timestamp":"2021-09-24T15:56:51.753Z-0000"}
^H
^F
^D^B^C^D^E^R^Tlaptop,pc_seconddata^Zf{"text":"second_data","_objectId":"laptop,pc_seconddata","_timestamp":"2021-09-24T15:56:55.336Z-0000"}

^G
^E^B^C^D^E^F^R^Slaptop,pc_thirddata^Zd{"text":"third_data","_objectId":"laptop,pc_thirddata","_timestamp":"2021-09-24T15:56:58.056Z-0000"}

But the data inserted has not been replicated to the second machine (the laptop):

(base) marco@marco-U36SG:~/hypercore/multi-hyperbee/examples$ ls -lah
total 24K
drwxrwxr-x  4 marco marco 4,0K set 24 17:50 .
drwxrwxr-x 11 marco marco 4,0K set 14 09:43 ..
-rw-rw-r--  1 marco marco 2,2K set 13 21:01 example.js
drwxrwxr-x  2 marco marco 4,0K set 24 17:50 laptop
drwxrwxr-x  2 marco marco 4,0K set 24 17:50 laptop_diff
-rw-rw-r--  1 marco marco  963 set 13 21:01 Readme.md
(base) marco@marco-U36SG:~/hypercore/multi-hyperbee/examples/laptop$ nano data
^Hhyperbee^R
^G__peers

Is this fine, or have I done something wrong, and / or is an issue of my local network, may be blocking multicast traffic, as suggested here https://github.com/kappa-db/workshop/issues/30#issuecomment-922337475 ?