57

In a company I work for we are dealing with similar amount of data (around 10 TBs of realtime searchable data). We solve this with Cassandra and I would like to mention couple of ideas that will allow you to do O(1) search on a multi TBs database. This is not specific to Cassandra db though, you can use it with other db as well. Theory Shard your data. ...


41

If I was going to put this into SQL Server, I would suggest a table something like: CREATE TABLE tcp_traffic ( tcp_traffic_id bigint constraint PK_tcp_traffic primary key clustered IDENTITY(1,1) , tcp_flags smallint /* at most 9 bits in TCP, so use SMALLINT */ , src_as int /* Since there are less than 2 billion A.S.'s possible, use INT ...


14

You can index collection types in cassandra 2.1 and later. You are after: SELECT * FROM <table> WHERE <field> CONTAINS <value_in_list/map/set> Detailed example: cqlsh> USE ks; cqlsh:ks> CREATE TABLE data_points ( id text PRIMARY KEY, created_at timestamp, previous_event_id varchar, ...


14

In general, a well designed cluster can live for YEARS without being touched. I've had clusters that ran for years hands-off. However, here are some guidelines: Monitoring is hugely important: 1) Monitor latencies. Use opscenter or your favorite metrics tools to keep track of latencies. Latencies going up can be signs of problems coming, including GC ...


12

The whole point of NoSQL is that it doesn't use the same type of datastructures as an SQL database. It requires a whole different way of thinking and approach with your app, so there isn't something to handily copy the schema over because it is going to be unique to your solution.


10

cqlsh -k mykeyspace -e 'COPY fromTable(columnNames) TO STDOUT' | head -n -1 | cqlsh -k mykeyspace -e 'COPY toTable(columnNames) FROM STDIN'


10

The issue you are having here, is that you are using docs to explore Cassandra that are for version 2.0 and 2.1. My guess is that you are probably using Cassandra 3.0. In that case, you will need to query the system_schema keyspace for the "keyspaces" table: cassandra@cqlsh:system_schema> SELECT * FROM system_schema.keyspaces; keyspace_name | ...


9

In looking through the documentation, I am having a hard time finding a reference for this, but the short answer is "yes" you need to run nodetool repair on each node in your cluster. The closest I can find is the documentation on repairing nodes which suggests that you should not run repair on more than one node in your cluster at a time. You can also run ...


8

Sounds like my Cassandra Cluster Admin is exactly what you want! Take a look at it here: https://github.com/sebgiroux/Cassandra-Cluster-Admin


8

Right now the table only has about 320k records and I can use ALLOW FILTERING with no problem, but I realize this might not always be the case. So here's the thing: Cassandra is very good at querying data by a specific key. It is also good at retrieving a range of data within a partition. "SELECT * FROM {}.{} WHERE timestamp > {} ALLOW FILTERING;" But ...


6

I'm not a fan. It's about as good an idea as creating a relational table named OrdersOrCustomers with columns defined for both. The storage-engine penalty is slightly lower in Cassandra because of the sparse-cell storage under the hood, but it's still bad practice. This bites you later when you want to map/reduce over your data; each task will have to ...


6

This really depends on your requirements. Many systems built on top of open source products are rock solid. Note that your example does not impress me - Twitter is not reliable at all by my customers' standards - it has frequent downtimes, it loses tweets and followers, its search is not 100% correct etc. I work in finances, and my job is to develop robust ...


6

Cassandra 1.0 uses a minimum of 1MB of heap per CF. So, 1000 or 2000 CFs will be okay for typical heap sizes, but 10000 will probably not be. JVM GC does poorly with very large heaps; I recommend staying under 8GB.


6

I created a chat program a while back which is available on github https://github.com/akc42/MBChat which has some of the characteristics you are talking about. In particular it provides both rooms which people can enter and discuss on an open way, and whisper boxes where a few people can get together and discuss things. When people enter a room, or join ...


6

With a Cassandra index (i.e. a "secondary index", as opposed to primary keys), each node has to query its own local data for responding to a query (see the Cassandra secondary indexexes FAQ). These index are also built using a background process. This backgrounding means that the index may return false negatives in terms of hits (or false positives in ...


6

Schema design in Cassandra, for efficient tables, will grate against your RDBMS experience; for efficiency, the Cassandra prefers denormalization, not normalization. By this, I mean that if you have some user information and you want to look up that data using two different primary keys, then using Cassandra, it actually is better to use two tables (and ...


6

when there is no Primary Key specified in the WHERE clause, how does the Coordinator know which nodes to send the requests to? It doesn't. The (node chosen as the) coordinator has to scan all rows for that table on each and every node. That's why unbound queries are considered to be an anti-pattern in Cassandra, as they incur a lot of network time. ...


5

Great question! There's a handful of ways of doing this, depending on how deeply you want to be involved in the configuration and long term maintenance. You certainly could use Cassandra on top of an encrypted filesystem, such as TrueCrypt or eCryptfs, and it should function normally. While possible, it's a little complicated to set up encrypted filesystem ...


5

If you are using MySQL as the main database, you may want to consider using a Star Topology via MySQL Replication. Now, before you say UGHHH, ROFL and OMG to MySQL Replication, hear me out. A star topology allows you to write to one DB server (called a Distribution Mster [DM]) and send the SQL commands to several DB servers. How do you setup such a DB ...


5

I would recommend HBase. You can store all the raw data in one or more HBase tables, depending on what you need to query. HBase can handle large data-sets and does auto-sharding through region splits. In addition, if you design row keys well, you can get extremely fast, even O(1) queries. Note that if you are retrieving a large data set, that is still ...


5

The best way to think of a cassandra database is not as a set of databases on different nodes, but as one single database. Adding the column to the first node adds it to all other nodes. The actual number of times your data is written is determined by your replication strategy and replication factor, but each copy of the data will be the same. Thus, if you ...


5

The easiest (non-invasive) way is probably to download the tarball installation (you'll need to select either a Mac or Linux-based OS for it to allow you to download the tarball). Based-on your mention of disabling the service, I'm going to guess that you want to accomplish this on Windows. If that's not the case, please indicate so in the comments. Un-...


5

How it behaves depends on your configuration, what version of Cassandra you use, and how you run the repair command. If you just run nodetool repair on a single node in a cluster it will repair all of the data (token ranges) that node is responsible for and also the other nodes that are responsible for that data. So for example, if you were to run the ...


5

You can use check Java Heap memory for each node. Like Total Java Heap Memory and Using Java Heap Memory. One most important is CPU Utilization for each node. Set alerts for errors. system.log have lots of information about. You may set alerts for data disk and log disk. Heartbeat check of servers like if you dont receive in few min it will get alerts to ...


5

In my clusters, I use jolokia so I can access JMX interface using HTTP. This way I can create scripts with Python that monitor Cassandra and send alerts to Nagios. What you should monitor: Java HEAP and GC Compactions pending Flushes pending Hinted Handoff pending Gossip Tasks pending Read / Write latency Key cache hit rate Down end point count Monitoring ...


5

Despite the mainstream of noSQL databases IMHO the decision about adopting such technology should be made according to the achievements needed according to the information stored, not only attending to the performance you currently have. This means that maybe your best option is to stick to the SQL database and improve your HW. But additionally I read ...


5

There is a new system keyspace called "system_schema", but there are only two tables in it: Ok something must have gone wrong in your upgrade, because that's not right. When I check my system_schema 3.4, I see this: [cqlsh 5.0.1 | Cassandra 3.4 | CQL spec 3.4.0 | Native protocol v4] Use HELP for help. aploetz@cqlsh> use system_schema ; aploetz@cqlsh:...


5

As per Datastax documentation, Warning: DataStax recommends stopping repair operations during topology changes; the Repair Service does this automatically. Repairs running during a topology change are likely to error when it involves moving ranges. So, it is clear that topology changes (adding/removing nodes) are not recommended when there is a repair ...


4

You can try to make each node unique for some of the ports, but this isn't really a good path to go down. Cassandra nodes need to see each other on the ports listed here for the best setup: http://www.datastax.com/documentation/cassandra/1.2/index.html#cassandra/security/secureFireWall_r.html One option that I have seen work well is a host VPN like Openswan:...


4

There's a lot to consider. I'm going to narrow this down to a single problem and offer one solution, although there's many approaches. Problem: You need AD-HOC queries on lots of rows. First, setup a server to handle writes and a replicated slave (running some flavor of MySQL 5.5.x) to handle reads. My personal preference is Percona Server. Your mileage ...


Only top voted, non community-wiki answers of a minimum length are eligible