Home Up PDF Prof. Dr. Ingo Claßen
Cassandra Container anlegen - ADBKT

Cassandra Container anlegen

Stack cas1 anlegen

networks:
  ncas:
    name: ncas

services:
  cas1:
    container_name: cas1
    image: cassandra:latest
    ports:
      - 9042:9042
    environment:
      - JVM_OPTS=-Xms1024M -Xmx1024M
      - HEAP_NEWSIZE=1024M
      - MAX_HEAP_SIZE=1024M
    networks:
      - ncas

Keyspace und Tabelle anlegen

Konsole in Container cas1 öffnen und dort die Cassandra Query Language Shell starten (cqlsh).

create keyspace test with replication = {
  'class': 'SimpleStrategy', 'replication_factor' : 1
};

use test;

create table t (
  pk int, 
  sk int, 
  v int, 
  primary key (pk, sk)
);

insert into t(pk, sk, v) values (1, 1, 100);
insert into t(pk, sk, v) values (1, 2, 200);

select * from t where pk=1;

Stack cas2 anlegen

Wichtig: Container cas1 muss bereits laufen.

networks:
  ncas:
    name: ncas

services:
  cas1:
    container_name: cas2
    image: cassandra:latest
    ports:
      - 9043:9042
    environment:
      - CASSANDRA_SEEDS=cas1
      - JVM_OPTS=-Xms1024M -Xmx1024M
      - HEAP_NEWSIZE=1024M
      - MAX_HEAP_SIZE=1024M
    networks:
      - ncas

Stack cas3 anlegen

Wichtig: Container cas1 muss bereits laufen.

networks:
  ncas:
    name: ncas

services:
  cas1:
    container_name: cas3
    image: cassandra:latest
    ports:
      - 9044:9042
    environment:
      - CASSANDRA_SEEDS=cas1
      - JVM_OPTS=-Xms1024M -Xmx1024M
      - HEAP_NEWSIZE=1024M
      - MAX_HEAP_SIZE=1024M
    networks:
      - ncas