-
Notifications
You must be signed in to change notification settings - Fork 3
/
cassandra.yaml
144 lines (130 loc) · 4.67 KB
/
cassandra.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
## Cassandra image version
## ref: https://hub.docker.com/r/library/cassandra/
image:
repo: "cassandra"
tag: "3"
pullPolicy: IfNotPresent
## Specify ImagePullSecrets for Pods
## ref: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod
# pullSecrets: myregistrykey
## Specify a service type
## ref: http://kubernetes.io/docs/user-guide/services/
service:
type: ClusterIP
## Persist data to a persistent volume
persistence:
enabled: false
## cassandra data Persistent Volume Storage Class
## If defined, storageClassName: <storageClass>
## If set to "-", storageClassName: "", which disables dynamic provisioning
## If undefined (the default) or set to null, no storageClassName spec is
## set, choosing the default provisioner. (gp2 on AWS, standard on
## GKE, AWS & OpenStack)
##
storageClass: "standard"
accessMode: ReadWriteOnce
size: 5Gi
## Configure resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
## Minimum memory for development is 4GB and 2 CPU cores
## Minimum memory for production is 8GB and 4 CPU cores
## ref: http://docs.datastax.com/en/archived/cassandra/2.0/cassandra/architecture/architecturePlanningHardware_c.html
resources:
# requests:
# memory: 256Mi
# cpu: 100m
# limits:
# memory: 1Gi
# cpu: 2
## Change cassandra configuration parameters below:
## ref: http://docs.datastax.com/en/cassandra/3.0/cassandra/configuration/configCassandra_yaml.html
## Recommended max heap size is 1/2 of system memory
## Recommeneed heap new size is 1/4 of max heap size
## ref: http://docs.datastax.com/en/cassandra/3.0/cassandra/operations/opsTuneJVM.html
config:
cluster_name: cassandra
cluster_size: 1
seed_size: 1
num_tokens: 0
# If you want Cassandra to use this datacenter and rack name,
# you need to set endpoint_snitch to GossipingPropertyFileSnitch.
# Otherwise, these values are ignored and datacenter1 and rack1
# are used.
dc_name: DC1
rack_name: RAC1
endpoint_snitch: SimpleSnitch
max_heap_size: 512M
heap_new_size: 256M
start_rpc: false
ports:
cql: 9042
thrift: 9160
# If a JVM Agent is in place
# agent: 61621
## Liveness and Readiness probe values.
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/
livenessProbe:
initialDelaySeconds: 90
periodSeconds: 30
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 3
readinessProbe:
initialDelaySeconds: 30
periodSeconds: 30
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 3
## Configure node selector. Edit code below for adding selector to pods
## ref: https://kubernetes.io/docs/user-guide/node-selection/
# selector:
# nodeSelector:
# cloud.google.com/gke-nodepool: pool-db
## Additional pod labels
## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
podLabels: {}
## Additional pod-level settings
podSettings:
# Change this to give pods more time to properly leave the cluster when not using persistent storage.
terminationGracePeriodSeconds: 30
podManagementPolicy: OrderedReady
updateStrategy:
type: OnDelete
## Pod Security Context
securityContext:
enabled: false
fsGroup: 999
runAsUser: 999
## Affinity for pod assignment
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
affinity: {}
commandOverrides:
- "bash"
argsOverrides:
- "/etc/cassandra/cassandra.sh"
configOverrides:
cassandra.sh: |
chown -R cassandra:cassandra /var/lib/cassandra
chmod 777 /var/lib/cassandra
chmod 777 /etc/cassandra
# Custom Cassandra configuration for small footprint
# This was inspired from: https://github.com/lightbend/reactive-sandbox/blob/master/docker/rs-exec
# Note: We opted not to use Reactive Sandbox for the course, because it is too minimal for the course.
ip="$(grep "$HOSTNAME" /etc/hosts|awk '{print $1}')"
sed -i -e "s/num_tokens/\#num_tokens/" /etc/cassandra/cassandra.yaml
sed -i -e "s/^rpc_address.*/rpc_address: $ip/" /etc/cassandra/cassandra.yaml
sed -i -e "s/^listen_address.*/listen_address: $ip/" /etc/cassandra/cassandra.yaml
sed -i -e 's/- seeds: "127.0.0.1"/- seeds: "'"$ip"'"/' /etc/cassandra/cassandra.yaml
cat <<EOT >> /etc/cassandra/cassandra.yaml
initial_token: 0
rpc_server_type: hsha
concurrent_reads: 2
concurrent_writes: 2
concurrent_compactors: 1
compaction_throughput_mb_per_sec: 0
key_cache_size_in_mb: 0
rpc_min_threads: 1
rpc_max_threads: 1
EOT
find /var/lib/cassandra /var/log/cassandra -exec chown cassandra:cassandra '{}' \;
gosu cassandra cassandra -f