Your SlideShare is downloading. ×
  • Like
  • Save
Workshop administracion cassandra
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Workshop administracion cassandra

  • 150 views
Published

Workshop de administración con Cassandra

Workshop de administración con Cassandra

Published in Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
150
On SlideShare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
2
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Workshop Administración Cassandra José Hernández Isthari jose.Hernandez@isthari.com
  • 2. Objetivos  Instalación  Creación de un cluster  Añadir nodos al anillo  Cluster distribuido en multiples datacenter  Configuración de virtual nodes
  • 3. Apache Cassandra  Base de datos NoSQL  Descentralizada  Replicación en multiples datacenter  Tolerante a fallos  Escalabilidad lineal
  • 4. Cluster de cassandra Primary key john@nobody.com => hash: 18
  • 5. Cluster de cassandra Primary key john@nobody.com => hash: 18
  • 6. Cluster de cassandra
  • 7. Instalación Cassandra DSE (Redhat)  Registro http://www.datastax.com/download/register  Configuración repositorio # vi /etc/yum.repos.d/datastax.repo [datastax] name = DataStax Repo for DataStax Enterprise baseurl=http://username:password@rpm.datastax.com/enterprise enabled=1 gpgcheck=0  Instalación # sudo yum install dse-full # sudo yum install opscenter
  • 8. Gossip  Comunicación entre los nodos  Protocolo peer to peer  Descubrir nodos y su estado  Detección de nodos caídos o de bajo rendimiento …  … y reconectados
  • 9. Configuración gossip  /etc/dse/cassandra/Cassandra.yaml  cluster_name  listen_address  NO UTILIZAR 0.0.0.0  Red dedicada de al menos 1Gb  seed_provider, nodos existentes en el cluster  initial_token
  • 10. Configuración gossip cluster_name: 'Cluster produccion' initial_token: -9223372036854775808 listen_address: 192.168.0.200 seed_provider: - class_name: org.apache.cassandra.locator.SimpleSeedProvider parameters: - seeds: "192.168.0.200,192.168.0.201"
  • 11. Calculo de tokens  Valores entre -2^63 hasta 2^63 python -c 'print [str(((2**64 / number_of_nodes) * i) - 2**63) for i in range(number_of_nodes)]‘ ['-9223372036854775808', '-3074457345618258603', '3074457345618258602']
  • 12. Calculo de tokens  http://www.geroba.com/cassandra/cassandra-token-calculator/
  • 13. Iniciar primer nodo #sudo /etc/init.d/dse start  Ver su estado # nodetool status Datacenter: Cassandra ===================== Status=Up/Down |/ State=Normal/Leaving/Joining/Moving -- Address Load Token Owns (effective) Host ID Rack UN 192.168.0.200 107.55 KB -923… 100% 8f3254d4-3823-…
  • 14. Insertar datos # cassandra-stress # nodetool status Datacenter: Cassandra ===================== Status=Up/Down |/ State=Normal/Leaving/Joining/Moving -- Address Load Token Owns (effective) Host ID Rack UN 192.168.0.200 188.01MB -923… 100% 8f3254d4-3823-…
  • 15. Replication factor  Consola de CQL # cqlsh 192.168.0.200  Cambiar Replication factor cqlsh> ALTER KEYSPACE "Keyspace1‚ WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 2};
  • 16. Iniciar el 2º nodo  Configurar Cassandra.yaml  Iniciar el nodo  Ver el estado # nodetool status Datacenter: Cassandra ===================== Status=Up/Down |/ State=Normal/Leaving/Joining/Moving -- Address Load Owns Token UN 192.168.0.200 188.01 MB 100.0% -9223372036854775808 UN 192.168.0.201 38.35 KB 100.0% -3074457345618258603
  • 17. nodetool repair  Recuperación de un nodo que ha estado caído  Mantenimiento periódico  Nuevos nodos en el cluster # nodetool repair # nodotool status Datacenter: Cassandra ===================== Status=Up/Down |/ State=Normal/Leaving/Joining/Moving -- Address Load Owns Token UN 192.168.0.200 188.01 MB 100.0% -9223372036854775808 UN 192.168.0.201 188.01 MB 100.0% -3074457345618258603
  • 18. Configurar el 3º nodo cluster_name: 'Cluster produccion' initial_token: 3074457345618258602 listen_address: 192.168.0.202 seed_provider: - class_name: org.apache.cassandra.locator.SimpleSeedProvider parameters: - seeds: "192.168.0.200,192.168.0.201"
  • 19. Iniciar el 3º nodo (bootstrap)  Ver el estado # nodetool status Datacenter: Cassandra ===================== Status=Up/Down |/ State=Normal/Leaving/Joining/Moving -- Address Load Owns Token UN 192.168.0.200 188.01 MB 66.7% -9223372036854775808 UN 192.168.0.201 188.01 MB 66.7% -3074457345618258603 UN 192.168.0.202 128.81 MB 66.7% 3074457345618258602
  • 20. nodetool cleanup 192.168.0.200# nodetool cleanup 192.168.0.201# nodetool cleanup Datacenter: Cassandra ===================== Status=Up/Down |/ State=Normal/Leaving/Joining/Moving -- Address Load Owns Token UN 192.168.0.200 128.81 MB 66.7% -9223372036854775808 UN 192.168.0.201 128.81 MB 66.7% -3074457345618258603 UN 192.168.0.202 128.81 MB 66.7% 3074457345618258602
  • 21. Limitaciones single token
  • 22. Virtual nodes  256 tokens en cada nodo (num_tokens)  No es necesario calcular tokens ni asignarlos manualmente  La carga se divide homogeneamente en caso de fallo o un nuevo nodo  No es necesario rebalancear el anillo  El proceso de repair implica menos carga en cada nodo individual  Permite un cluster con máquinas de distinto hardware al asignar distinto número de virtual nodes a cada nodo
  • 23. Virtual nodes
  • 24. Add/repair node
  • 25. Múlti - datacenter  NetworlTopologyStrategy  SimpleSnitch, pruebas y desarrollo  DynamicSnitch, en función del rendimiento y latencia de red  PropertyFileSnitch, asignación IP => Datacenter y rack  GossippingPropertyFileSnitch  EC2Snitch  EC2MultiRegionSnitch
  • 26. Configurar keyspace cqlsh> alter keyspace KEYSPACE_NAME with replication = { ‘class’: ‘NetworkTopologyStrategy’, and strategy_options:Madrid = 3, and strategy_options:Barcelona=3, and strategy_options:Paris=6 }
  • 27. Configurar snitch  /etc/dse/cassandra/cassandra.yaml Endpoint_snitch: GossipingPropertyFileSnitch  Configurar localización del nodo /etc/dse/Cassandra/Cassandra-rackdc.properties dc=Madrid rack=Rack1
  • 28. nodetool status Datacenter: Madrid ===================== -- Address Load Owns Rack UN 192.168.1.200 128.81 MB 66.7% Rack1 UN 192.168.1.201 129.31 MB 66.7% Rack2 UN 192.168.1.202 129.28 MB 66.7% Rack3 Datacenter: Barcelona ===================== -- Address Load Owns Rack UN 192.168.2.200 128.81 MB 66.7% Rack1 UN 192.168.2.201 129.31 MB 66.7% Rack2 UN 192.168.2.202 129.28 MB 66.7% Rack3 Datacenter: Paris ===================== -- Address Load Owns Rack UN 192.168.3.200 128.81 MB 66.7% Rack1 …
  • 29. Preguntas y sugerencias Gracias por asistir