Skip to content
Newer
Older
100644 71 lines (49 sloc) 2.22 KB
b77696c @lpgauth Added proper error/excption handling + minor refactor
lpgauth authored Feb 20, 2012
1 ## Cassanderl version 0.4 ##
2
c1b759e @jlouis Provide configuration documentation.
authored Jul 10, 2012
3 ## Configuration ##
4
5 To start cassanderl, you will need to configure a section in your
6 application config file:
7
8 {cassanderl,
9 [{hostname, "cassandra.talented-startup.com"},
10 {port, 9160},
11 {default_keyspace, "big_data"},
12 {worker_pool_size, 10}
13 ]},
14
15 The options are as follows:
16
17 * `hostname` - The hostname to connect to
18 * `port` - The port to connect to. Cassandra RPC is on port 9160 by default
19 * `default_keyspace` - If you omit setting a keyspace, this keyspace
20 will be used for a newly formed connection.
21 * `worker_pool_size` - The size of the worker pool. How many concurrent
22 resource-connections do you allow to the cassandra cluster.
23
24 Second, you will need to start up cassanderl (or make it part of your
25 boot script):
26
27 application:start(cassanderl).
28
29 ## Example of Usage ##
3fb03ca @lpgauth Update README.md
lpgauth authored Feb 20, 2012
30
2b8e7d8 @jlouis Update README.md with more information.
authored Jul 12, 2012
31 To use Cassanderl, you must first ask it for the current
32 configuration.
33
34 {ok, Config} = cassanderl:get_info().
35
36 This will return the current dispatcher configuration. Cassanderl
37 spawns a pool of dispatchers by default which it then uses whenever
38 you want to access your Cassandra cluster. The hostname and portname
39 of the cluster will be the defaults as well when doing this.
40
41 To issue a call to Cassandra, issue:
42
3fb03ca @lpgauth Update README.md
lpgauth authored Feb 20, 2012
43 cassanderl:call(Config, describe_keyspace, ["keyspace1"]).
22e8240 @lpgauth Use markup for REAME
lpgauth authored May 3, 2011
44
2b8e7d8 @jlouis Update README.md with more information.
authored Jul 12, 2012
45 Which performs a low-level call to Cassandra with the given
46 configuration, the given (thrift) method and the given parameters to
47 the call.
48
49 The module `cassanderl` has certain helpers as well for often-executed
50 functions.
51
52 ### Commands ###
53
54 ### Add ###
55
56 To issue an `add` towards Cassandra, do the following:
57
58 {ok, Config} = cassanderl:get_info(),
59 CP = cassanderl:column_parent(<<"superhero_stats">>),
60 {ok, CassandraResult} =
61 add(Config, <<"gotham city">>, CP, {<<"batmans_spotted">>, 7}, 1).
62
63 In this example, we first generate a "column parent" for the column
64 family. There are no super-columns here, so just referring to the
65 superhero stats is enough. The `CP` acts like an accessor pattern on
66 the data we wish to update and can be reused in subsequent calls if we
67 want.
68
69 Finally, we increment a counter on the *Gotham City* row. We spotted
70 some Batmans. The last parameter is the consistency level desired.
Something went wrong with that request. Please try again.