]> git.saurik.com Git - redis.git/blame - client-libraries/ruby/bin/distredis
max inline request raised again to 1024*1024*256 bytes
[redis.git] / client-libraries / ruby / bin / distredis
CommitLineData
ed9b544e 1require 'fileutils'
2
3class RedisCluster
4
5 def initialize(opts={})
6 opts = {:port => 6379, :host => 'localhost', :basedir => "#{Dir.pwd}/rdsrv" }.merge(opts)
7 FileUtils.mkdir_p opts[:basedir]
8 opts[:size].times do |i|
9 port = opts[:port] + i
10 FileUtils.mkdir_p "#{opts[:basedir]}/#{port}"
11 File.open("#{opts[:basedir]}/#{port}.conf", 'w'){|f| f.write(make_config(port, "#{opts[:basedir]}/#{port}", "#{opts[:basedir]}/#{port}.log"))}
12 system(%Q{#{File.join(File.expand_path(File.dirname(__FILE__)), "../redis/redis-server #{opts[:basedir]}/#{port}.conf &" )}})
13 end
14 end
15
16 def make_config(port=6379, data=port, logfile='stdout', loglevel='debug')
17 config = %Q{
18timeout 300
19save 900 1
20save 300 10
21save 60 10000
22dir #{data}
23loglevel #{loglevel}
24logfile #{logfile}
25databases 16
26port #{port}
27 }
28 end
29
30end
31
32
33RedisCluster.new :size => 4