Skip to content

mage/mage-testproject-sharding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mage-testproject-sharding

Simple project demonstrating how the mage-module-shard module can be used.

Installation

git clone https://github.com/mage/mage-testproject-sharding.git
cd mage-testproject-sharding
npm install 

Running a cluster

You will need to open multiple terminal windows.

Zookeeper

Zookeeper will be used to coordinate the nodes between each others.

In a first terminal, run:

npm run zookeeper

Nodes

In a second terminal, run

npm run cluster node1 start
npm run cluster node2 start
# ...

Feel free to start as many nodes as you want. Then, start one last node, in development mode ''

npm run cluster node0 develop

We will be emitting sharded calls to our cluster from this REPL interface.

Running a sharded module method

From node0's development console:

const mod = mage.sharded
shard = mod.createShard('4')
shard.getModuleId().then((id) => console.log(id))

License

MIT

Releases

No releases published

Packages

No packages published