Skip to content

Instantly share code, notes, and snippets.

View jsanda's full-sized avatar

John Sanda jsanda

View GitHub Profile
apiVersion: k8ssandra.io/v1alpha1
kind: K8ssandraCluster
metadata:
name: test
spec:
cassandra:
cluster: test
serverVersion: "4.0.0"
storageConfig:
cassandraDataVolumeClaimSpec:
apiVersion: k8ssandra.io/v1alpha1
kind: K8ssandraCluster
metadata:
name: test
spec:
k8sContextsSecret: k8s-contexts
cassandra:
additionalServiceConfig:
dcService:
additionalLabels:
apiVersion: k8ssandra.io/v1alpha1
kind: K8ssandraCluster
metadata:
name: test
spec:
cassandra:
cluster: test
datacenters:
- metadata:
name: dc1
---
apiVersion: v1
kind: Namespace
metadata:
name: cass-operator
---
apiVersion: v1
kind: Namespace
metadata:
name: dev1
$ kubectl get svc -l cassandracluster=multidc-cluster
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
multidc-cluster ClusterIP None <none> 7000/TCP,7001/TCP,7199/TCP,9042/TCP 4h50m
multidc-cluster-exporter-jmx ClusterIP None <none> 1234/TCP 4h50m
@jsanda
jsanda / throttle.java
Last active May 17, 2019 17:39
java driver (v3.x) throttling for async execution
private boolean availableInFlightSlots(Statement st) {
boolean available = false;
Iterator<Host> hostIterator = loadBalancingPolicy.newQueryPlan(session.getLoggedKeyspace(), st);
hostIter: while(hostIterator.hasNext()) {
Host host = hostIterator.next();
int inFlightQueries = session.getState().getInFlightQueries(host);
switch(loadBalancingPolicy.distance(host)) {
case LOCAL:
if (inFlightQueries < maxInFlightLocal) {
available = true;
name: queue-proxy
ports:
- containerPort: 8012
name: queue-port
protocol: TCP
- containerPort: 8022
name: queueadm-port
protocol: TCP
- containerPort: 9090
name: queue-metrics
// ...
} else { // Active=False
url := fmt.Sprintf("http://%s.%s", pa.Spec.ServiceName, pa.ObjectMeta.Namespace)
client := &http.Client{}
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("knative-activator-probe", "true")
resp, err := client.Do(req)
if err != nil {
logger.Errorf("Probe request to %s failed", url, zap.Error(err))
$ oc get all
NAME READY STATUS RESTARTS AGE
pod/cassandra-0 1/1 Running 0 18h
pod/cassandra-1 1/1 Running 0 18h
pod/cassandra-2 1/1 Running 0 18h
pod/docker-registry-1-dglvs 1/1 Running 0 1d
pod/logging-eventrouter-1-drbtd 1/1 Running 0 1d
pod/registry-console-1-tth9l 1/1 Running 0 1d
pod/router-2-277np 1/1 Running 0 1d
$ oc get all
NAME READY STATUS RESTARTS AGE
pod/cassandra-0 1/1 Running 0 18h
pod/cassandra-1 1/1 Running 0 18h
pod/cassandra-2 1/1 Running 0 18h
pod/docker-registry-1-dglvs 1/1 Running 0 1d
pod/logging-eventrouter-1-drbtd 1/1 Running 0 1d
pod/registry-console-1-tth9l 1/1 Running 0 1d
pod/router-2-277np 1/1 Running 0 1d