Top Banner
Meetup Cassandra Lan Party
28
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Cassandra Lan party

Meetup CassandraLan Party

Page 2: Cassandra Lan party

Sommaire

● Rappels● Installation réseau et logiciels● Configuration du cluster● Tests

Page 3: Cassandra Lan party

Who’s who

● Gérald Quintanao @gerald_quintana o [email protected] Formateur Cassandra

Page 4: Cassandra Lan party

Rappels

Page 5: Cassandra Lan party

Key Features

Elastic scalabilityAlways on

architectureFast linear-scale

performance

Flexible data storageEasy data

distributionOperational

simplicityTransaction support

Page 6: Cassandra Lan party

Cluster

● Noeudso 1 seul typeo 1 IP

● Configurationo cassandra.yamlo cassandra-env.sho log4j.properties

● Donnéeso CommitLogo Datao Saved cacheso Log

Page 7: Cassandra Lan party

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

Page 8: Cassandra Lan party

Partition & Consistent hashing

● Hash(Row Key) → Token● Noeud → Plage de tokens

Page 9: Cassandra Lan party

Replication

Page 10: Cassandra Lan party

Virtual nodes

Page 11: Cassandra Lan party

Multi datacenters

● Physiqueso Distribution géographiqueo Failover

● Logiqueso Live backupo Analytique (OLAP)

● Sans ETL● Replication factor

Page 12: Cassandra Lan party

Réplication: Combien?

● Niveau keyspacecreate keyspace meetup with replication={ 'class':'NetworkTopologyStrategy', 'lyon':2,'paris':2};

Page 13: Cassandra Lan party

Réplication: Où?

● Niveau node:o SimpleSnitcho RackInferringSnitch

+ IP 10.dc.rc.no PropertyFileSnitch

+ cassandra-topology.propertieso GossipingPropertyFileSnitch

+ cassandra-rackdc.propertieso EC2Snitch, GoogleCloudSnitch, CloudstackSnitch

Page 14: Cassandra Lan party

Notre cluster

Lyon10.1.rc.n

Paris10.2.rc.n

OpsCenter10.1.0.1

Page 15: Cassandra Lan party

Au boulot!

Page 16: Cassandra Lan party

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

Page 17: Cassandra Lan party

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

Page 18: Cassandra Lan party

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

Page 19: Cassandra Lan party

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

Page 20: Cassandra Lan party

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

Page 21: Cassandra Lan party

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'

Page 22: Cassandra Lan party

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

Page 23: Cassandra Lan party

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));

Page 24: Cassandra Lan party

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);

Page 25: Cassandra Lan party

Scénario 1 Perte d’un noeud

● Hinted handoff

● Surveillero notetool statuso OpsCentero cqlsh

select * from system.hints

Page 26: Cassandra Lan party

Scénario 2 Ajout d’un noeud

● Streaming

● Surveillero Cluster: nodetool statuso Streaming: nodetool netstatso OpsCenter

Page 27: Cassandra Lan party

Scénario 3 Perte d’un datacenter

● Surveillero notetool statuso OpsCenter

Page 28: Cassandra Lan party

Conclusion

● Les vertues de Cassandrao Tolérance aux panneso Scalabilité linéaireo Configuration Simple

● Reset configuration réseauo Configuration IPo Réactiver firewall