8000 GitHub - x-junkang/waterbugdb: Raft + Postgres parser + Postgres wire protocol + Boltdb + ? = Distributed PostgreSQL
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Raft + Postgres parser + Postgres wire protocol + Boltdb + ? = Distributed PostgreSQL

Notifications You must be signed in to change notification settings

x-junkang/waterbugdb

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WaterbugDB

Terminal 1:

$ go build
$ ./waterbugdb --node-id node1 --raft-port 2222 --http-port 8222 --pg-port 6000

Terminal 2:

$ go build
$ ./waterbugdb --node-id node2 --raft-port 2223 --http-port 8223 --pg-port 6001

Terminal 3, tell 1 to have 2 follow it:

$ curl 'localhost:8222/add-follower?addr=localhost:2223&id=node2'

Terminal 3, now open psql:

$ psql -h localhost -p 6000
psql -h 127.0.0.1 -p 6000
psql (13.4, server 0.0.0)
Type "help" for help.

phil=> create table x (age int, name text);
CREATE ok
phil=> insert into x values(14, 'garry'), (20, 'ted');
could not interpret result from server: INSERT ok
INSERT ok
phil=> select name, age from x;
  name   | age 
---------+-----
 "garry" |  14
 "ted"   |  20
(2 rows)

Now exit psql and connect to the other database at port 6001. It will fail if you try to write to it but SELECTs will work:

$ psql -h 127.0.0.1 -p 6001
psql (13.4, server 0.0.0)
Type "help" for help.

phil=> select age, name from x;
 age |  name
-----+---------
  20 | "ted"
  14 | "garry"
(2 rows)

References

About

Raft + Postgres parser + Postgres wire protocol + Boltdb + ? = Distributed PostgreSQL

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%
0