Cassandra

Il db non relazionale creato da facebook e usato anche da altri social network

È fatto in java e adatto ad essere replicato, l'installazione non è proprio immediata conviene forse usare apt-get

http://www.salaserver.com/10599/installare-cassandra-su-un-server-debian/

http://www.booom.it/wordpress/tag/ubuntu/

Getting Started

from the official getting started guide http://cassandra.apache.org/doc/latest/getting_started/. I didn't like so much the apache documentation the commercial one seems better https://academy.datastax.com

  • cassandra.yaml in this file you can find useful information about the cluster , usually is in /etc/cassandra but depends from your installation
  • connect to the cluster with cqlsh, 9042 is the default port
cqlsh ipaddress 9042 -u myusername -p mypassword
  • list the cluster
cassandra@cqlsh> SELECT cluster_name, listen_address FROM system.local;

 cluster_name | listen_address
--------------+----------------
 my_cluster01 |      10.0.5.55

(1 rows)

all nodes cluster stauts

nodetool status

information of one node only

nodetool info

list all the keyspaces in the cluster

cassandra@cqlsh> DESCRIBE KEYSPACES;

Backup and restore

http://docs.datastax.com/en/opscenter/6.0/opsc/online_help/services/opscBackupService.html

  • Opscenter is in able to save the backup to a directory or an s3 bucket

Dump and restore

connect with csql
and copy the tables structures

myuser@cqlsh> use use mykeyspacename;
myuser@cqlsh>DESCRIBE TABLES ;
mytableone mytable2 mytable3
myuser@cqlsh> DESCRIBE mytableone 
CREATE TABLE mykeyspacename.mytableone {
..............................
}

dump each table in a different file

myuser@cqlsh> copy mykeyspacename.mytableone to '/mypath/myfilename-mytableone .dat' with delimiter=';' AND QUOTE = '''' AND ESCAPE = '''' AND NULL = '<null>';
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License