command
Version:
v0.0.0-...-f98774e
Opens a new window with list of versions in this module.
Published: Nov 21, 2024
License: MIT
Opens a new window with license information.
Imports: 17
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
Simple HTTP-based key-value store example
This example demonstrates how easily you can implement an HTTP-based in-memory distributed
key value store using BRaft.
Usage
- Build example:
go install ./...
- Run nodes locally:
BRAFT_RPORT=15000 braft
BRAFT_RPORT=16000 braft
BRAFT_RPORT=17000 braft
- Put value on any node:
curl -X POST 'http://localhost:15002/kv?map=test&k=somekey&v=somevalue'
- Get value from all the nodes:
curl 'http://localhost:15002/kv?map=test&k=somekey'
curl 'http://localhost:16002/kv?map=test&k=somekey'
curl 'http://localhost:17002/kv?map=test&k=somekey'
- Distribute some items
gurl POST :15002/distribute
本机启动两个节点:
BRAFT_DISCOVERY=:15001,:16001 BRAFT_RPORT=15000 braft
BRAFT_DISCOVERY=:15001,:16001 BRAFT_RPORT=16000 braft
防火墙调整规则,模拟脑裂:
- 从防火墙拒绝对端的访问:
iptables -A INPUT -s 172.16.25.57 -j DROP
- 查询规则:
iptables -L -n --line-numbers
- 删除规则:
iptables -D INPUT 1
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.