clustr 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +61 -3
- data/lib/clustr/adapter/simpledb.rb +1 -1
- data/lib/clustr/cli.rb +0 -23
- data/lib/clustr/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDBiODA5ZWYwODkxYzg1MDAzM2MwZjRiMGU5NWEwMWU3MDYwYjk0MA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTQxNDBhNzY3YzdlYjFjYTExYThiYjEwYThhMWI2MTliMGMzZTUwMA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YjIyYmM5ZTU0OWM2ODJmYTA0MjdhOWEzZGIzMjg5MmIzZWE5YWI3NjNmZGYw
|
10
|
+
ZDA3MDUyMTVmZDJlYWFkYTg3MjEzMWU3ZGEyNDdjNzkzYmU2ZDE5Nzc0YzQ4
|
11
|
+
YzI2YWIwMmVhYTk4OTFlOWEzM2RmZmQ0NGZhMTYxNGE1NDc1OGQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDNkMTU2ODM5ZTgxZDA3ZTU3YjNjMmFiYzI3MjI2NTEwN2Y1OTU2ZGZiNjcz
|
14
|
+
OWFkODY5ZTYzMjk1NzhmOWRiODgzMzE2YzQ2YzA3MDc4YzM2OWMzMGFkOTBh
|
15
|
+
OWY5ZWM4YmU0NjAyOTc1OWNlYTU4YjNmZDVmNjU1YjRmNjNmMDk=
|
data/README.md
CHANGED
@@ -1,8 +1,14 @@
|
|
1
1
|
# Clustr
|
2
2
|
|
3
|
-
[![Coverage Status](https://coveralls.io/repos/davidkelley/clustr/badge.png)](https://coveralls.io/r/davidkelley/clustr) [![Build Status](https://travis-ci.org/davidkelley/clustr.svg?branch=master)](https://travis-ci.org/davidkelley/clustr) [![Code Climate](https://codeclimate.com/github/davidkelley/clustr.png)](https://codeclimate.com/github/davidkelley/clustr) [![Dependency Status](https://gemnasium.com/davidkelley/clustr.svg)](https://gemnasium.com/davidkelley/clustr)
|
3
|
+
[![Coverage Status](https://coveralls.io/repos/davidkelley/clustr/badge.png)](https://coveralls.io/r/davidkelley/clustr) [![Build Status](https://travis-ci.org/davidkelley/clustr.svg?branch=master)](https://travis-ci.org/davidkelley/clustr) [![Code Climate](https://codeclimate.com/github/davidkelley/clustr.png)](https://codeclimate.com/github/davidkelley/clustr) [![Dependency Status](https://gemnasium.com/davidkelley/clustr.svg)](https://gemnasium.com/davidkelley/clustr) [![Gem Version](https://badge.fury.io/rb/clustr.svg)](http://badge.fury.io/rb/clustr)
|
4
4
|
|
5
|
-
|
5
|
+
Clustr provides the means to cluster servers together, by storing unique identifiers (and any additional information) for each node in a store, which in-turn is managed by an adapter that is configured by the user.
|
6
|
+
|
7
|
+
A server can belong to many different clusters (enables the use of [Docker](http://docker.io) containers), and is able to interrogate other clusters, aslong as they are correctly configured inside the configuration directory, `~/.clustr/`.
|
8
|
+
|
9
|
+
## Available Adapters
|
10
|
+
|
11
|
+
* __AWS SimpleDB__ - Uses a pre-existing domain, or creates one to store unique information about each node within the cluster.
|
6
12
|
|
7
13
|
## Installation
|
8
14
|
|
@@ -18,9 +24,61 @@ Or install it yourself as:
|
|
18
24
|
|
19
25
|
$ gem install clustr
|
20
26
|
|
27
|
+
## Configuring Clusters
|
28
|
+
|
29
|
+
If cluster files are defined inside the folder `~/.cluster`, where `~` represents your user home directory, they will be automatically detected and initialized.
|
30
|
+
|
31
|
+
Cluster files describe clusters that a node is able to join and/or retrieve information from, such as the clusters members.
|
32
|
+
|
33
|
+
### Adapter
|
34
|
+
|
35
|
+
The adapter key identifies how this cluster is formed, in the future I plan to implement DynamoDB as well as Memcached and MySQL. The adapter controls how information is extracted and inserted into the cluster at the lowest level.
|
36
|
+
|
37
|
+
### Key
|
38
|
+
|
39
|
+
Every cluster must contain a unique key, this helps to namespace individual clusters incase they are using the same underlying adapter. In most cases, the key can simply
|
40
|
+
be a unique domain or even a database table.
|
41
|
+
|
42
|
+
### Example
|
43
|
+
|
44
|
+
Given the following Cluster file `~/.clustr/rabbitmq`, with the content:
|
45
|
+
|
46
|
+
```
|
47
|
+
adapter=SimpleDB
|
48
|
+
key=my-simple-db-domain-daw9249ad
|
49
|
+
```
|
50
|
+
|
51
|
+
Clustr will automatically initialize a cluster named "rabbitmq" with a SimpleDB adapter pointing at the shared domain identified by the `key` value.
|
52
|
+
|
53
|
+
Clustr configuration files enable the gem to join the server to a cluster, as well as interrogate clusters that the server may not necessarily be a part of. Nodes are not joined to the cluster automatically, this must be done manually via the command line.
|
54
|
+
|
21
55
|
## Usage
|
22
56
|
|
23
|
-
|
57
|
+
*Depending upon the adapter that you use, you may need to setup your AWS Credentials, follow the instructions [here](http://aws.amazon.com/developers/getting-started/ruby/) to set them up.*
|
58
|
+
|
59
|
+
The command line arguments `--access-key-id`, `--secret-access-key` and `--region` also enable you to pass AWS credentials in with each individual command.
|
60
|
+
|
61
|
+
### Joining a Cluster
|
62
|
+
|
63
|
+
Given the [previous example](#example) where we setup a configuration file for a RabbitMQ cluster, we can join the node to the cluster using the command:
|
64
|
+
|
65
|
+
```
|
66
|
+
$ clustr join --clusters rabbitmq --id rabbit@`echo hostname` --access-key-id 0123456 --secret-access-key a0b1c2d3e4 --region eu-west-1
|
67
|
+
```
|
68
|
+
|
69
|
+
### Retrieving Members of a Cluster
|
70
|
+
|
71
|
+
Given the same previous example where a RabbitMQ cluster was defined, we can retrieve the list of members by their unique ID's (their hostname in this case) in a space delimited list, with the following command:
|
72
|
+
|
73
|
+
```
|
74
|
+
$ clustr list --cluster rabbitmq #=> rabbit@192-168-0-1 rabbit@192-168-0-5
|
75
|
+
```
|
76
|
+
|
77
|
+
Given this command, we could in practise combine this into the rabbitmqctl clustering command:
|
78
|
+
|
79
|
+
```
|
80
|
+
$ sudo rabbitmqctl cluster `clustr list --cluster rabbitmq`
|
81
|
+
```
|
24
82
|
|
25
83
|
## Contributing
|
26
84
|
|
@@ -11,7 +11,7 @@ module Clustr
|
|
11
11
|
# Initializes a new SimpleDB Adapter class. If the domain
|
12
12
|
# that has been defined in the @key attribute does not exist,
|
13
13
|
# it will create it.
|
14
|
-
def initialize
|
14
|
+
def initialize(*a)
|
15
15
|
super
|
16
16
|
sdb.domains.create(@key) unless domain.exists?
|
17
17
|
end
|
data/lib/clustr/cli.rb
CHANGED
@@ -26,7 +26,6 @@ module Clustr
|
|
26
26
|
# Set AWS Configuration if it has been passed in
|
27
27
|
config = ["access_key_id", "secret_access_key", "region"]
|
28
28
|
::AWS.config(options.select { |k| config.include?(k) })
|
29
|
-
describe_aws_configuration
|
30
29
|
end
|
31
30
|
|
32
31
|
desc "version", "Displays the current version number of Clustr."
|
@@ -68,27 +67,5 @@ module Clustr
|
|
68
67
|
@clusters ||= ClusterCollection.new(Config::Clusters.configuration)
|
69
68
|
end
|
70
69
|
|
71
|
-
def aws_configuration
|
72
|
-
AWS.config.credentials
|
73
|
-
end
|
74
|
-
|
75
|
-
def aws_configured?
|
76
|
-
begin
|
77
|
-
aws_configuration
|
78
|
-
rescue
|
79
|
-
false
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
def describe_aws_configuration
|
84
|
-
if aws_configured?
|
85
|
-
config = aws_configuration
|
86
|
-
Log.info "AWS Region #{config[:region]}"
|
87
|
-
Log.info "AWS Access Key #{config[:access_key_id]}"
|
88
|
-
else
|
89
|
-
Log.warn "No AWS config detected."
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
70
|
end
|
94
71
|
end
|
data/lib/clustr/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clustr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- davidkelley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|