Simple project demonstrating how the mage-module-shard
module can be used.
git clone https://github.com/mage/mage-testproject-sharding.git
cd mage-testproject-sharding
npm install
You will need to open multiple terminal windows.
Zookeeper will be used to coordinate the nodes between each others.
In a first terminal, run:
npm run zookeeper
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.
From node0's development console:
const mod = mage.sharded
shard = mod.createShard('4')
shard.getModuleId().then((id) => console.log(id))
MIT