You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A toolkit for parsing, creating and doing other fun stuff with Cassandra 3.x SSTables. This project is under heavy development and not yet stable.
5
+
A toolkit for parsing, creating and doing other fun stuff with Cassandra 3.x SSTables. This project is under development and not yet stable.
6
6
7
7
Pre compiled binary available from bintray:
8
8
9
-
*[sstable-tools-3.0.0-alpha2.jar](https://bintray.com/artifact/download/tolbertam/sstable-tools/sstable-tools-3.0.0-alpha2.jar) - Currently tested with 3.0, 3.1, 3.1.1, 3.2.1, 3.3.
9
+
*[sstable-tools-3.0.0-alpha3.jar](https://bintray.com/artifact/download/tolbertam/sstable-tools/sstable-tools-3.0.0-alpha3.jar) - Currently tested with 3.0, 3.1, 3.1.1, 3.2.1, 3.3.
SSTable max local deletion time: 2147483647 (01/18/2038 21:14:07)
70
79
TTL min: 0 (0 milliseconds)
71
80
...[snip]...
72
-
73
-
>>>>>>> update readme a little
74
-
**Note:** No environment configuration is necessary for this tool to work if all components of the sstable are available but the cql create statement allows for more details.
75
-
76
-
**Note:** CQL statements require bash escaping when using the "select" command via command line ```java -jar sstable-tools.jar select \* from \"path\"```
77
81
82
+
## Paging is enabled by default and can be manipulated by using 'PAGING'
83
+
cqlsh> PAGING 20;
84
+
Now Query paging is enabled
85
+
Page size: 20
86
+
cqlsh> PAGING OFF;
87
+
Disabled Query paging.
88
+
cqlsh> PAGING ON;
89
+
Now Query paging is enabled
90
+
Page size: 20
91
+
92
+
## Used sstables, schema, and paging settings and persisted for future use.
93
+
## Use the 'PERSIST' command to view preferences and to enable/disable
94
+
## persistence.
95
+
cqlsh> PERSIST;
96
+
Preferences are currently enabled:
97
+
pagingEnabled=true
98
+
pagingSize=20
99
+
preferencesEnabled=true
100
+
schema=""
101
+
sstables=[
102
+
"/home/user/sstable-tools/ma--big-Data.db"
103
+
]
104
+
cqlsh> PERSIST OFF;
105
+
Disabled Preferences.
78
106
79
-
see more below
107
+
**Note:** No environment configuration is necessary for this tool to work if all components of the sstable are available but the cql create statement allows for more details.
80
108
81
109
**Features:**
82
110
111
+
*[cqlsh](#cqlsh) - Drop into an interactive shell to make queries against SSTables.
112
+
*[describe](#describe) - Describe SSTable data and metadata.
83
113
*[sstable2json](#sstable2json) - Utility for exporting C\* 3.X SSTables into JSON.
84
-
*[select](#select) - Make CQL queries against SSTables
85
114
86
115
## Building
87
116
@@ -95,36 +124,58 @@ mvn package
95
124
The executable jar will be present in the target directory.
96
125
97
126
## cqlsh
98
-
cql shell similiar and modeled after the C* cqlsh tool. This will allow issuing cql queries against raw sstables and
99
-
providing additional diagnostic tools over them. Provides history (reverse searchable with ctrl-r) for ease of use.
127
+
cql shell similiar and modeled after the C* cqlsh tool. Enables issuing cql queries against raw sstables and
128
+
provides additional diagnostic tools over them. Provides history (reverse searchable with ctrl-r) for ease of use.
100
129
101
130
```text
102
-
EXIT - leaves the shell (also ctrl-d on prompt, ctrl-c to break back to blank prompt)
103
-
CREATE TABLE ... - A CREATE TABLE cql statement to use as metadata when reading sstables (HIGHLY RECOMMENDED!)
104
-
DESCRIBE SCHEMA - Show currently used schema (or serialized cfmetadata if generated)
105
-
DESCRIBE SSTABLES - Provide details and statistics on current sstable(s)
106
-
USE - update the sstable[s] used by default with select, dump, describe commands
131
+
Commands:
132
+
133
+
HELP - prints this message
134
+
EXIT - leaves the shell
135
+
CREATE TABLE ... - A CREATE TABLE cql statement to use as metadata when reading sstables (HIGHLY RECOMMENDED!)
136
+
DESCRIBE SCHEMA - Show currently used schema (or serialized cfmetadata if generated)
137
+
DESCRIBE SSTABLES - Provide details and statistics on current sstable(s)
138
+
PAGING [(ON|OFF)] - Enables, disables, or shows current status of query paging.
139
+
PAGING <SIZE> - Enables paging and sets paging size.
140
+
PERSIST [(ON|OFF)] - Enables, disables, or shows current status of persistence of settings state.
141
+
SCHEMA [<FILE>] - Imports a cql file as the active table schema or shows active user-defined schema.
142
+
USE - update the sstable[s] used by default with select, dump, describe commands
107
143
USE /var/lib/cassandra/data/system/peers/ma-1-big-Data.db
108
144
or with multiple sstables separated with spaces. This can also be a directory which will add all sstables in it.
109
145
USE ma-1-big-Data.db ma-2-big-Data.db "/home/path with space/db/data/sstables"
110
146
111
-
SELECT - run a cql query against the current sstable (unless other specified)
147
+
SELECT - run a cql query against the current sstable (unless other specified)
112
148
SELECT * FROM sstables WHERE key > 1 LIMIT 10
113
149
the keyword sstables will use the current sstable set with the USE command or set when running cqlsh. You can also
114
150
specify an sstable here
115
151
SELECT avg(someColumn) FROM /var/lib/cassandra/data/system/peers/ma-1-big-Data.db WHERE key > 1
116
152
117
-
DUMP - dump the raw unfiltered partitions/rows. Useful for debuging TTLed/tombstoned data.
153
+
DUMP - dump the raw unfiltered partitions/rows. Useful for debuging TTLed/tombstoned data.
118
154
DUMP;
119
155
Can also specify a where clause for filtering the results.
120
156
DUMP WHERE partitionKey = 'OpsCenter';
121
157
```
122
158
159
+
## describe
160
+
161
+
Provides information about an sstable's data and its metadata.
sstable2json is a utility in the spirit of the [original sstable2json](https://docs.datastax.com/en/cassandra/1.2/cassandra/tools/toolsSstable2JsonUtilsTOC.html)
126
-
which has since been deprecated ([CASSANDRA-9618](https://issues.apache.org/jira/browse/CASSANDRA-9618))
127
-
and has since been entirely removed with plans to add a replacement ([CASSANDRA-7464](https://issues.apache.org/jira/browse/CASSANDRA-7464)).
177
+
which was previously deprecated ([CASSANDRA-9618](https://issues.apache.org/jira/browse/CASSANDRA-9618)).
178
+
This functionality was merged into cassandra by ([CASSANDRA-7464](https://issues.apache.org/jira/browse/CASSANDRA-7464)) and to be released in Cassandra 3.0.4 and 3.4. This will likely be removed from sstable-tools in a future release.
128
179
129
180
A key differentiator between the storage format between older verisons of
130
181
Cassandra and Cassandra 3.0 is that an SSTable was previously a representation
@@ -217,159 +268,6 @@ which represent deletes. In Cassandra 3.0, users can now delete ranges of
Use the CQL parser to query the sstables directly without Cassandra or any configuration. Does not currently support ORDER_BY and DISTINCT but all other features should work. It will search the classpath for a ```schema.cql``` (override with ```-Dsstabletools.schema=...```) that contains the CQL ```CREATE TABLE``` statement for the schema. If it cannot find one it will fall back to a best guess from the sstable metadata. The data is dumped as a result set in a data table, but to see the raw data set the ```-Dquery.toJson``` for the alternative output.
228
-
229
-
**WARNING:** without the schema the queries become difficult for any partition/clustering columns as their names are not included in meta data yet (CASSANDRA-9587)
230
-
231
-
### Usage
232
-
233
-
```
234
-
java -jar sstable-tools.jar SELECT ...
235
-
236
-
usage: SELECT <column selection> FROM <sstable> WHERE <where clause>
237
-
```
238
-
239
-
240
-
### Examples
241
-
242
-
With a schema.cql file:
243
-
```CQL
244
-
CREATETABLEmykeyspace.users (
245
-
user_name varcharPRIMARY KEY,
246
-
password varchar,
247
-
gender varchar,
248
-
state varchar,
249
-
birth_year bigint
250
-
);
251
-
```
252
-
253
-
An example that selects users by birth year and state
254
-
255
-
```json
256
-
java -jar sstable-tools.jar SELECT * FROM ma-2-big-Data.db WHERE birth_year >= 1985 AND state = 'CA'
0 commit comments