Download - Cassandra Lan party
Meetup CassandraLan Party
Sommaire
● Rappels● Installation réseau et logiciels● Configuration du cluster● Tests
Who’s who
● Gérald Quintanao @gerald_quintana o [email protected] Formateur Cassandra
Rappels
Key Features
Elastic scalabilityAlways on
architectureFast linear-scale
performance
Flexible data storageEasy data
distributionOperational
simplicityTransaction support
Cluster
● Noeudso 1 seul typeo 1 IP
● Configurationo cassandra.yamlo cassandra-env.sho log4j.properties
● Donnéeso CommitLogo Datao Saved cacheso Log
Column oriented data model
Keyspace Table(ColumnFamily)
Row:Row key
Column:Clustering key
ValueTTL
Map<PartKey, SortedMap<ClustKey, Column>>
Username Timestamp Message Status
gquintana 2015-01-15 Meetup Speaking
jdoe 2015-01-15 Meetup
jdoe 2015-01-16 HolidaysPartition
Row Key
Primary Key
Partition & Consistent hashing
● Hash(Row Key) → Token● Noeud → Plage de tokens
Replication
Virtual nodes
Multi datacenters
● Physiqueso Distribution géographiqueo Failover
● Logiqueso Live backupo Analytique (OLAP)
● Sans ETL● Replication factor
Réplication: Combien?
● Niveau keyspacecreate keyspace meetup with replication={ 'class':'NetworkTopologyStrategy', 'lyon':2,'paris':2};
Réplication: Où?
● Niveau node:o SimpleSnitcho RackInferringSnitch
+ IP 10.dc.rc.no PropertyFileSnitch
+ cassandra-topology.propertieso GossipingPropertyFileSnitch
+ cassandra-rackdc.propertieso EC2Snitch, GoogleCloudSnitch, CloudstackSnitch
Notre cluster
Lyon10.1.rc.n
Paris10.2.rc.n
OpsCenter10.1.0.1
Au boulot!
Etape 1 Copier/Télécharger
● Java 7● Python 2.6+
o https://www.python.org/downloads/release/python-279/ (ou bien paquets apt-get, yum)
● Cassandra 2.0 DSC (DataStax Community) o http://planetcassandra.org/cassandra/o http://downloads.datastax.com/community/dsc-cass
andra-2.0.11-bin.tar.gz
● DataStax OpsCenter Agento http://downloads.datastax.com/community/datastax-
agent-5.0.2.tar.gz
● Injecteur
Etape 2 Configurer le réseau
● Désactiver le Wifi & le firewall● Configurer l’IP de manière statique
o IP 10.dc.rc.no Masque 255.0.0.0
● Pinguer & se faire pinguer
Etape 3 Installer
● Java: JAVA_HOME, java -version● Python: python --version● Cassandra
o Si besoin, supprimer les data● OpsCenter Agent● Synchroniser les horloges
Ne pas démarrer Cassandra
Etape 4a Configurer Cassandra
● cassandra.yamlo cluster_name: 'meetup'o listen_address: 10.dc.rc.no rpc_address: 0.0.0.0o seed_provider.parameters.seeds:
10.1.1.1, 10.1.1.2, 10.2.1.1o endpoint_snitch: GossipingPropertyFileSnitcho commitlog_directory, data_file_directories,
saved_caches_directory
Ne pas démarrer Cassandra
Etape 4b Configurer Cassandra
● cassandra-rackdc.propertieso dc=lyon|paris, rack=RAC1
● log4-server.propertieso ...File=log/system.log
● Vérifier la configuration du voisin
Ne pas démarrer Cassandra
Etape 5 Configurer DataStax Agent
● datastax-agent.bato set JAR=datastax-agent-5.0.2-standalone.jar
● address.yamlo stomp_interface: '10.1.0.1'o local_interface: '10.dc.rc.n'
Etape 6 Démarrer Cassandra
● Attendre le Go● Démarrer Cassandra puis l’Agent● Surveiller les logs● Surveiller l’état
o du noeud nodetool infoo du cluster nodetool statuso des tokens nodetool ring
● Surveiller OpsCenter
Etape 7 Initialiser le schéma
create keyspace meetupwith replication={ 'class':'NetworkTopologyStrategy', 'lyon':2,'paris':2};
create table metric ( host varchar, name varchar, date timestamp, value bigint, primary key ((host,name),date));
Etape 7 Insérer des données
● Avec cqlsh
● Démarrer l’injecteur
describe keyspaces;describe keyspace meetup;use meetup;describe tables;describe table metric;select * from metric;insert into metric(host,name,date,value) values ('localhost','cpu',dateOf(now()), 12);
Scénario 1 Perte d’un noeud
● Hinted handoff
● Surveillero notetool statuso OpsCentero cqlsh
select * from system.hints
Scénario 2 Ajout d’un noeud
● Streaming
● Surveillero Cluster: nodetool statuso Streaming: nodetool netstatso OpsCenter
Scénario 3 Perte d’un datacenter
● Surveillero notetool statuso OpsCenter
Conclusion
● Les vertues de Cassandrao Tolérance aux panneso Scalabilité linéaireo Configuration Simple
● Reset configuration réseauo Configuration IPo Réactiver firewall