More updates to docker, including more env overrides. For example you can now set cluster name.
someone tell me if this is wrong, but I do not think "examples/cassandra/image/run.sh: cluster_name \" should have been found
This commit is contained in:
parent
c6a9abbef0
commit
1da766080c
|
@ -80,7 +80,14 @@ computer.
|
||||||
The pods use the [```gcr.io/google-samples/cassandra:v9```](image/Dockerfile)
|
The pods use the [```gcr.io/google-samples/cassandra:v9```](image/Dockerfile)
|
||||||
image from Google's [container registry](https://cloud.google.com/container-registry/docs/).
|
image from Google's [container registry](https://cloud.google.com/container-registry/docs/).
|
||||||
The docker is based on `debian:jessie` and includes OpenJDK 8. This image
|
The docker is based on `debian:jessie` and includes OpenJDK 8. This image
|
||||||
includes a standard Cassandra installation from the Apache Debian repo.
|
includes a standard Cassandra installation from the Apache Debian repo. Through the use
|
||||||
|
of environment variables you are able to change values that are inserted into the `cassandra.yaml`.
|
||||||
|
|
||||||
|
| ENV VAR | DEFAULT VALUE |
|
||||||
|
| ------------- |:-------------: |
|
||||||
|
| CASSANDRA_CLUSTER_NAME | 'Test Cluster' |
|
||||||
|
| CASSANDRA_NUM_TOKENS | 32 |
|
||||||
|
| CASSANDRA_RPC_ADDRESS | 0.0.0.0 |
|
||||||
|
|
||||||
### Custom Seed Provider
|
### Custom Seed Provider
|
||||||
|
|
||||||
|
@ -229,7 +236,7 @@ spec:
|
||||||
- /run.sh
|
- /run.sh
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpu: .5
|
cpu: 0.5
|
||||||
env:
|
env:
|
||||||
- name: MAX_HEAP_SIZE
|
- name: MAX_HEAP_SIZE
|
||||||
value: 512M
|
value: 512M
|
||||||
|
@ -239,13 +246,24 @@ spec:
|
||||||
valueFrom:
|
valueFrom:
|
||||||
fieldRef:
|
fieldRef:
|
||||||
fieldPath: metadata.namespace
|
fieldPath: metadata.namespace
|
||||||
|
- name: POD_IP
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: status.podIP
|
||||||
image: gcr.io/google-samples/cassandra:v9
|
image: gcr.io/google-samples/cassandra:v9
|
||||||
name: cassandra
|
name: cassandra
|
||||||
ports:
|
ports:
|
||||||
|
- containerPort: 7000
|
||||||
|
name: intra-node
|
||||||
|
- containerPort: 7001
|
||||||
|
name: tls-intra-node
|
||||||
|
- containerPort: 7199
|
||||||
|
name: jmx
|
||||||
- containerPort: 9042
|
- containerPort: 9042
|
||||||
name: cql
|
name: cql
|
||||||
- containerPort: 9160
|
# If you need it it is going away in C* 4.0
|
||||||
name: thrift
|
#- containerPort: 9160
|
||||||
|
# name: thrift
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: /cassandra_data
|
- mountPath: /cassandra_data
|
||||||
name: data
|
name: data
|
||||||
|
@ -457,16 +475,27 @@ spec:
|
||||||
valueFrom:
|
valueFrom:
|
||||||
fieldRef:
|
fieldRef:
|
||||||
fieldPath: metadata.namespace
|
fieldPath: metadata.namespace
|
||||||
|
- name: POD_IP
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: status.podIP
|
||||||
image: gcr.io/google-samples/cassandra:v9
|
image: gcr.io/google-samples/cassandra:v9
|
||||||
name: cassandra
|
name: cassandra
|
||||||
ports:
|
ports:
|
||||||
|
- containerPort: 7000
|
||||||
|
name: intra-node
|
||||||
|
- containerPort: 7001
|
||||||
|
name: tls-intra-node
|
||||||
|
- containerPort: 7199
|
||||||
|
name: jmx
|
||||||
- containerPort: 9042
|
- containerPort: 9042
|
||||||
name: cql
|
name: cql
|
||||||
- containerPort: 9160
|
# If you need it it is going away in C* 4.0
|
||||||
name: thrift
|
#- containerPort: 9160
|
||||||
|
# name: thrift
|
||||||
resources:
|
resources:
|
||||||
request:
|
request:
|
||||||
cpu: .5
|
cpu: 0.5
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: /cassandra_data
|
- mountPath: /cassandra_data
|
||||||
name: data
|
name: data
|
||||||
|
|
|
@ -22,7 +22,7 @@ spec:
|
||||||
- /run.sh
|
- /run.sh
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpu: .5
|
cpu: 0.5
|
||||||
env:
|
env:
|
||||||
- name: MAX_HEAP_SIZE
|
- name: MAX_HEAP_SIZE
|
||||||
value: 512M
|
value: 512M
|
||||||
|
@ -32,13 +32,24 @@ spec:
|
||||||
valueFrom:
|
valueFrom:
|
||||||
fieldRef:
|
fieldRef:
|
||||||
fieldPath: metadata.namespace
|
fieldPath: metadata.namespace
|
||||||
|
- name: POD_IP
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: status.podIP
|
||||||
image: gcr.io/google-samples/cassandra:v9
|
image: gcr.io/google-samples/cassandra:v9
|
||||||
name: cassandra
|
name: cassandra
|
||||||
ports:
|
ports:
|
||||||
|
- containerPort: 7000
|
||||||
|
name: intra-node
|
||||||
|
- containerPort: 7001
|
||||||
|
name: tls-intra-node
|
||||||
|
- containerPort: 7199
|
||||||
|
name: jmx
|
||||||
- containerPort: 9042
|
- containerPort: 9042
|
||||||
name: cql
|
name: cql
|
||||||
- containerPort: 9160
|
# If you need it it is going away in C* 4.0
|
||||||
name: thrift
|
#- containerPort: 9160
|
||||||
|
# name: thrift
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: /cassandra_data
|
- mountPath: /cassandra_data
|
||||||
name: data
|
name: data
|
||||||
|
|
|
@ -25,16 +25,27 @@ spec:
|
||||||
valueFrom:
|
valueFrom:
|
||||||
fieldRef:
|
fieldRef:
|
||||||
fieldPath: metadata.namespace
|
fieldPath: metadata.namespace
|
||||||
|
- name: POD_IP
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: status.podIP
|
||||||
image: gcr.io/google-samples/cassandra:v9
|
image: gcr.io/google-samples/cassandra:v9
|
||||||
name: cassandra
|
name: cassandra
|
||||||
ports:
|
ports:
|
||||||
|
- containerPort: 7000
|
||||||
|
name: intra-node
|
||||||
|
- containerPort: 7001
|
||||||
|
name: tls-intra-node
|
||||||
|
- containerPort: 7199
|
||||||
|
name: jmx
|
||||||
- containerPort: 9042
|
- containerPort: 9042
|
||||||
name: cql
|
name: cql
|
||||||
- containerPort: 9160
|
# If you need it it is going away in C* 4.0
|
||||||
name: thrift
|
#- containerPort: 9160
|
||||||
|
# name: thrift
|
||||||
resources:
|
resources:
|
||||||
request:
|
request:
|
||||||
cpu: .5
|
cpu: 0.5
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: /cassandra_data
|
- mountPath: /cassandra_data
|
||||||
name: data
|
name: data
|
||||||
|
|
|
@ -33,13 +33,20 @@ RUN gpg --keyserver pgp.mit.edu --recv-keys F758CE318D77295D && \
|
||||||
rm -rf /usr/share/doc/ && \
|
rm -rf /usr/share/doc/ && \
|
||||||
rm -rf /usr/share/doc-base/ && \
|
rm -rf /usr/share/doc-base/ && \
|
||||||
rm -rf /usr/share/man/ && \
|
rm -rf /usr/share/man/ && \
|
||||||
rm -rf /tmp/*
|
rm -rf /tmp/*
|
||||||
|
|
||||||
COPY cassandra.yaml /etc/cassandra/cassandra.yaml
|
COPY cassandra.yaml /etc/cassandra/cassandra.yaml
|
||||||
COPY logback.xml /etc/cassandra/logback.xml
|
COPY logback.xml /etc/cassandra/logback.xml
|
||||||
COPY kubernetes-cassandra.jar /kubernetes-cassandra.jar
|
COPY kubernetes-cassandra.jar /kubernetes-cassandra.jar
|
||||||
|
|
||||||
VOLUME ["/cassandra_data/data"]
|
VOLUME ["/cassandra_data/data"]
|
||||||
|
|
||||||
|
# 7000: intra-node communication
|
||||||
|
# 7001: TLS intra-node communication
|
||||||
|
# 7199: JMX
|
||||||
|
# 9042: CQL
|
||||||
|
# 9160: thrift service not included cause it is going away
|
||||||
|
EXPOSE 7000 7001 7199 9042
|
||||||
|
|
||||||
USER cassandra
|
USER cassandra
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ cluster_name: 'Test Cluster'
|
||||||
#
|
#
|
||||||
# If you already have a cluster with 1 token per node, and wish to migrate to
|
# If you already have a cluster with 1 token per node, and wish to migrate to
|
||||||
# multiple tokens per node, see http://wiki.apache.org/cassandra/Operations
|
# multiple tokens per node, see http://wiki.apache.org/cassandra/Operations
|
||||||
num_tokens: 256
|
num_tokens: 32
|
||||||
|
|
||||||
# initial_token allows you to specify tokens manually. While you can use # it with
|
# initial_token allows you to specify tokens manually. While you can use # it with
|
||||||
# vnodes (num_tokens > 1, above) -- in which case you should provide a
|
# vnodes (num_tokens > 1, above) -- in which case you should provide a
|
||||||
|
@ -258,7 +258,7 @@ seed_provider:
|
||||||
parameters:
|
parameters:
|
||||||
# seeds is actually a comma-delimited list of addresses.
|
# seeds is actually a comma-delimited list of addresses.
|
||||||
# Ex: "<ip1>,<ip2>,<ip3>"
|
# Ex: "<ip1>,<ip2>,<ip3>"
|
||||||
- seeds: "%%ip%%"
|
- seeds: 127.0.0.1
|
||||||
|
|
||||||
# For workloads with more data than can fit in memory, Cassandra's
|
# For workloads with more data than can fit in memory, Cassandra's
|
||||||
# bottleneck will be reads that need to fetch data from
|
# bottleneck will be reads that need to fetch data from
|
||||||
|
@ -364,7 +364,7 @@ ssl_storage_port: 7001
|
||||||
# address associated with the hostname (it might not be).
|
# address associated with the hostname (it might not be).
|
||||||
#
|
#
|
||||||
# Setting listen_address to 0.0.0.0 is always wrong.
|
# Setting listen_address to 0.0.0.0 is always wrong.
|
||||||
listen_address: %%ip%%
|
listen_address: 127.0.0.1
|
||||||
# listen_interface: eth0
|
# listen_interface: eth0
|
||||||
|
|
||||||
# Address to broadcast to other Cassandra nodes
|
# Address to broadcast to other Cassandra nodes
|
||||||
|
@ -405,7 +405,7 @@ start_rpc: true
|
||||||
#
|
#
|
||||||
# Note that unlike listen_address, you can specify 0.0.0.0, but you must also
|
# Note that unlike listen_address, you can specify 0.0.0.0, but you must also
|
||||||
# set broadcast_rpc_address to a value other than 0.0.0.0.
|
# set broadcast_rpc_address to a value other than 0.0.0.0.
|
||||||
rpc_address: %%ip%%
|
rpc_address: 127.0.0.1
|
||||||
# rpc_interface: eth1
|
# rpc_interface: eth1
|
||||||
|
|
||||||
# port for Thrift to listen for clients on
|
# port for Thrift to listen for clients on
|
||||||
|
@ -769,6 +769,6 @@ inter_dc_tcp_nodelay: false
|
||||||
disk_access_mode: mmap
|
disk_access_mode: mmap
|
||||||
row_cache_class_name: org.apache.cassandra.cache.OHCProvider
|
row_cache_class_name: org.apache.cassandra.cache.OHCProvider
|
||||||
|
|
||||||
# Not till 3.5
|
# Not till 3.5
|
||||||
#enable_user_defined_functions: true
|
#enable_user_defined_functions: true
|
||||||
#enable_scripted_user_defined_functions: tru
|
#enable_scripted_user_defined_functions: tru
|
||||||
|
|
|
@ -14,6 +14,54 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
perl -pi -e "s/%%ip%%/$(hostname -I)/g" /etc/cassandra/cassandra.yaml
|
set -e
|
||||||
|
CFG=/etc/cassandra/cassandra.yaml
|
||||||
|
CASSANDRA_RPC_ADDRESS="${CASSANDRA_RPC_ADDRESS:-0.0.0.0}"
|
||||||
|
CASSANDRA_NUM_TOKENS="${CASSANDRA_NUM_TOKENS:-32}"
|
||||||
|
CASSANDRA_CLUSTER_NAME="${CASSANDRA_CLUSTER_NAME:=Test Cluster}"
|
||||||
|
CASSANDRA_LISTEN_ADDRESS=${POD_IP}
|
||||||
|
CASSANDRA_BROADCAST_ADDRESS=${POD_IP}
|
||||||
|
CASSANDRA_BROADCAST_RPC_ADDRESS=${POD_IP}
|
||||||
|
|
||||||
|
# TODO what else needs to be modified
|
||||||
|
|
||||||
|
for yaml in \
|
||||||
|
broadcast_address \
|
||||||
|
broadcast_rpc_address \
|
||||||
|
cluster_name \
|
||||||
|
listen_address \
|
||||||
|
num_tokens \
|
||||||
|
rpc_address \
|
||||||
|
; do
|
||||||
|
var="CASSANDRA_${yaml^^}"
|
||||||
|
val="${!var}"
|
||||||
|
if [ "$val" ]; then
|
||||||
|
sed -ri 's/^(# )?('"$yaml"':).*/\2 '"$val"'/' "$CFG"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Eventual do snitch $DC && $RACK?
|
||||||
|
#if [[ $SNITCH ]]; then
|
||||||
|
# sed -i -e "s/endpoint_snitch: SimpleSnitch/endpoint_snitch: $SNITCH/" $CONFIG/cassandra.yaml
|
||||||
|
#fi
|
||||||
|
#if [[ $DC && $RACK ]]; then
|
||||||
|
# echo "dc=$DC" > $CONFIG/cassandra-rackdc.properties
|
||||||
|
# echo "rack=$RACK" >> $CONFIG/cassandra-rackdc.properties
|
||||||
|
#fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# see if this is needed
|
||||||
|
#echo "JVM_OPTS=\"\$JVM_OPTS -Djava.rmi.server.hostname=$IP\"" >> $CASSANDRA_CONFIG/cassandra-env.sh
|
||||||
|
#
|
||||||
|
|
||||||
|
# FIXME create README for these args
|
||||||
|
echo "Starting Cassandra on $POD_IP"
|
||||||
|
echo CASSANDRA_RPC_ADDRESS ${CASSANDRA_RPC_ADDRESS}
|
||||||
|
echo CASSANDRA_NUM_TOKENS ${CASSANDRA_NUM_TOKENS}
|
||||||
|
echo CASSANDRA_CLUSTER_NAME ${CASSANDRA_CLUSTER_NAME}
|
||||||
|
echo CASSANDRA_LISTEN_ADDRESS ${POD_IP}
|
||||||
|
echo CASSANDRA_BROADCAST_ADDRESS ${POD_IP}
|
||||||
|
echo CASSANDRA_BROADCAST_RPC_ADDRESS ${POD_IP}
|
||||||
|
|
||||||
export CLASSPATH=/kubernetes-cassandra.jar
|
export CLASSPATH=/kubernetes-cassandra.jar
|
||||||
cassandra -f
|
cassandra -f
|
||||||
|
|
Loading…
Reference in New Issue