Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
import time
import rediscluster
CHANNEL = 'chat'
COUNT = 1000
SLEEP = 0.01
startup_nodes = [{'host':'127.0.0.1', 'port': 7000}]
import rediscluster
import threading
import time
import random
startup_nodes = [
{'host':'127.0.0.1', 'port': 7000},
{'host':'127.0.0.1', 'port': 7001},
{'host':'127.0.0.1', 'port': 7002},
diff --git a/rediscluster/pipeline.py b/rediscluster/pipeline.py
index 2106e70..a13e867 100644
--- a/rediscluster/pipeline.py
+++ b/rediscluster/pipeline.py
@@ -175,6 +175,8 @@ class StrictClusterPipeline(StrictRedisCluster):
if i in ask_retry:
track_cmds[node_name].append(None)
cmds.append((['ASKING'], {}))
+ print "ASKING ... threaded"
+
from rediscluster import RedisCluster
startup_nodes = [{"host": "127.0.0.1", "port": 7000}]
r = RedisCluster(startup_nodes=startup_nodes, max_connections=32, decode_responses=True)
for i in xrange(1000000):
d = str(i)
pipe = r.pipeline(transaction=False)
pipe.set(d, d)
pipe.incrby(d, 1)
from rediscluster import RedisCluster
startup_nodes = [{"host": "127.0.0.1", "port": 7000}]
r = RedisCluster(startup_nodes=startup_nodes, max_connections=32, decode_responses=True)
for i in xrange(1000000):
d = str(i)
r.set(d, d)
res = r.get(d)
if res != d:
from rediscluster import RedisCluster
startup_nodes = [{"host": "127.0.0.1", "port": 7000}]
r = RedisCluster(startup_nodes=startup_nodes, max_connections=32, decode_responses=True)
for i in xrange(1000000):
d = str(i)
r.set(d, d)
r.incrby(d, 1)
from rediscluster import RedisCluster
startup_nodes = [{"host": "127.0.0.1", "port": 7000}]
r = RedisCluster(startup_nodes=startup_nodes, max_connections=32, decode_responses=True)
N = 1000000
p = 0
pdiff = 1
progress = 0
@72squared
72squared / test-rediscluster.py
Last active October 6, 2015 16:03
rediscluster test script
import rediscluster
import threading
import time
import random
startup_nodes = [
{'host':'127.0.0.1', 'port': 7000},
{'host':'127.0.0.1', 'port': 7001},
{'host':'127.0.0.1', 'port': 7002},
]
#!/usr/bin/env python
import redis
import rediscluster
import argparse
def main(srcs, dsts, verbose=False):
srcs = [redis.StrictRedis(**host) for host in srcs]
if len(dsts) > 1:
$ redis-trib check :7000
Connecting to node :7000: OK
Connecting to node 172.31.14.27:7001: OK
Connecting to node 172.31.12.228:7001: [ERR] Sorry, can't connect to node 172.31.12.228:7001
OK
Connecting to node 172.31.12.228:7002: [ERR] Sorry, can't connect to node 172.31.12.228:7002
OK
Connecting to node 172.31.12.228:7000: [ERR] Sorry, can't connect to node 172.31.12.228:7000
OK
Connecting to node 172.31.14.27:7000: OK