herdis 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +71 -0
- data/assets/shepherd.png +0 -0
- metadata +16 -14
data/README.md
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
# Herdis
|
2
|
+
|
3
|
+
Herdis is a simplistic Redis cluster manager based on
|
4
|
+
[Redis Presharding](http://antirez.com/post/redis-presharding.html) described in antirez blog.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
### Ruby
|
9
|
+
|
10
|
+
We use Ruby 1.9.3.
|
11
|
+
|
12
|
+
To install and run on your local machine use [RVM](https://rvm.beginrescueend.com/).
|
13
|
+
For Mac machines make sure you compile with gcc-4.2 (because the compiler from Xcode doesn't compile Ruby 1.9.3 properly).
|
14
|
+
Download and install gcc from https://github.com/kennethreitz/osx-gcc-installer
|
15
|
+
|
16
|
+
$ gem install rvm
|
17
|
+
$ rvm install 1.9.3
|
18
|
+
|
19
|
+
And for Macs
|
20
|
+
|
21
|
+
$ rvm install 1.9.3 --with-gcc=gcc-4.2
|
22
|
+
|
23
|
+
### Rubygems
|
24
|
+
|
25
|
+
Use [Bundler](http://gembundler.com/) to install the gems needed by Herdis
|
26
|
+
|
27
|
+
$ bundle install
|
28
|
+
|
29
|
+
### Redis
|
30
|
+
|
31
|
+
Herdis naturally needs [Redis](http://redis.io/) to run. Install it and put redis-server in your $PATH.
|
32
|
+
|
33
|
+
## Running
|
34
|
+
|
35
|
+
The `bin/herdis` script runs a [Goliath](https://github.com/postrank-labs/goliath/) server with standard Goliath
|
36
|
+
parameters such as `-p` for port selection, `-s` for logging to STDOUT, `-v` for verbose logging etc.
|
37
|
+
|
38
|
+
The server also uses a set of ENV variables to control its configuration:
|
39
|
+
|
40
|
+
* `SHEPHERD_FIRST_PORT` for the first port to run Redis instances on. Defaults to `9080`.
|
41
|
+
* `SHEPHERD_DIR` for the directory to put Redis dumps and pidfiles in. Defaults to `$HOME/.herdis`.
|
42
|
+
* `SHEPHERD_ID` for the id of the server to start. Defaults to a random string.
|
43
|
+
* `SHEPHERD_INMEMORY` to run a server managing only non-persistent Redis instances. Defaults to `false`
|
44
|
+
* `SHEPHERD_REDUNDANCY` to define number of backups to maintain of each shard. Defaults to `2`.
|
45
|
+
* `SHEPHERD_CONNECT_TO` to define another server to connect to on startup. Defaults to `nil`.
|
46
|
+
|
47
|
+
To actually start the server, simply
|
48
|
+
|
49
|
+
$ bin/herdis
|
50
|
+
|
51
|
+
## Using
|
52
|
+
|
53
|
+
To use it you `require 'herdis/client'` and then instantiate a `Herdis::Client` which will act just like a `Redis::Distributed`.
|
54
|
+
|
55
|
+
require 'herdis/client'
|
56
|
+
|
57
|
+
client = Herdis::Client.new("http://localhost:9000")
|
58
|
+
client.set("test", "value")
|
59
|
+
raise "this should work, for example" unless client.get("test") == "value"
|
60
|
+
|
61
|
+
If you have a cluster of herdis nodes, you can give all their addresses to the new `Herdis::Client` when you start it (`Herdis::Client.new(url1, url2, url3... urln)`), that way it will keep trying until it finds one that works (if you want to be able to restart your clients even if the cluster is currently maimed).
|
62
|
+
|
63
|
+
## Test suite
|
64
|
+
|
65
|
+
$ rake
|
66
|
+
|
67
|
+
## Console
|
68
|
+
|
69
|
+
To run an eventmachine-friendly console to test your servers from IRB
|
70
|
+
|
71
|
+
$ bundle exec em-console
|
data/assets/shepherd.png
ADDED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: herdis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hiredis
|
16
|
-
requirement: &
|
16
|
+
requirement: &70144567540360 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70144567540360
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: em-synchrony
|
27
|
-
requirement: &
|
27
|
+
requirement: &70144567539740 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70144567539740
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: em-http-request
|
38
|
-
requirement: &
|
38
|
+
requirement: &70144567539300 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70144567539300
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: redis
|
49
|
-
requirement: &
|
49
|
+
requirement: &70144567538880 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70144567538880
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: yajl-ruby
|
60
|
-
requirement: &
|
60
|
+
requirement: &70144567538440 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70144567538440
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: goliath
|
71
|
-
requirement: &
|
71
|
+
requirement: &70144567538000 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70144567538000
|
80
80
|
description: ! 'A Redis herder for simplifying Redis presharding
|
81
81
|
|
82
82
|
'
|
@@ -106,6 +106,8 @@ files:
|
|
106
106
|
- lib/herdis/rmerge.rb
|
107
107
|
- lib/herdis/server.rb
|
108
108
|
- lib/herdis/shepherd.rb
|
109
|
+
- README.md
|
110
|
+
- assets/shepherd.png
|
109
111
|
- bin/herdis
|
110
112
|
homepage: http://github.com/zond/herdis
|
111
113
|
licenses: []
|