-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathREADME
More file actions
33 lines (25 loc) · 924 Bytes
/
README
File metadata and controls
33 lines (25 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
An implementation of dynamo in Python. A work in progress.
Usage
==============
storage_node.py -p 20050
storage_node.py -p 20051
storage_node.py -p 20052
load_balancer.py -s 127.0.0.1:20050 -s 127.0.0.1:20051 -s 127.0.0.1:20052
In [1]: import xmlrpclib
In [2]: proxy = xmlrpclib.ServerProxy('http://localhost:30000')
In [3]: proxy.put("john", "novatnack")
Out[3]: '200'
In [4]: proxy.put("john", "a later novatnack")
Out[4]: '200'
In [5]: proxy.get("john")
Out[5]: 'a later novatnack'
Two load balancers:
load_balancer.py -s 127.0.0.1:20050 -s 127.0.0.1:20051 -s 127.0.0.1:20052
load_balancer.py -s 127.0.0.1:20050 -s 127.0.0.1:20051 -s 127.0.0.1:20052 -p 30001
Now they can both be queried:
In [17]: proxy = xmlrpclib.ServerProxy('http://localhost:30000')
In [18]: proxy2 = xmlrpclib.ServerProxy('http://localhost:30001')
In [19]: proxy.put('abc', '123')
Out[19]: '200'
In [20]: proxy2.get('abc')
Out[20]: '123'