Skip to content

Instantly share code, notes, and snippets.

@72squared
72squared / elasticslap.php
Created May 31, 2012 16:16
load generator for elasticsearch ... needs php5.3 with curl, and git://github.com/gaiaops/gaia_core_php.git
#!/usr/bin/env php
<?php
# to get the included library, you need php5.3 with curl installed.
# then do:
# git clone git://github.com/gaiaops/gaia_core_php.git
# this gives you the http library used in this test script:
# https://github.com/gaiaops/gaia_core_php/blob/master/lib/gaia/http/request.php
# https://github.com/gaiaops/gaia_core_php/blob/master/lib/gaia/http/pool.php
#
# This include path should point to the git repo cloned in the instructions above.
#!/usr/bin/env php
<?php
# to get the included library, you need php5.3 with curl installed.
# dependency on gaia_core_php http branch.
# download: https://github.com/downloads/gaiaops/gaia_core_php/gaia_core_php.http_branch.phar
# place the phar archive in the same dir as this script.
spl_autoload_register(function($classname) {
$class = strtolower($classname);
if( substr( $class, 0, 5) == 'gaia\\' )
@72squared
72squared / gist:2844635
Created May 31, 2012 16:38
elasticslap output
[jloehrer@dev-1-1 test]$ php elasticslap.php --host=nosql-1-1.sv3:9200 --store=4 --fetch=4 --parallel=2 --verbose=2
781326 -- owner: 394, amount: 67
688586 -- owner: 155, amount: 24
stdClass Object
(
[request_header] => PUT /test/test/688586 HTTP/1.1
Host: nosql-1-1.sv3:9200
Accept: */*
@72squared
72squared / gist:2844667
Created May 31, 2012 16:44
error from elasticslap on running php elasticslap.php --host=nosql-1-1.sv3:9200 --fetch=100000 --parallel=10
exception 'Gaia\Exception' with message 'error' in /home/jloehrer/gaia_web/public_html/test/elasticslap.php:83
Stack trace:
#0 phar:///home/jloehrer/gaia_web/public_html/test/gaia_core_php.http_branch.phar/gaia/http/pool.php(58): {closure}(Object(Gaia\Http\Request))
#1 phar:///home/jloehrer/gaia_web/public_html/test/gaia_core_php.http_branch.phar/gaia/http/pool.php(118): Gaia\Http\Pool->handle(Object(Gaia\Http\Request))
#2 phar:///home/jloehrer/gaia_web/public_html/test/gaia_core_php.http_branch.phar/gaia/http/pool.php(82): Gaia\Http\Pool->poll()
#3 /home/jloehrer/gaia_web/public_html/test/elasticslap.php(180): Gaia\Http\Pool->select(1)
#4 {main}
Debug:
# Gaia\Http\Request Object
# (
git diff rediscluster/client.py
diff --git a/rediscluster/client.py b/rediscluster/client.py
index 7405dad..aeee4a8 100644
--- a/rediscluster/client.py
+++ b/rediscluster/client.py
@@ -60,6 +60,28 @@ class RedisCluster(StrictRedis):
"""
RedisClusterRequestTTL = 16
+
~$ py.test tests/test_cluster_obj.py
====================================== test session starts =======================================
platform darwin -- Python 2.7.8 -- py-1.4.24 -- pytest-2.6.2
collected 18 items
tests/test_cluster_obj.py ................F.
============================================ FAILURES ============================================
_____________________________________ test_moved_redirection _____________________________________
$ 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
#!/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:
@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},
]
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