https://github.com/mage/mage-testproject-sharding
Test project demonstarting https://github.com/mage/mage-module-shard
https://github.com/mage/mage-testproject-sharding
Last synced: 3 months ago
JSON representation
Test project demonstarting https://github.com/mage/mage-module-shard
- Host: GitHub
- URL: https://github.com/mage/mage-testproject-sharding
- Owner: mage
- Created: 2017-07-20T07:13:57.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-07-21T11:06:21.000Z (almost 8 years ago)
- Last Synced: 2025-01-13T15:17:10.126Z (5 months ago)
- Language: JavaScript
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# mage-testproject-sharding
Simple project demonstrating how the `mage-module-shard`
module can be used.## Installation
```shell
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:
```shell
npm run zookeeper
```### Nodes
In a second terminal, run
```shell
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 ''```shell
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:
```javascript
const mod = mage.sharded
shard = mod.createShard('4')
shard.getModuleId().then((id) => console.log(id))
```License
-------MIT