Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 98 lines (72 sloc) 3.085 kb
4ed26a8 @mwynholds Add a link for navigation on github.
mwynholds authored
1 **IMPORTANT**: If you are reading this on the main ActiveColumn page on github, please go to
f8700c2 @mwynholds Fix typo in link.
mwynholds authored
2 [the actual README page](./active_column/blob/master/README.md) so that links bring you to the right place.
4ed26a8 @mwynholds Add a link for navigation on github.
mwynholds authored
3
0f38720 @mwynholds Add some docs.
mwynholds authored
4 # ActiveColumn
5
e561145 @mwynholds Add yard gem, and update docs for time line support and migrations.
mwynholds authored
6 ActiveColumn is a framework for working with data in Cassandra. It currently includes two features:
7
8 - Database migrations
9 - "Time line" model data management
10
390bb9d @mwynholds Rename some files.
mwynholds authored
11 Data migrations are very similar to those in ActiveRecord, and are documented in [Migrate](./docs/Migrate.md).
e561145 @mwynholds Add yard gem, and update docs for time line support and migrations.
mwynholds authored
12
13 Time line data management is loosely based on concepts in ActiveRecord, but is adapted to saving data in which rows in
14 Cassandra grow indefinitely over time, such as in the oft-used Twitter example for Cassandra. This usage is documented
15 in:
16
390bb9d @mwynholds Rename some files.
mwynholds authored
17 - [Create](./docs/Create.md) - how to create data
e561145 @mwynholds Add yard gem, and update docs for time line support and migrations.
mwynholds authored
18 - [Query](./docs/Query.md) - how to find data
0f38720 @mwynholds Add some docs.
mwynholds authored
19
20 ## Installation
21
22 Add ActiveColumn to your Gemfile:
23 <pre>
24 gem 'active_column'
25 </pre>
26
27 Install with bundler:
28 <pre>
29 bundle install
30 </pre>
31
32 ## Usage
33
34 ### Configuration
35
70493a2 @mwynholds Update README
mwynholds authored
36 ActiveColumn requires Cassandra 0.7 or above, as well as the [cassandra gem](https://github.com/fauna/cassandra),
37 version 0.9 or above. You must also be sure to use the Cassandra 0.7 support in the gem, which can be done by
38 adding Cassandra to your Gemfile like this:
39 <pre>
40 gem 'cassandra', '>= 0.9', :require => 'cassandra/0.7'
41 </pre>
0f38720 @mwynholds Add some docs.
mwynholds authored
42
e561145 @mwynholds Add yard gem, and update docs for time line support and migrations.
mwynholds authored
43 Data migrations in ActiveColumn are used within a Rails project, and are driven off of a configuration file,
44 config/cassandra.yml. It should look something like this:
0f38720 @mwynholds Add some docs.
mwynholds authored
45
e561145 @mwynholds Add yard gem, and update docs for time line support and migrations.
mwynholds authored
46 _config/cassandra.yml_
0f38720 @mwynholds Add some docs.
mwynholds authored
47 <pre>
48 test:
49 servers: "127.0.0.1:9160"
50 keyspace: "myapp_test"
51 thrift:
52 timeout: 3
53 retries: 2
54
55 development:
56 servers: "127.0.0.1:9160"
57 keyspace: "myapp_development"
58 thrift:
59 timeout: 3
60 retries: 2
61 </pre>
62
5c289f5 updated documentations
elzoiddy authored
63 You can use embedded ruby code in the YAML file to determine host/machine specific settings.
64
65 <pre>
66 production:
f0d2a13 escape < and >
elzoiddy authored
67 servers: "&lt;%=get_from_file('abc.conf')%&gt;:9160"
68 keyspace: "&lt;%=get_from_file('abc.conf')%&gt;"
5c289f5 updated documentations
elzoiddy authored
69 disable_node_auto_discovery: true
70 thrift:
71 timeout: 3
72 retries: 2
73 </pre>
74
75 Node Auto Discovery
76
77 You can set disable_node_auto_discovery to off by setting disable_node_auto_discovery flag in your cassandra.yml
78
e561145 @mwynholds Add yard gem, and update docs for time line support and migrations.
mwynholds authored
79 In order to get time line modeling support, you must provide ActiveColumn with an instance of a Cassandra object.
80 Since you have your cassandra.yml from above, you can do this very simply like this:
81
82
83 _config/initializers/cassandra.rb_
0f38720 @mwynholds Add some docs.
mwynholds authored
84 <pre>
85 config = YAML.load_file(Rails.root.join("config", "cassandra.yml"))[Rails.env]
86 $cassandra = Cassandra.new(config['keyspace'],
87 config['servers'],
88 config['thrift'])
89
90 ActiveColumn.connection = $cassandra
91 </pre>
92
93 As you can see, I create a global $cassandra variable, which I use in my tests to validate data directly in Cassandra.
94
95 One other thing to note is that you obviously must have Cassandra installed and running! Please take a look at the
96 [mama_cass gem](https://github.com/carbonfive/mama_cass) for a quick way to get up and running with Cassandra for
70493a2 @mwynholds Update README
mwynholds authored
97 development and testing.
Something went wrong with that request. Please try again.