1 # Redis lookups and quoting in cluster mode
4 echo Setting up 2-node cluster...
5 sudo rm -fr DIR/redis-cluster
6 mkdir -p DIR/redis-cluster/node1 DIR/redis-cluster/node2
10 system 'redis-server --bind 127.0.0.1 --port 6379 --cluster-enabled yes --cluster-config-file node1.conf --dir DIR/redis-cluster/node1 --logfile node1.log --daemonize yes --pidfile node1.pid --loglevel debug';
15 system 'redis-server --bind 127.0.0.1 --port 6380 --cluster-enabled yes --cluster-config-file node2.conf --dir DIR/redis-cluster/node2 --logfile node2.log --daemonize yes --pidfile node2.pid --loglevel debug';
19 echo Creating slots, node1
21 system 'for x in {0..8191}; do echo "CLUSTER ADDSLOTS $x" | redis-cli -p 6379 | egrep -v OK; done';
24 echo Creating slots, node2
26 system 'for x in {8192..16383}; do echo "CLUSTER ADDSLOTS $x" | redis-cli -p 6380 | egrep -v OK; done';
29 echo Sending CLUSTER MEET
31 system 'echo "CLUSTER MEET 127.0.0.1 6380" | redis-cli -p 6379 -c';
34 exim -be -d-all+expand+lookup
35 ${lookup redis{set ${quote_redis:KEY_100_1001 ABCDEF} ${quote_redis:objvalue plus}}}
36 ${lookup redis{set ${quote_redis:01t67it} ${quote_redis:bfhdkbflks}}}
39 exim -be -d-all+expand+lookup
40 ${lookup redis{get ${quote_redis:KEY_100_1001 ABCDEF}}}
41 ${lookup redis{get ${quote_redis:01t67it}}}
46 my @pidfiles = ( "DIR/redis-cluster/node1/node1.pid", "DIR/redis-cluster/node2/
47 foreach my $pidfile (@pidfiles) {
49 open (my $fh, "<", $pidfile);
50 while (my $pid = <$fh>) {
57 sudo rm -fr DIR/redis-cluster