Add DBRS dockerfiles

This commit includes the dockerfiles and documentation for Database
Reference Stack v0.1.0, they will be located under stacks/dbrs
directory. This version includes Redis and Cassandra applications.

Each application includes the scripts and conf directores with the
files required for building the container.

For Cassandra there is a helm chart, and for Redis there is a yaml
configuration file for a redisfailover instance. These files are
included for an easier adoption as a kubernetes application.

Signed-off-by: Gabriel Briones <gabriel.briones.sayeg@intel.com>
This commit is contained in:
Gabriel Briones
2019-09-19 14:36:16 -05:00
committed by William Douglas
parent 3b4b72aa3b
commit 602c2e28da
43 changed files with 3572 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
# Database Reference Stack
This provides the Database Reference Stack. To offer more flexibility, there are multiple versions of the Database Reference Stack:
* Cassandra optimized image featuring support for Intel® Optane™ DC persistent memory
* Redis optimized image featuring support for Intel® Optane™ DC persistent memory
Please see the folders in this level about the variants and how to build and use them.
+69
View File
@@ -0,0 +1,69 @@
FROM clearlinux/stacks-clearlinux:latest
MAINTAINER otc-swstacks@intel.com
RUN swupd bundle-add curl java-runtime python2-basic which pmdk sudo
RUN mkdir workspace
COPY scripts/docker-entrypoint.sh /usr/local/bin/
COPY scripts/docker-healthcheck /usr/local/bin/
COPY scripts/change_fsdax_perms.sh /usr/local/bin/
COPY scripts/change_devdax_perms.sh /usr/local/bin/
COPY scripts/change_persistent_dirs_perms.sh /usr/local/bin/
#Adding sudo in order to take ownership of PMEM devices, sudoers file should be deleted
#once the permissions are granted on docker-entrypoint.sh
RUN useradd cassandra-user && \
mkdir -p /etc/sudoers.d && \
echo 'cassandra-user ALL=(root) NOPASSWD: /usr/local/bin/change_fsdax_perms.sh,/usr/local/bin/change_devdax_perms.sh,/usr/local/bin/change_persistent_dirs_perms.sh' > /etc/sudoers.d/cassandra-user
RUN chown root:root /usr/local/bin/change_fsdax_perms.sh && \
chmod 755 /usr/local/bin/change_fsdax_perms.sh && \
chown root:root /usr/local/bin/change_devdax_perms.sh && \
chmod 755 /usr/local/bin/change_devdax_perms.sh && \
chown root:root /usr/local/bin/change_persistent_dirs_perms.sh && \
chmod 755 /usr/local/bin/change_persistent_dirs_perms.sh
COPY cassandra-pmem-build.tar.gz /tmp
RUN cd /tmp && \
tar zxvf cassandra-pmem-build.tar.gz && \
mkdir -p /workspace/cassandra/build && \
cp -r /tmp/cassandra/bin /workspace/cassandra && \
cp -r /tmp/cassandra/conf /workspace/cassandra && \
cp -r /tmp/cassandra/lib /workspace/cassandra && \
cp -r /tmp/cassandra/pylib /workspace/cassandra && \
cp -r /tmp/cassandra/tools /workspace/cassandra && \
cp -r /tmp/cassandra/build/classes /workspace/cassandra/build && \
cp /tmp/cassandra/build/apache-cassandra-4.0-alpha2-SNAPSHOT.jar /workspace/cassandra/build && \
cd /workspace && \
rm -rf /tmp/cassandra && \
rm /tmp/cassandra-pmem-build.tar.gz && \
chown root:root -R /workspace && \
mkdir /workspace/cassandra/data && \
mkdir /workspace/cassandra/logs && \
chown cassandra-user -R /workspace/cassandra/data && \
chown cassandra-user -R /workspace/cassandra/logs && \
chmod 0755 /workspace/cassandra/bin/* && \
rm -rf /workspace/cassandra/lib/sigar-bin/*.dll && \
rm -rf /workspace/cassandra/lib/sigar-bin/*.lib && \
rm /workspace/cassandra/conf/cassandra.yaml && \
rm /workspace/cassandra/conf/jvm-server.options && \
rm /workspace/cassandra/conf/jvm8-server.options && \
rm /workspace/cassandra/conf/jvm11-server.options && \
rm /workspace/cassandra/lib/snappy-java-1.1.2.6.jar
COPY conf/cassandra-template.yaml /workspace/cassandra/conf/
COPY conf/jvm-server.options-template /workspace/cassandra/conf/
COPY conf/jvm8-server.options /workspace/cassandra/conf/
COPY conf/jvm11-server.options /workspace/cassandra/conf/
RUN chown cassandra-user -R /workspace/cassandra/conf/
RUN swupd bundle-remove curl
RUN swupd clean
HEALTHCHECK --interval=30s CMD ["docker-healthcheck"]
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
USER cassandra-user
CMD ["/workspace/cassandra/bin/cassandra", "-f"]
+302
View File
@@ -0,0 +1,302 @@
## Database Reference Stack with Cassandra
[![](https://images.microbadger.com/badges/image/clearlinux/stacks-dbrs-cassandra.svg)](http://microbadger.com/images/clearlinux/stacks-dbrs-cassandra "Get your own image badge on microbadger.com")
### Building Locally
The Dockerfiles for all Clear Linux* OS based container images are available at [dockerfiles repository](https://github.com/clearlinux/dockerfiles). These can be used to build and modify the container images.
1. Clone the clearlinux/dockerfiles repository.
```bash
git clone https://github.com/clearlinux/dockerfiles.git
```
2. Change to the directory of the application:
```bash
cd dockerfiles/stacks/dbrs/cassandra
```
3. Inside this repository there is a file called `scripts/build-cassandra-pmem.sh`, this script handles all the required procedures in rder to have cassandra-pmem compiled and ready for Dockerfile usage. The dependencies for this build can be installed with `swupd`.
```bash
swupd bundle-add c-basic java-basic devpkg-pmdk pmdk
```
4. Once installed, we run the script
```bash
./scripts/build-cassandra-pmem.sh
```
5. If everything runs sucessfully you will have a file called `cassandra-pmem-build.tar.gz` on the directory on which you run the script, this file should be placed in the same directory of the Dockerfile for this one to be able to build the docker image sucesfully. Default build args in Docker are on: https://docs.docker.com/engine/reference/builder/#arg
```bash
docker build --no-cache -t clearlinux/stacks-dbrs-cassandra .
```
### Run DBRS Cassandra as a standalone container
- PMEM memory in `devdax` or `fsdax` mode, the container image is able to handle both modes and depending on the PMEM mode, the mount points inside the container should be different.
In order to make available `devdax` pmem devices inside the container you must use the `--device` directive, internally the container always uses `/dev/dax0.0`, so the mapping should be:
```
--device=/dev/<host-device>:/dev/dax0.0
```
In a similar fashion for `fsdax` we need the device to be mapped to `/mnt/pmem` inside the container:
```
--mount type=bind,source=<source-mount-point>,target=/mnt/pmem
```
#### Preparing PMEM for container use
In the current state, the cassandra-pmem image is capable of using both `fsdax` and `devdax`, the necessary steps to configure the PMEM to work with cassandra are documented here.
##### fsdax mode
First we need to verify that our PMEM is on `fsdax` mode
```
# ndctl list -u
{
"dev":"namespace0.0",
"mode":"fsdax",
"map":"mem",
"size":"4.00 GiB (4.29 GB)",
"sector_size":512,
"blockdev":"pmem0"
}
```
if for some reason the device is not on `fsdax` mode you can run `ndctl create-namespace -fe <namespace-name> --mode=fsdax` to reconfigure the namespace to the desired mode.
Once the PMEM namespace is configured, a device named `/dev/pmem{0-9}` should appear then we need to proceed to create a filesystem on it. The filesystem could be `ext4` or `xfs`, for this example we are going to use `ext4`.
```
# mkfs.ext4 /dev/pmem0
mke2fs 1.45.2 (27-May-2019)
Creating filesystem with 1031680 4k blocks and 258048 inodes
Filesystem UUID: 303c03f5-ac4e-4462-8bf9-bc6b0fae53fe
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
```
Once the filesystem was created, we need to mount it with the dax option
```bash
mount /dev/pmem0 /mnt/pmem -o dax
```
When using `fsdax` mode cassandra-pmem creates a pool file on the pmem mountpoint, so the `jvm.options` configuration should look like the text below:
```
-Dpmem_path=/mnt/pmem/cassandra_pool
-Dpool_size=3221225472
```
Where
- pmem_path is the path to the pool file, which should include the path itself and the file name
- pool_size is the size of the pool file in bytes, if you are using the docker images provided here you can pass this value as an environment variable to the container runtime in Gb and the calculation is done automatically.
Is important to notice is that when creating the filesystem in the pmem device certain amount of space of the device is used by the filesystem metadata so the pool_size should be smaller than the total pmem namespace size.
When using the docker image provided here, the file `jvm.options` is automatically populated with the environment variables `CASSANDRA_PMEM_POOL_NAME` and `CASSANDRA_FSDAX_POOL_SIZE_GB`.
##### devdax mode
We need to verify if the device we want to use is in `devdax` mode
```
root@clear-pmem/home/development # ndctl create-namespace -fe namespace0.0 --mode=devdax
{
"dev":"namespace0.0",
"mode":"devdax",
"map":"dev",
"size":"3.94 GiB (4.23 GB)",
"uuid":"cb738cc7-711d-4578-bebf-1f7ba02ca169",
"daxregion":{
"id":0,
"size":"3.94 GiB (4.23 GB)",
"align":2097152,
"devices":[
{
"chardev":"dax0.0",
"size":"3.94 GiB (4.23 GB)"
}
]
},
"align":2097152
}
```
if not, we can reconfigure it using `ndctl create-namespace -fe <namespace-name> --mode=devdax`. Before using a `devdax` device we need to clear the device:
```
root@clear-pmem/home/development # pmempool rm -vaf /dev/dax0.0
removed '/dev/dax0.0'
```
The `jvm.options` configuration for cassandra should look like the following:
```
-Dpmem_path=/dev/dax0.0
-Dpool_size=0
```
Where
- pmem_path is the `devdax` device.
- pool_size=0 indicates to use the entire `devdax` device.
When using the docker image provided here, the file `jvm.options` is automatically populated.
#### Start container
In `devdax` mode:
```bash
docker run --device=/<devdax-device>:/dev/dax0.0 --ulimit nofile=262144:262144 -p 9042:9042 -p 7000:7000 -it --name cassandra-test <image-id>
```
In `fsdax` mode:
```bash
docker run --mount type=bind,source=/<fsdax-mountpoint>,target=/mnt/pmem --ulimit nofile=262144:262144 -p 9042:9042 -p 7000:7000 -it -e 'CASSANDRA_FSDAX_POOL_SIZE_GB=<fsdax-pool-size-in-gb>' --name cassandra-test <image-id>
```
#### Configure container
##### Using environment variables
By default the container listens on the primary container IP address, but if required, some parameters can be provided as environment variables using `--env`.
| **Environment Variable** | **Description** |
| --- | --- |
| `CASSANDRA_CLUSTER_NAME` | Cassandra cluster name, by default `Cassandra Cluster` |
| `CASSANDRA_LISTEN_ADDRESS` | Cassandra listen address |
| `CASSANDRA_RPC_ADDRESS` | Cassandra RPC address |
| `CASSANDRA_SEED_ADDRESSES` | A comma separated list of hosts in the cluster, if not provided, cassandra is going to run as a single node. |
| `CASSANDRA_SNITCH` | The snitch type for the cluster, by default it is `SimpleSnitch`, for more complex snitches you can mount your own `cassandra-rackdc.properties` file. |
| `LOCAL_JMX` | If set to `no` the JMX service will listen on all IP addresses, the default is `yes` and listens just on localhost 127.0.0.1 |
| `JVM_OPTS` | When set you can pass additional arguments to the JVM for cassandra execution, for example for specifying memory heap sizes `JVM_OPTS=-Xms16G -Xmx16G -Xmn12G` |
When using PMEM in `fsdax` mode, there are some parameters to control the allocation of memory:
| Environment Variable | Description |
| --- | --- |
| `CASSANDRA_FSDAX_POOL_SIZE_GB` | The size of the fsdax pool in GB, if it is not specified the pool size is `1` |
| `CASSANDRA_PMEM_POOL_NAME` | The filename of the pool created in PMEM, by default `cassandra_pool` |
##### Using custom files
For more complex deployments it is also possible to provide custom `cassandra.yaml` and `jvm.options` files as shown below:
```
docker run --mount type=bind,source=/<fsdax-mountpoint>,target=/mnt/pmem -it --ulimit nofile=262144:262144 --mount type=bind,source=/<path-to-file>/cassandra.yaml,target=/workspace/cassandra/conf/cassandra.yaml --mount type=bind,source=/path-to-file>/jvm.options,target=/workspace/cassandra/conf/jvm.options --name cassandra-custom-files
```
#### Clustering
For a simple two node cluster using PMEM in `fsdax` mode on both containers:
##### Node 1
- IP: 172.17.0.2
- PMEM mountpoint: /mnt/pmem1
```
docker run --mount type=bind,source=/mnt/pmem1,target=/mnt/pmem --ulimit nofile=262144:262144 -it -e 'CASSANDRA_FSDAX_POOL_SIZE_GB=2' -e 'CASSANDRA_SEED_ADDRESSES=172.17.0.2:7000,172.17.0.3:7000' --name cassandra-node1 <image-id>
```
##### Node 2
- IP: 172.17.0.3
- PMEM mountpoint: /mnt/pmem2
```
docker run --mount type=bind,source=/mnt/pmem2,target=/mnt/pmem --ulimit nofile=262144:262144 -it -e 'CASSANDRA_FSDAX_POOL_SIZE_GB=2' -e 'CASSANDRA_SEED_ADDRESSES=172.17.0.2:7000,172.17.0.3:7000' --name cassandra-node2 <image-id>
```
Once both nodes are running eventually the gossip is settled and we can use `nodetool` on any of both containers to check cluster status.
```
docker exec -it <container-id> bash /workspace/cassandra/bin/nodetool status
```
The output should look similar to this:
```
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns (effective) Host ID Rack
UN 172.17.0.3 0 bytes 256 100.0% 22387159-8192-41cf-8b6c-8bf0e1049eb7 rack1
UN 172.17.0.2 0 bytes 256 100.0% 219b56ba-c07c-400b-a018-a5dc20edeb09 rack1
```
#### Data persistence
By default the data written to cassandra can be accessed as long as the container exists. In order to persist the data a user can mount volumes or bind mounts on `/workspace/cassandra/data` and `/workspace/cassandra/logs`, in this way the data can still be accessed once the container is deleted.
### Deploy DBRS Cassandra cluster on Kubernetes
Many containerized workloads are deployed in clusters and orchestration software like Kubernetes, for this purpose the Helm chart located on `cassandra-pmem-helm` can be useful.
#### Kubernetes installation
To install Kubernetes in Clear Linux, follow the instructions in the Clear Linux's [Kubernetes Tutorial](https://docs.01.org/clearlinux/latest/tutorials/kubernetes.html)
After setting up Kubernetes, you will need to enable it to support DCPMM suing the pmem-csi driver. To install the driver follow the instructions in the [pmem-csi repository](https://github.com/intel/pmem-csi) file.
Then Kubernetes cluster must have [helm and tiller](https://helm.sh/) installed in order for the helm chart to deploy.
#### Helm chart configuration
In order to configure the cassandra pmem cluster some variables and values are provided. This values are set on `cassandra-pmem-helm/values.yaml`, those can also be modified according to your specific needs. A summary of those parameters is shown below:
| **Value** | **Description** |
| --- | --- |
| clusterName | The cluster Name set across all deployed nodes |
| replicaCount | The number of nodes in the cluster to be deployed |
| image.repository | The address of the container registry where the cassandra-pmem image should be pulled |
| image.tag | The tag of the image to be pulled during deployment |
| image.name | The name of the image to be pulled during deployment |
| pmem.containerPmemAllocation | The size of the persistent volume claim to be used as heap, it uses the storage class `pmem-csi-sc-ext4` from pmem-csi |
| pmem.fsdaxPoolSizeInGB | The size of the fsdax pool to be created inside the persistent volume claim, in practice it shuld be `1G` less than pmem.containerPmemAllocation |
| enablePersistence | If set to `true` K8s persistent volumes are deployed to store data and logs |
| persistentVolumes.logsVolumeSize | The size of the persistent volume used for storing logs on each node, the default is `4G` |
| persistentVolumes.dataVolumeSize | The size of the persistent volume used for storing data on each node, the default is `4G` |
| persistentVolumes.logsStorageClass | K8s storage class used by the logs pvc |
| persistentVolumes.dataStorageClass | K8s storage class used by the data pvc |
| provideCustomConfig | If set to `true`, it mounts all the files located on `<helm-chart-dir>/files/conf` on `/workspace/cassandra/conf` inside each container in order to provide a way to customize the deployment beyond the options provided here |
| exposeJmxPort | When set to `true` it exposes the JMX port as part of the kubernetes headless service, it should be used together with `enableAdditionalFilesConfigMap` in order to provide authentication files needed for JMX when the remote connections are allowed, when set to `false` only local access through 127.0.0.1 is granted and no additional authentication is needed |
| enableClientToolsPod | If set to `true`, an additional pod independent from the cluster is deployed, this pod contains various Cassandra client tools and mounts test profiles located under `<helm-chart-dir>/files/testProfiles` to `/testProfiles` inside the pod. This pod is useful to test and launch benchmarks |
| enableAdditionalFilesConfigMap | When set to true, it takes the files located in `<helm-chart-dir>/files/additionalFiles` and mount them in `/etc/cassandra` inside the pods, some additional files for cassandra can be stored here, such as JMX auth files |
| jvmOpts.enabled | If set to `true` the environment variable `JVM_OPTS` is overriden with the value provided on jvmOpts.value |
| jvmOpts.value | Sets the value of the environment variable `JVM_OPTS`, in this way some java runtime configurations can be provided such as RAM heap usage |
| resources.enabled | if set to `true`, the resource constraints are set on each pod using the values under resources.requests and resources.limits |
| resources.requests.memory and resources.request.cpu | Initial resource allocation for each pod in the cluster |
| resources.limits.memory and resources.limits.cpu | Limits for cpu and memory for each pod in the cluster |
** **Important considerations when selecting volume sizes** **
When selecting the `fsdax` pool file size, it is important to consider that when requesting a volume, certain amount of space is used by the filesystem metadata on that volume, therefore the available space turns out to be less than total amount specified, taking this into consideration the size of the fsdax pool file should be ~2G less than the total volume size requested.
#### Helm chart deployment
Once all the configurations are set, to install the chart inside a given Kubernetes cluster you must run:
```bash
helm install ./cassandra-pmem-helm
```
Eventually all the given nodes will be shown as running using `kubectl get pods`.
@@ -0,0 +1,22 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
@@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "1.0"
description: A Helm chart for deploying Cassandra PMEM on K8s
name: cassandra-pmem-helm
version: 0.1.0
@@ -0,0 +1,2 @@
monitorRole readonly
controlRole readwrite
@@ -0,0 +1,3 @@
##Role password
monitorRole testpass
controlRole testpass
@@ -0,0 +1,3 @@
# Configuration files
When using `provideCustomConfig: true` in values.yaml, the files included in this directory are mounted as config files inside the pod, so
more complex configurations can be provided.
@@ -0,0 +1,2 @@
# Test profiles
When using `enableClientToolsPod: true` in values.yaml, the test profiles located in this directory are mounted on `/testProfiles` inside the pod.
@@ -0,0 +1,78 @@
#
# This is an example YAML profile for cassandra-stress
#
# insert data
# cassandra-stress user profile=/home/jake/stress1.yaml ops(insert=1)
#
# read, using query simple1:
# cassandra-stress profile=/home/jake/stress1.yaml ops(simple1=1)
#
# mixed workload (90/10)
# cassandra-stress user profile=/home/jake/stress1.yaml ops(insert=1,simple1=9)
#
# Keyspace info
#
keyspace: stresscql
#
# The CQL for creating a keyspace (optional if it already exists)
#
keyspace_definition: |
CREATE KEYSPACE stresscql WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
#
# Table info
#
table: counttest
#
# The CQL for creating a table you wish to stress (optional if it already exists)
#
table_definition: |
CREATE TABLE counttest (
name text PRIMARY KEY,
count counter
) WITH comment='A table of many types to test wide rows'
#
# Optional meta information on the generated columns in the above table
# The min and max only apply to text and blob types
# The distribution field represents the total unique population
# distribution of that column across rows. Supported types are
#
# EXP(min..max) An exponential distribution over the range [min..max]
# EXTREME(min..max,shape) An extreme value (Weibull) distribution over the range [min..max]
# GAUSSIAN(min..max,stdvrng) A gaussian/normal distribution, where mean=(min+max)/2, and stdev is (mean-min)/stdvrng
# GAUSSIAN(min..max,mean,stdev) A gaussian/normal distribution, with explicitly defined mean and stdev
# UNIFORM(min..max) A uniform distribution over the range [min, max]
# FIXED(val) A fixed distribution, always returning the same value
# SEQ(min..max) A fixed sequence, returning values in the range min to max sequentially (starting based on seed), wrapping if necessary.
# Aliases: extr, gauss, normal, norm, weibull
#
# If preceded by ~, the distribution is inverted
# Defaults for all columns are size: uniform(4..8), population: uniform(1..100B), cluster: fixed(1)
#
columnspec:
- name: name
size: uniform(1..4)
- name: count
population: fixed(1)
insert:
partitions: fixed(1) # number of unique partitions to update in a single operation
# if batchcount > 1, multiple batches will be used but all partitions will
# occur in all batches (unless they finish early); only the row counts will vary
batchtype: LOGGED # type of batch to use
select: fixed(1)/1 # uniform chance any single generated CQL row will be visited in a partition;
# generated for each partition independently, each time we visit it
#
# A list of queries you wish to run against the schema
#
queries:
simple1:
cql: select * from counttest where name = ?
fields: samerow # samerow or multirow (select arguments from the same row, or randomly from all rows in the partition)
@@ -0,0 +1,109 @@
#
# This is an example YAML profile for cassandra-stress
#
# insert data
# cassandra-stress user profile=/home/jake/stress1.yaml ops(insert=1)
#
# read, using query simple1:
# cassandra-stress profile=/home/jake/stress1.yaml ops(simple1=1)
#
# mixed workload (90/10)
# cassandra-stress user profile=/home/jake/stress1.yaml ops(insert=1,simple1=9)
#
# Keyspace info
#
keyspace: stresscql
#
# The CQL for creating a keyspace (optional if it already exists)
#
keyspace_definition: |
CREATE KEYSPACE stresscql WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
#
# Table info
#
table: typestest
#
# The CQL for creating a table you wish to stress (optional if it already exists)
#
table_definition: |
CREATE TABLE typestest (
name text,
choice boolean,
date timestamp,
address inet,
dbl double,
lval bigint,
ival int,
uid timeuuid,
value blob,
PRIMARY KEY((name,choice), date, address, dbl, lval, ival, uid)
)
WITH compaction = { 'class':'LeveledCompactionStrategy' }
# AND compression = { 'sstable_compression' : '' }
# AND comment='A table of many types to test wide rows'
#
# Optional meta information on the generated columns in the above table
# The min and max only apply to text and blob types
# The distribution field represents the total unique population
# distribution of that column across rows. Supported types are
#
# EXP(min..max) An exponential distribution over the range [min..max]
# EXTREME(min..max,shape) An extreme value (Weibull) distribution over the range [min..max]
# GAUSSIAN(min..max,stdvrng) A gaussian/normal distribution, where mean=(min+max)/2, and stdev is (mean-min)/stdvrng
# GAUSSIAN(min..max,mean,stdev) A gaussian/normal distribution, with explicitly defined mean and stdev
# UNIFORM(min..max) A uniform distribution over the range [min, max]
# FIXED(val) A fixed distribution, always returning the same value
# SEQ(min..max) A fixed sequence, returning values in the range min to max sequentially (starting based on seed), wrapping if necessary.
# Aliases: extr, gauss, normal, norm, weibull
#
# If preceded by ~, the distribution is inverted
#
# Defaults for all columns are size: uniform(4..8), population: uniform(1..100B), cluster: fixed(1)
#
columnspec:
- name: name
size: uniform(1..10)
population: uniform(1..10) # the range of unique values to select for the field (default is 100Billion)
- name: date
cluster: uniform(20..40)
- name: lval
population: gaussian(1..1000)
cluster: uniform(1..4)
insert:
partitions: uniform(1..50) # number of unique partitions to update in a single operation
# if batchcount > 1, multiple batches will be used but all partitions will
# occur in all batches (unless they finish early); only the row counts will vary
batchtype: LOGGED # type of batch to use
select: uniform(1..10)/10 # uniform chance any single generated CQL row will be visited in a partition;
# generated for each partition independently, each time we visit it
#
# A list of queries you wish to run against the schema
#
queries:
simple1:
cql: select * from typestest where name = ? and choice = ? LIMIT 100
fields: samerow # samerow or multirow (select arguments from the same row, or randomly from all rows in the partition)
range1:
cql: select * from typestest where name = ? and choice = ? and date >= ? LIMIT 100
fields: multirow # samerow or multirow (select arguments from the same row, or randomly from all rows in the partition)
#
# A list of bulk read queries that analytics tools may perform against the schema
# Each query will sweep an entire token range, page by page.
#
token_range_queries:
all_columns_tr_query:
columns: '*'
page_size: 5000
value_tr_query:
columns: value
@@ -0,0 +1,89 @@
#
# This is an example YAML profile for cassandra-stress
#
# insert data
# cassandra-stress user profile=/home/jake/stress1.yaml ops(insert=1)
#
# read, using query simple1:
# cassandra-stress profile=/home/jake/stress1.yaml ops(simple1=1)
#
# mixed workload (90/10)
# cassandra-stress user profile=/home/jake/stress1.yaml ops(insert=1,simple1=9)
#
# Keyspace info
#
keyspace: stresscql
#
# The CQL for creating a keyspace (optional if it already exists)
#
keyspace_definition: |
CREATE KEYSPACE stresscql WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
#
# Table info
#
table: insanitytest
#
# The CQL for creating a table you wish to stress (optional if it already exists)
#
table_definition: |
CREATE TABLE insanitytest (
name text,
choice boolean,
date timestamp,
address inet,
dbl double,
lval bigint,
fval float,
ival int,
uid timeuuid,
value blob,
PRIMARY KEY((name, choice), date)
) WITH compaction = { 'class':'LeveledCompactionStrategy' }
AND comment='A table of many types to test wide rows and collections'
#
# Optional meta information on the generated columns in the above table
# The min and max only apply to text and blob types
# The distribution field represents the total unique population
# distribution of that column across rows. Supported types are
#
# EXP(min..max) An exponential distribution over the range [min..max]
# EXTREME(min..max,shape) An extreme value (Weibull) distribution over the range [min..max]
# GAUSSIAN(min..max,stdvrng) A gaussian/normal distribution, where mean=(min+max)/2, and stdev is (mean-min)/stdvrng
# GAUSSIAN(min..max,mean,stdev) A gaussian/normal distribution, with explicitly defined mean and stdev
# UNIFORM(min..max) A uniform distribution over the range [min, max]
# FIXED(val) A fixed distribution, always returning the same value
# SEQ(min..max) A fixed sequence, returning values in the range min to max sequentially (starting based on seed), wrapping if necessary.
# Aliases: extr, gauss, normal, norm, weibull
#
# If preceded by ~, the distribution is inverted
#
# Defaults for all columns are size: uniform(4..8), population: uniform(1..100B), cluster: fixed(1)
#
columnspec:
- name: date
cluster: gaussian(1..20)
- name: lval
population: fixed(1)
insert:
partitions: fixed(1) # number of unique partitions to update in a single operation
# if batchcount > 1, multiple batches will be used but all partitions will
# occur in all batches (unless they finish early); only the row counts will vary
batchtype: LOGGED # type of batch to use
select: fixed(1)/1 # uniform chance any single generated CQL row will be visited in a partition;
# generated for each partition independently, each time we visit it
#
# A list of queries you wish to run against the schema
#
queries:
simple1:
cql: select * from insanitytest where name = ? and choice = ? LIMIT 100
fields: samerow # samerow or multirow (select arguments from the same row, or randomly from all rows in the partition)
@@ -0,0 +1,71 @@
# Based on https://gist.github.com/tjake/8995058fed11d9921e31
### DML ###
# Keyspace Name
keyspace: cqlstress_lwt_example
# The CQL for creating a keyspace (optional if it already exists)
keyspace_definition: |
CREATE KEYSPACE cqlstress_lwt_example WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 3};
# Table name
table: blogposts
# The CQL for creating a table you wish to stress (optional if it already exists)
table_definition: |
CREATE TABLE blogposts (
domain text,
published_date timeuuid,
url text,
author text,
title text,
body text,
PRIMARY KEY(domain, published_date)
) WITH CLUSTERING ORDER BY (published_date DESC)
AND compaction = { 'class':'LeveledCompactionStrategy' }
AND comment='A table to hold blog posts'
### Column Distribution Specifications ###
columnspec:
- name: domain
size: gaussian(5..100) #domain names are relatively short
population: uniform(1..10M) #10M possible domains to pick from
- name: published_date
cluster: fixed(1000) #under each domain we will have max 1000 posts
- name: url
size: uniform(30..300)
- name: title #titles shouldn't go beyond 200 chars
size: gaussian(10..200)
- name: author
size: uniform(5..20) #author names should be short
- name: body
size: gaussian(100..5000) #the body of the blog post can be long
### Batch Ratio Distribution Specifications ###
insert:
partitions: fixed(1) # Our partition key is the domain so only insert one per batch
select: fixed(1)/1000 # We have 1000 posts per domain so 1/1000 will allow 1 post per batch
batchtype: UNLOGGED # Unlogged batches
condition: IF body = NULL # LWT: Do not override
#
# A list of queries you wish to run against the schema
#
queries:
singlepost:
cql: select * from blogposts where domain = ? LIMIT 1
fields: samerow
timeline:
cql: select url, title, published_date from blogposts where domain = ? LIMIT 10
fields: samerow
@@ -0,0 +1,11 @@
{{- if and (.Files.Glob "files/additionalFiles/*") (.Values.enableAdditionalFilesConfigMap) }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-additional-files-configmap
labels:
app: {{printf "%s-%s" .Release.Name .Values.appLabelSuffix }}
data:
{{ (.Files.Glob "files/additionalFiles/*").AsConfig | nindent 2 }}
{{- end }}
@@ -0,0 +1,29 @@
{{- if .Values.enableClientToolsPod }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-client-tools-pod
labels:
{{- $appLabel := printf "%s-%s" .Release.Name .Values.appLabelSuffix }}
app: {{ $appLabel }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ $appLabel }}
template:
metadata:
labels:
app: {{ $appLabel }}
spec:
containers:
- name: {{ .Release.Name }}-client-tools-pod
image: {{ .Values.clientToolsImage.repository }}/{{ .Values.clientToolsImage.image }}:{{ .Values.clientToolsImage.tag }}
volumeMounts:
- name: test-profiles-volume
mountPath: /testProfiles
volumes:
- name: test-profiles-volume
configMap:
name: {{ .Release.Name }}-test-profiles-configmap
{{- end }}
@@ -0,0 +1,10 @@
{{- if and (.Files.Glob "files/conf/*") (.Values.provideCustomConfig) }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-configmap
labels:
app: {{printf "%s-%s" .Release.Name .Values.appLabelSuffix }}
data:
{{ (.Files.Glob "files/conf/*").AsConfig | nindent 2 }}
{{- end }}
@@ -0,0 +1,21 @@
apiVersion: v1
kind: Service
metadata:
{{- $serviceName := printf "%s-cassandra-pmem-svc" .Release.Name }}
name: {{ $serviceName }}
labels:
{{- $appLabel := printf "%s-%s" .Release.Name .Values.appLabelSuffix }}
app: {{ $appLabel }}
spec:
ports:
- port: 9042
name: cql
- port: 7000
name: inter-node
{{- if .Values.exposeJmxPort }}
- port: 7199
name: jmx-port
{{- end }}
clusterIP: None
selector:
app: {{ $appLabel }}
@@ -0,0 +1,22 @@
{{- if .Values.exposeClusterExternally }}
apiVersion: v1
kind: Service
metadata:
{{- $serviceName := printf "%s-cassandra-pmem-service" .Release.Name }}
name: {{ $serviceName }}
labels:
{{- $appLabelSvc := printf "%s-%s" .Release.Name .Values.appLabelSuffix }}
app: {{ $appLabelSvc }}
spec:
nodePort: 30001
type: NodePort
ports:
- name: cql
port: 9042
targetPort: cql
- name: thrift
port: 30001
targetPort: thrift
selector:
app: {{ $appLabelSvc }}
{{- end }}
@@ -0,0 +1,129 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
{{- $statefulSetName := printf "%s-%s" .Release.Name .Values.statefulSetSuffix }}
name: {{ $statefulSetName }}
spec:
selector:
matchLabels:
{{- $appLabel := printf "%s-%s" .Release.Name .Values.appLabelSuffix }}
app: {{ $appLabel }} # has to match .spec.template.metadata.labels
{{- $serviceName := printf "%s-cassandra-pmem-svc" .Release.Name }}
serviceName: {{ $serviceName }}
replicas: {{ .Values.replicaCount }} # by default is 1
template:
metadata:
labels:
app: {{ $appLabel }} # has to match .spec.selector.matchLabels
spec:
terminationGracePeriodSeconds: 10
containers:
- name: cassandra-pmem
image: {{ .Values.image.repository }}/{{ .Values.image.name }}:{{ .Values.image.tag }}
ports:
- containerPort: 9042
name: cql
- containerPort: 7000
name: inter-node
{{- if .Values.exposeJmxPort }}
- containerPort: 7199
name: jmx-port
{{- end }}
{{- if .Values.resources.enabled }}
livenessProbe:
tcpSocket:
port: cql
initialDelaySeconds: 30
periodSeconds: 30
resources:
requests:
memory: {{ .Values.resources.requests.memory }}
cpu: {{ .Values.resources.requests.cpu }}
limits:
memory: {{ .Values.resources.limits.memory }}
cpu: {{ .Values.resources.limits.cpu }}
{{- end }}
{{- if ( not .Values.provideCustomConfig ) }}
env:
- name: CASSANDRA_SEED_ADDRESSES
{{- $seedAddresses := "" }}
{{- $nodeNumber := .Values.replicaCount | int }}
{{- $releaseName := .Release.Name }}
{{- range $index, $value := until $nodeNumber }}
{{- $seedAddresses = printf "%s%s-%d.%s:7000," $seedAddresses $statefulSetName $index $serviceName }}
{{- end}}
value: {{ $seedAddresses | quote }}
- name: CASSANDRA_CLUSTER_NAME
{{- $defaultClusterName := printf "%s-cassandra-pmem-k8s-cluster" .Release.Name }}
value: {{ .Values.clusterName | default $defaultClusterName | quote }}
- name: CASSANDRA_FSDAX_POOL_SIZE_GB
value: {{ .Values.pmem.fsdaxPoolSizeInGB | default "3" | quote }}
{{- if .Values.exposeJmxPort }}
- name: LOCAL_JMX
value: "no"
{{- end }}
{{- if .Values.jvmOpts.enabled }}
- name: JVM_OPTS
value: {{ .Values.jvmOpts.value }}
{{- end }}
{{- end }}
volumeMounts:
{{- if and (.Files.Glob "files/conf/*") (.Values.provideCustomConfig) }}
- name: config-volume
mountPath: /workspace/cassandra/conf
{{- end }}
{{- if and (.Files.Glob "files/additionalFiles/*") (.Values.enableAdditionalFilesConfigMap) }}
- name: additional-files-volume
mountPath: /etc/cassandra
{{- end }}
- name: cassandra-pmem-pvc
mountPath: /mnt/pmem
{{- if .Values.enablePersistence }}
- name: cassandra-data-pvc
mountPath: /workspace/cassandra/data
- name: cassandra-logs-pvc
mountPath: /workspace/cassandra/logs
{{- end }}
volumes:
{{- if and (.Files.Glob "files/conf/*") (.Values.provideCustomConfig) }}
- name: config-volume
configMap:
name: {{ .Release.Name }}-configmap
{{- end }}
{{- if and (.Files.Glob "files/additionalFiles/*") (.Values.enableAdditionalFilesConfigMap) }}
- name: additional-files-volume
configMap:
name: {{ .Release.Name }}-additional-files-configmap
{{- end }}
volumeClaimTemplates:
- metadata:
name: cassandra-pmem-pvc
spec:
accessModes:
- ReadWriteOnce
storageClassName: "pmem-csi-sc-ext4"
resources:
requests:
storage: {{ .Values.pmem.containerPmemAllocation | default "4G" | quote }}
{{- if .Values.enablePersistence }}
- metadata:
name: cassandra-data-pvc
spec:
accessModes:
- ReadWriteOnce
storageClassName: {{ .Values.persistentVolumes.dataStorageClass | quote }}
resources:
requests:
storage: {{ .Values.persistentVolumes.dataVolumeSize | default "2G" | quote }}
- metadata:
name: cassandra-logs-pvc
spec:
accessModes:
- ReadWriteOnce
storageClassName: {{ .Values.persistentVolumes.logsStorageClass | quote }}
resources:
requests:
storage: {{ .Values.persistentVolumes.logsVolumeSize | default "2G" | quote }}
{{- end }}
@@ -0,0 +1,10 @@
{{- if and (.Files.Glob "files/testProfiles/*") (.Values.enableClientToolsPod) }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-test-profiles-configmap
labels:
app: {{printf "%s-%s" .Release.Name .Values.appLabelSuffix }}
data:
{{ (.Files.Glob "files/testProfiles/*").AsConfig | nindent 2 }}
{{- end }}
@@ -0,0 +1,72 @@
clusterName: "cassandra-pmem-test-cluster"
#replica count specfies how many nodes will be used when deploying the cassandra-pmem cluster
replicaCount: 4
statefulSetSuffix: cassandra-pmem-cluster
appLabelSuffix: cassandra-pmem
#If set to true, the JMX port is also exposed as part of the service
#Please notice that exposing the port requires to setup authentication
#this can be accomplished providing the files using "enableAdditionalFilesConfigMap: true"
#The additional files inside <helm-chart-dir>/files/additionalFiles is mounted inside the pod
#on /etc/cassandra so additional files such as auth files for JMX can be added, by default some basic testing files are provided
#for production-like configuration some additional configuration needs to be done
exposeJmxPort: true
enableAdditionalFilesConfigMap: true
#If set to true a NodePort service will be deployed to expose the cluster externally
exposeClusterExternally: false
image:
repository: DOCKER_CASSANDRA_PMEM_REGISTRY
tag: latest
pullPolicy: IfNotPresent
name: CASSANDRA_IMAGE
#Pool size should be ~ containerPmemAllocation - 2G, otherwise pmem cassandra wil fail allocating heap,
#this is because filesystem metadata use a portion of the total space requested in the persisten volume claim
pmem:
containerPmemAllocation: "4G"
fsdaxPoolSizeInGB: "3"
#Non-Pmem resources to be used by each cassandra-pmem node
resources:
enabled: true
requests:
memory: "5G"
cpu: "1"
limits:
memory: "6G"
cpu: "4"
#Variable used to control JVM_OPTS for the pods
jvmOpts:
enabled: true
value: "-Xms4G -Xmx4G -Xmn2G"
#If enablePersistence is set to false, the data and logs dir will be using no K8s persistent volumes
#therefore the data on the cluster does not persist across container deletion and recreation, this option
#is useful for testing purposes
#
#custom storage classes can be used for data and logs, on a real world scenario it is prefered
#to use two different local storage devices in order to avoid bottlenecks and high network load
enablePersistence: true
persistentVolumes:
logsVolumeSize: 4G
dataVolumeSize: 4G
logsStorageClass: K8S_LOCAL_STORAGE_CLASS
dataStorageClass: K8S_LOCAL_STORAGE_CLASS
#When set to true, the chart mounts the files stored in <helm-chart-dir>/files/conf as a read-only volume mounted in /workspace/cassandra/conf inside the pods. More complex
#configurations can be provided in this way
provideCustomConfig: false
#Enable deploying a cassandra image containing client tools to test against the main cluster
#this image is run as an independent pod from the main deployment, also test profiles can be placed under
#the directory <helm-chart-dir>/files/testProfiles and those are mounted on /testProfiles inside the client tools pod
enableClientToolsPod: true
clientToolsImage:
repository: DOCKER_CLIENT_TOOLS_REGISTRY
tag: latest
pullPolicy: IfNotPresent
image: CLIENT_TOOLS_IMAGE
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,194 @@
###########################################################################
# jvm-server.options #
# #
# - all flags defined here will be used by cassandra to startup the JVM #
# - one flag should be specified per line #
# - lines that do not start with '-' will be ignored #
# - only static flags are accepted (no variables or parameters) #
# - dynamic flags will be appended to these on cassandra-env #
# #
# See jvm8-server.options and jvm11-server.options for Java version #
# specific options. #
###########################################################################
######################
# STARTUP PARAMETERS #
######################
# Uncomment any of the following properties to enable specific startup parameters
# In a multi-instance deployment, multiple Cassandra instances will independently assume that all
# CPU processors are available to it. This setting allows you to specify a smaller set of processors
# and perhaps have affinity.
#-Dcassandra.available_processors=number_of_processors
# The directory location of the cassandra.yaml file.
#-Dcassandra.config=directory
# Sets the initial partitioner token for a node the first time the node is started.
#-Dcassandra.initial_token=token
# Set to false to start Cassandra on a node but not have the node join the cluster.
#-Dcassandra.join_ring=true|false
# Set to false to clear all gossip state for the node on restart. Use when you have changed node
# information in cassandra.yaml (such as listen_address).
#-Dcassandra.load_ring_state=true|false
# Enable pluggable metrics reporter. See Pluggable metrics reporting in Cassandra 2.0.2.
#-Dcassandra.metricsReporterConfigFile=file
# Set the port on which the CQL native transport listens for clients. (Default: 9042)
#-Dcassandra.native_transport_port=port
# Overrides the partitioner. (Default: org.apache.cassandra.dht.Murmur3Partitioner)
#-Dcassandra.partitioner=partitioner
# To replace a node that has died, restart a new node in its place specifying the address of the
# dead node. The new node must not have any data in its data directory, that is, it must be in the
# same state as before bootstrapping.
#-Dcassandra.replace_address=listen_address or broadcast_address of dead node
# Allow restoring specific tables from an archived commit log.
#-Dcassandra.replayList=table
# Allows overriding of the default RING_DELAY (30000ms), which is the amount of time a node waits
# before joining the ring.
#-Dcassandra.ring_delay_ms=ms
# Set the SSL port for encrypted communication. (Default: 7001)
#-Dcassandra.ssl_storage_port=port
# Set the port for inter-node communication. (Default: 7000)
#-Dcassandra.storage_port=port
# Set the default location for the trigger JARs. (Default: conf/triggers)
#-Dcassandra.triggers_dir=directory
# For testing new compaction and compression strategies. It allows you to experiment with different
# strategies and benchmark write performance differences without affecting the production workload.
#-Dcassandra.write_survey=true
# To disable configuration via JMX of auth caches (such as those for credentials, permissions and
# roles). This will mean those config options can only be set (persistently) in cassandra.yaml
# and will require a restart for new values to take effect.
#-Dcassandra.disable_auth_caches_remote_configuration=true
# To disable dynamic calculation of the page size used when indexing an entire partition (during
# initial index build/rebuild). If set to true, the page size will be fixed to the default of
# 10000 rows per page.
#-Dcassandra.force_default_indexing_page_size=true
# Imposes an upper bound on hint lifetime below the normal min gc_grace_seconds
#-Dcassandra.maxHintTTL=max_hint_ttl_in_seconds
#-Dpmem_path=
#-Dpool_size=
########################
# GENERAL JVM SETTINGS #
########################
# enable assertions. highly suggested for correct application functionality.
-ea
# disable assertions for net.openhft.** because it runs out of memory by design
# if enabled and run for more than just brief testing
-da:net.openhft...
# enable thread priorities, primarily so we can give periodic tasks
# a lower priority to avoid interfering with client workload
-XX:+UseThreadPriorities
# Enable heap-dump if there's an OOM
-XX:+HeapDumpOnOutOfMemoryError
# Per-thread stack size.
-Xss256k
# Larger interned string table, for gossip's benefit (CASSANDRA-6410)
-XX:StringTableSize=1000003
# Make sure all memory is faulted and zeroed on startup.
# This helps prevent soft faults in containers and makes
# transparent hugepage allocation more effective.
-XX:+AlwaysPreTouch
# Disable biased locking as it does not benefit Cassandra.
-XX:-UseBiasedLocking
# Enable thread-local allocation blocks and allow the JVM to automatically
# resize them at runtime.
-XX:+UseTLAB
-XX:+ResizeTLAB
#-XX:+UseNUMA
# http://www.evanjones.ca/jvm-mmap-pause.html
-XX:+PerfDisableSharedMem
# Prefer binding to IPv4 network intefaces (when net.ipv6.bindv6only=1). See
# http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6342561 (short version:
# comment out this entry to enable IPv6 support).
-Djava.net.preferIPv4Stack=true
### Debug options
# uncomment to enable flight recorder
#-XX:+UnlockCommercialFeatures
#-XX:+FlightRecorder
# uncomment to have Cassandra JVM listen for remote debuggers/profilers on port 1414
#-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1414
# uncomment to have Cassandra JVM log internal method compilation (developers only)
#-XX:+UnlockDiagnosticVMOptions
#-XX:+LogCompilation
#################
# HEAP SETTINGS #
#################
# Heap size is automatically calculated by cassandra-env based on this
# formula: max(min(1/2 ram, 1024MB), min(1/4 ram, 8GB))
# That is:
# - calculate 1/2 ram and cap to 1024MB
# - calculate 1/4 ram and cap to 8192MB
# - pick the max
#
# For production use you may wish to adjust this for your environment.
# If that's the case, uncomment the -Xmx and Xms options below to override the
# automatic calculation of JVM heap memory.
#
# It is recommended to set min (-Xms) and max (-Xmx) heap sizes to
# the same value to avoid stop-the-world GC pauses during resize, and
# so that we can lock the heap in memory on startup to prevent any
# of it from being swapped out.
#-Xms4G
#-Xmx4G
# Young generation size is automatically calculated by cassandra-env
# based on this formula: min(100 * num_cores, 1/4 * heap size)
#
# The main trade-off for the young generation is that the larger it
# is, the longer GC pause times will be. The shorter it is, the more
# expensive GC will be (usually).
#
# It is not recommended to set the young generation size if using the
# G1 GC, since that will override the target pause-time goal.
# More info: http://www.oracle.com/technetwork/articles/java/g1gc-1984535.html
#
# The example below assumes a modern 8-core+ machine for decent
# times. If in doubt, and if you do not particularly want to tweak, go
# 100 MB per physical CPU core.
#-Xmn800M
###################################
# EXPIRATION DATE OVERFLOW POLICY #
###################################
# Defines how to handle INSERT requests with TTL exceeding the maximum supported expiration date:
# * REJECT: this is the default policy and will reject any requests with expiration date timestamp after 2038-01-19T03:14:06+00:00.
# * CAP: any insert with TTL expiring after 2038-01-19T03:14:06+00:00 will expire on 2038-01-19T03:14:06+00:00 and the client will receive a warning.
# * CAP_NOWARN: same as previous, except that the client warning will not be emitted.
#
#-Dcassandra.expiration_date_overflow_policy=REJECT
@@ -0,0 +1,96 @@
###########################################################################
# jvm11-server.options #
# #
# See jvm-server.options. This file is specific for Java 11 and newer. #
###########################################################################
#################
# GC SETTINGS #
#################
### CMS Settings
#-XX:+UseConcMarkSweepGC
#-XX:+CMSParallelRemarkEnabled
#-XX:SurvivorRatio=8
#-XX:MaxTenuringThreshold=1
#-XX:CMSInitiatingOccupancyFraction=75
#-XX:+UseCMSInitiatingOccupancyOnly
#-XX:CMSWaitDuration=10000
#-XX:+CMSParallelInitialMarkEnabled
#-XX:+CMSEdenChunksRecordAlways
### some JVMs will fill up their heap when accessed via JMX, see CASSANDRA-6541
#-XX:+CMSClassUnloadingEnabled
-XX:+UseAdaptiveSizePolicy
### G1 Settings
## Use the Hotspot garbage-first collector.
#-XX:+UseG1GC
#-XX:+ParallelRefProcEnabled
#
## Have the JVM do less remembered set work during STW, instead
## preferring concurrent GC. Reduces p99.9 latency.
#-XX:G1RSetUpdatingPauseTimePercent=5
#
## Main G1GC tunable: lowering the pause target will lower throughput and vise versa.
## 200ms is the JVM default and lowest viable setting
## 1000ms increases throughput. Keep it smaller than the timeouts in cassandra.yaml.
#-XX:MaxGCPauseMillis=500
## Optional G1 Settings
# Save CPU time on large (>= 16GB) heaps by delaying region scanning
# until the heap is 70% full. The default in Hotspot 8u40 is 40%.
#-XX:InitiatingHeapOccupancyPercent=70
# For systems with > 8 cores, the default ParallelGCThreads is 5/8 the number of logical cores.
# Otherwise equal to the number of cores when 8 or less.
# Machines with > 10 cores should try setting these to <= full cores.
#-XX:ParallelGCThreads=16
# By default, ConcGCThreads is 1/4 of ParallelGCThreads.
# Setting both to the same value can reduce STW durations.
#-XX:ConcGCThreads=16
### JPMS
-Djdk.attach.allowAttachSelf=true
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED
--add-exports java.base/jdk.internal.ref=ALL-UNNAMED
--add-exports java.base/sun.nio.ch=ALL-UNNAMED
--add-exports java.management.rmi/com.sun.jmx.remote.internal.rmi=ALL-UNNAMED
--add-exports java.rmi/sun.rmi.registry=ALL-UNNAMED
--add-exports java.rmi/sun.rmi.server=ALL-UNNAMED
--add-exports java.sql/java.sql=ALL-UNNAMED
--add-opens java.base/java.lang.module=ALL-UNNAMED
--add-opens java.base/jdk.internal.loader=ALL-UNNAMED
--add-opens java.base/jdk.internal.ref=ALL-UNNAMED
--add-opens java.base/jdk.internal.reflect=ALL-UNNAMED
--add-opens java.base/jdk.internal.math=ALL-UNNAMED
--add-opens java.base/jdk.internal.module=ALL-UNNAMED
--add-opens java.base/jdk.internal.util.jar=ALL-UNNAMED
--add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED
### GC logging options -- uncomment to enable
# Java 11 (and newer) GC logging options:
# See description of https://bugs.openjdk.java.net/browse/JDK-8046148 for details about the syntax
# The following is the equivalent to -XX:+PrintGCDetails -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=10M
#-Xlog:gc=info,heap*=trace,age*=debug,safepoint=info,promotion*=trace:file=/var/log/cassandra/gc.log:time,uptime,pid,tid,level:filecount=10,filesize=10485760
# Notes for Java 8 migration:
#
# -XX:+PrintGCDetails maps to -Xlog:gc*:... - i.e. add a '*' after "gc"
# -XX:+PrintGCDateStamps maps to decorator 'time'
#
# -XX:+PrintHeapAtGC maps to 'heap' with level 'trace'
# -XX:+PrintTenuringDistribution maps to 'age' with level 'debug'
# -XX:+PrintGCApplicationStoppedTime maps to 'safepoint' with level 'info'
# -XX:+PrintPromotionFailure maps to 'promotion' with level 'trace'
# -XX:PrintFLSStatistics=1 maps to 'freelist' with level 'trace'
# The newline in the end of file is intentional
@@ -0,0 +1,77 @@
###########################################################################
# jvm8-server.options #
# #
# See jvm-server.options. This file is specific for Java 8 and newer. #
###########################################################################
########################
# GENERAL JVM SETTINGS #
########################
# allows lowering thread priority without being root on linux - probably
# not necessary on Windows but doesn't harm anything.
# see http://tech.stolsvik.com/2010/01/linux-java-thread-priorities-workaround.html
-XX:ThreadPriorityPolicy=42
#################
# GC SETTINGS #
#################
### CMS Settings
#-XX:+UseParNewGC
#-XX:+UseConcMarkSweepGC
#-XX:+CMSParallelRemarkEnabled
#-XX:SurvivorRatio=8
#-XX:MaxTenuringThreshold=1
#-XX:CMSInitiatingOccupancyFraction=75
#-XX:+UseCMSInitiatingOccupancyOnly
#-XX:CMSWaitDuration=10000
#-XX:+CMSParallelInitialMarkEnabled
#-XX:+CMSEdenChunksRecordAlways
## some JVMs will fill up their heap when accessed via JMX, see CASSANDRA-6541
#-XX:+CMSClassUnloadingEnabled
-XX:+UseAdaptiveSizePolicy
### G1 Settings
## Use the Hotspot garbage-first collector.
#-XX:+UseG1GC
#-XX:+ParallelRefProcEnabled
#
## Have the JVM do less remembered set work during STW, instead
## preferring concurrent GC. Reduces p99.9 latency.
#-XX:G1RSetUpdatingPauseTimePercent=5
#
## Main G1GC tunable: lowering the pause target will lower throughput and vise versa.
## 200ms is the JVM default and lowest viable setting
## 1000ms increases throughput. Keep it smaller than the timeouts in cassandra.yaml.
#-XX:MaxGCPauseMillis=500
## Optional G1 Settings
# Save CPU time on large (>= 16GB) heaps by delaying region scanning
# until the heap is 70% full. The default in Hotspot 8u40 is 40%.
#-XX:InitiatingHeapOccupancyPercent=70
# For systems with > 8 cores, the default ParallelGCThreads is 5/8 the number of logical cores.
# Otherwise equal to the number of cores when 8 or less.
# Machines with > 10 cores should try setting these to <= full cores.
#-XX:ParallelGCThreads=16
# By default, ConcGCThreads is 1/4 of ParallelGCThreads.
# Setting both to the same value can reduce STW durations.
#-XX:ConcGCThreads=16
### GC logging options -- uncomment to enable
-XX:+PrintGCDetails
-XX:+PrintGCDateStamps
-XX:+PrintHeapAtGC
-XX:+PrintTenuringDistribution
-XX:+PrintGCApplicationStoppedTime
-XX:+PrintPromotionFailure
#-XX:PrintFLSStatistics=1
#-Xloggc:/var/log/cassandra/gc.log
-XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles=10
-XX:GCLogFileSize=10M
# The newline in the end of file is intentional
+8
View File
@@ -0,0 +1,8 @@
## Additional details on licenses
As with all Docker images, these likely also contain other software which may
be under other licenses (such as Bash, etc from the base distribution, along
with any direct or indirect dependencies of the primary software being
contained). As for any pre-built image usage, it is the image user's
responsibility to ensure that any use of this image complies with any relevant
licenses for all software contained within.
@@ -0,0 +1,209 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
THIRD-PARTY DEPENDENCIES
========================
Convenience copies of some third-party dependencies are distributed with
Apache Cassandra as Java jar files in lib/. Licensing information for
these files can be found in the lib/licenses directory.
@@ -0,0 +1,147 @@
List of licenses used in Clear Linux OS.
This list is automatically generated. If you spot a mistake or
omission, please mention this on dev@lists.clearlinux.org.
To read the full license text for these licenses, please visit
http://spdx.org/licenses/. A few licenses in this list are not
declared on the http://spdx.org/licenses/ website, they are listed
at the bottom of this list.
AFL-2.0
AFL-2.1
AGPL-3.0
AML
APSL-2.0
Apache-1.1
Apache-2.0
Artistic-1.0
Artistic-1.0-Perl
Artistic-2.0
BSD-2-Clause
BSD-2-Clause-FreeBSD
BSD-2-Clause-NetBSD
BSD-3-Clause
BSD-3-Clause-Attribution
BSD-3-Clause-Clear
BSD-3-Clause-LBNL
BSD-4-Clause
BSD-4-Clause-UC
BSL-1.0
CC-BY-2.0
CC-BY-3.0
CC-BY-4.0
CC-BY-ND-4.0
CC-BY-SA-2.0
CC-BY-SA-3.0
CC-BY-SA-4.0
CC0-1.0
CDDL-1.0
CDDL-1.1
CECILL-1.1
CPL-1.0
ClArtistic
Distributable
EPL-1.0
FSFULLR
FTL
GFDL-1.1
GFDL-1.2
GFDL-1.3
GFDL-1.3+
GL2PS
GPL-1.0
GPL-1.0+
GPL-2.0
GPL-2.0+
GPL-2.0-only
GPL-2.0-or-later
GPL-3.0
GPL-3.0+
GPL-3.0-only
HPND
ICU
IJG
ISC
ImageMagick
Imlib2
Intel
JSON
JasPer-2.0
LAL-1.2
LGPL-2.0
LGPL-2.0+
LGPL-2.1
LGPL-2.1+
LGPL-2.1-only
LGPL-3.0
LGPL-3.0+
LPPL-1.0
LPPL-1.3c
Libpng
MIT
MIT-Opengroup
MIT-enna
MIT-feh
MPL-1.1
MPL-2.0
MPL-2.0-no-copyleft-exception
MS-PL
MTLL
MakeIndex
NCSA
NTP
NetCDF
Nunit
OFL-1.0
OFL-1.1
OLDAP-2.0.1
OLDAP-2.8
OML
OSL-2.0
OpenSSL
PHP-3.01
PostgreSQL
Public-Domain
Python-2.0
QPL-1.0
Qhull
Rdisc
Ruby
SAX-PD
SGI-B-1.0
SGI-B-1.1
SGI-B-2.0
SISSL
Saxpath
Sleepycat
TCL
Unicode-TOU
Unlicense
Vim
W3C
W3C-19980720
WTFPL
X11
ZPL-2.0
ZPL-2.1
Zend-2.0
Zlib
bzip2-1.0.5
bzip2-1.0.6
gnuplot
libtiff
psutils
zlib-acknowledgement
The following licenses are not standard spdx identifiers:
- Copyright
- Distributable
- Public-Domain
These are used for projects that have explicitly granted redistribution
of the project source code, but don't have a typical OSI approved
license identifier.
+42
View File
@@ -0,0 +1,42 @@
#!/bin/bash
#Script for building cassandra with pmem support on Clear Linux
#Bundle dependencies: c-basic java-basic devpkg-pmdk pmdk
#
#All the repositories are built on CASSANDRA_BUILD_DIR and a tar.gz file is generated
#on the folder you run this script
export JAVA_HOME='/usr/lib/jvm/java-1.8.0-openjdk'
INITIAL_DIR=$(pwd)
CASSANDRA_BUILD_DIR='/tmp/cassandra-build'
LLPL_REPO='https://github.com/pmem/llpl.git'
CASSANDRA_PMEM_REPO='https://github.com/intel/cassandra-pmem'
CASSANDRA_PMEM_BRANCH='13981_llpl_engine'
if [ -d $CASSANDRA_BUILD_DIR ]
then
rm -rf $CASSANDRA_BUILD_DIR/*
else
mkdir $CASSANDRA_BUILD_DIR
fi
#Build LLPL
cd $CASSANDRA_BUILD_DIR
git clone $LLPL_REPO && \
cd $CASSANDRA_BUILD_DIR/llpl && \
make && \
cd $CASSANDRA_BUILD_DIR/llpl/target/classes && \
jar cvf llpl.jar lib/
#Build Cassandra PMEM
cd $CASSANDRA_BUILD_DIR && \
git clone -b $CASSANDRA_PMEM_BRANCH --single-branch $CASSANDRA_PMEM_REPO && \
cd $CASSANDRA_BUILD_DIR/cassandra-pmem && \
cp $CASSANDRA_BUILD_DIR/llpl/target/classes/llpl.jar $CASSANDRA_BUILD_DIR/cassandra-pmem/lib/ && \
cp $CASSANDRA_BUILD_DIR/llpl/target/cppbuild/libllpl.so $CASSANDRA_BUILD_DIR/cassandra-pmem/lib/sigar-bin/ && \
ant -autoproxy && \
cd $CASSANDRA_BUILD_DIR && \
mv cassandra-pmem cassandra
tar -zcvf cassandra-pmem-build.tar.gz cassandra
mv cassandra-pmem-build.tar.gz $INITIAL_DIR
cd $INITIAL_DIR
+2
View File
@@ -0,0 +1,2 @@
#!/bin/bash
/usr/bin/chown cassandra-user /dev/dax0.0
+3
View File
@@ -0,0 +1,3 @@
#!/bin/bash
/usr/bin/chown cassandra-user -R /mnt/pmem
/usr/bin/chmod a+rw -R /mnt/pmem
@@ -0,0 +1,6 @@
#!/bin/bash
DATA_DIR="/workspace/cassandra/data"
LOG_DIR="/workspace/cassandra/logs"
/usr/bin/chown cassandra-user -R $DATA_DIR
/usr/bin/chown cassandra-user -R $LOG_DIR
+109
View File
@@ -0,0 +1,109 @@
#!/bin/bash
set -x
#Work in a copy
ORIG_CONFIG_FILE="/workspace/cassandra/conf/cassandra.yaml"
CONFIG_FILE="/workspace/cassandra/conf/cassandra-template.yaml"
ORIG_JVM_OPTIONS_FILE="/workspace/cassandra/conf/jvm-server.options"
JVM_OPTIONS_FILE="/workspace/cassandra/conf/jvm-server.options-template"
SUDOERS_FILE="/etc/sudoers.d/cassandra-user"
function grant_persistent_dirs_permissions {
sudo /usr/local/bin/change_persistent_dirs_perms.sh
}
function grant_pmem_permissions {
if [ -d /mnt/pmem ]
then
sudo /usr/local/bin/change_fsdax_perms.sh
elif [ -e /dev/dax0.0 ]
then
sudo /usr/local/bin/change_devdax_perms.sh
else
echo "No pmem devices are attached to the container on /mnt/pmem(fsdax) or /dev/dax(devdax)!"
exit 1
fi
}
function create_jvm_options {
#function to create jvm-server.options file at runtime
echo "Generating jvm-server.options file"
#Determining if the image is going to use devdax or fsdax devices for pmem
if [ -d /mnt/pmem ]
then
CASSANDRA_FSDAX_POOL_SIZE_GB=${CASSANDRA_FSDAX_POOL_SIZE_GB:-'1'}
CASSANDRA_PMEM_POOL_NAME=${CASSANDRA_PMEM_POOL_NAME:-'cassandra_pool'}
echo -e "-Dpmem_path=/mnt/pmem/$CASSANDRA_PMEM_POOL_NAME\n-Dpool_size=$(echo $(( $CASSANDRA_FSDAX_POOL_SIZE_GB * 1073741824 )) )" | tee -a $JVM_OPTIONS_FILE
elif [ -e /dev/dax0.0 ]
then
echo -e "-Dpmem_path=/dev/dax0.0\n-Dpool_size=0" | tee -a $JVM_OPTIONS_FILE
else
echo "No pmem devices are attached to the container!"
exit 1
fi
#Copy generated config file to the default location
echo "Copying generated jvm-server.options template to default config location..."
cp $JVM_OPTIONS_FILE $ORIG_JVM_OPTIONS_FILE
}
function create_cassandra_yaml {
#Function to create cassandra.yaml file at runtime
echo "Generating cassandra.yaml file"
#Get container IP Address on the first interface
echo "Getting container primary IP address..."
CONTAINER_IP=$(ip address | grep inet | egrep -v "inet6|127.0.0.1" | awk '{print $2}' | awk -F "/" '{print $1}' | head -1)
echo "The container IP address is: $CONTAINER_IP"
#Cluster name
CASSANDRA_CLUSTER_NAME=${CASSANDRA_CLUSTER_NAME:-'Cassandra Cluster'}
echo "cluster_name: '$CASSANDRA_CLUSTER_NAME'" | tee -a $CONFIG_FILE
#Listen address
CASSANDRA_LISTEN_ADDRESS=${CASSANDRA_LISTEN_ADDRESS:-$CONTAINER_IP}
echo "listen_address: '$CASSANDRA_LISTEN_ADDRESS'" | tee -a $CONFIG_FILE
#Seed addresses
CASSANDRA_SEED_ADDRESSES=${CASSANDRA_SEED_ADDRESSES:-"$CASSANDRA_LISTEN_ADDRESS:7000"}
echo -e "seed_provider:\n - class_name: org.apache.cassandra.locator.SimpleSeedProvider\n parameters:\n - seeds: '$CASSANDRA_SEED_ADDRESSES'" | tee -a $CONFIG_FILE
#Snitch
CASSANDRA_SNITCH=${CASSANDRA_SNITCH:-'SimpleSnitch'}
echo "endpoint_snitch: $CASSANDRA_SNITCH" | tee -a $CONFIG_FILE
#RPC listen addresss
CASSANDRA_RPC_ADDRESS=${CASSANDRA_RPC_ADDRESS:-$CONTAINER_IP}
echo "rpc_address: $CASSANDRA_RPC_ADDRESS" | tee -a $CONFIG_FILE
#Copy generated config file to the default location
echo "Copying generated cassandra.yaml template to default config location..."
cp $CONFIG_FILE $ORIG_CONFIG_FILE
}
grant_persistent_dirs_permissions
grant_pmem_permissions
#Creating jvm-server.options if none provided
if [ ! -f $ORIG_JVM_OPTIONS_FILE ]
then
create_jvm_options
else
echo "Using mounted jvm-server.options file..."
fi
#creating cassandra.yaml if none provided
if [ ! -f $ORIG_CONFIG_FILE ]
then
create_cassandra_yaml
else
echo "Using mounted cassandra.yaml file..."
fi
echo "Starting Cassandra..."
# first arg is `-f` or `--some-option`
# or there are no args
if [ "$#" -eq 0 ] || [ "${1#-}" != "$1" ]; then
set -- /workspace/cassandra/bin/cassandra "$@"
fi
exec "$@"
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash
set -eo pipefail
host="$(hostname --ip-address || echo '127.0.0.1')"
port="$(cat /workspace/cassandra/conf/cassandra.yaml | grep 'native_transport_port:' | tail -1 | awk '{print $2}' || echo '9042' )"
if /workspace/cassandra/bin/cqlsh "$host" "$port" < /dev/null; then
exit 0
fi
exit 1
+28
View File
@@ -0,0 +1,28 @@
FROM clearlinux AS build-redis
MAINTAINER otc-swstacks@intel.com
RUN swupd bundle-add --quiet --no-progress git c-basic devpkg-ndctl os-testsuite-phoronix-server
RUN useradd redis-user
ENV REDIS_PMEMD="/tmp/redis"
ENV EXTRA_CFLAGS=" -Wno-error"
RUN git clone https://github.com/pmem/pmem-redis $REDIS_PMEMD && \
cd $REDIS_PMEMD && \
git submodule init && git submodule update && \
make USE_NVM=yes install
FROM clearlinux/os-core:latest
RUN useradd redis-user
COPY scripts/docker-entrypoint.sh scripts/docker-healthcheck /usr/bin/
COPY --from=build-redis /usr/bin/ps /usr/bin/
COPY --from=build-redis /usr/local/bin/* /usr/bin/
COPY --from=build-redis /usr/lib64/libnuma.so* /usr/lib64/libprocps.so* /usr/lib64/
HEALTHCHECK --interval=15s CMD ["docker-healthcheck"]
ENTRYPOINT ["docker-entrypoint.sh"]
USER redis-user
CMD echo "USE: redis-server --nvm-maxcapacity <size> --nvm-dir <persistent mount point> --nvm-threshold <threshold to move to PMEM>" && redis-server --help
+76
View File
@@ -0,0 +1,76 @@
## Database Reference Stack with Redis
[![](https://images.microbadger.com/badges/image/clearlinux/stacks-dbrs-redis.svg)](http://microbadger.com/images/clearlinux/stacks-dbrs-redis "Get your own image badge on microbadger.com")
### Building Locally
The Dockerfiles for all Clear Linux* OS based container images are available at [dockerfiles repository](https://github.com/clearlinux/dockerfiles). These can be used to build and modify the container images.
1. Clone the clearlinux/dockerfiles repository.
```bash
git clone https://github.com/clearlinux/dockerfiles.git
```
2. Change to the directory of the application:
```bash
cd dockerfiles/stacks/dbrs/redis
```
3. Build the container image. Default build args in Docker are on: https://docs.docker.com/engine/reference/builder/#arg
```bash
docker build --no-cache -t clearlinux/stacks-dbrs-redis .
```
### Clone the repository
### Run DBRS Redis as a standalone container
Prior to start the application, you will need to have the DCPMM in fsdax mode with a file system and mounted in `/mnt/dax0`. To know how to configure, read the [DBRS guide](https://docs.01.org/clearlinux/latest/guides/stacks/dbrs.html)
To start the application
```bash
docker run --mount type=bind,source=/mnt/dax0,target=/mnt/pmem0 -i -d --name pmem-redis ${DOCKER_IMAGE} --nvm-maxcapacity 200 --nvm-dir /mnt/pmem0 --nvm-threshold 64 --protected-mode no
```
### Deploy DBRS Redis cluster on Kubernetes
#### Kubernetes installation
To install Kubernetes in Clear Linux, follow the instructions in the Clear Linux's [Kubernetes Tutorial](https://docs.01.org/clearlinux/latest/tutorials/kubernetes.html)
After setting up Kubernetes, you will need to enable it to support DCPMM suing the pmem-csi driver. To install the driver follow the instructions in the [pmem-csi repository](https://github.com/intel/pmem-csi) file.
#### Redis operator install
The source code of the redis operator can be found in this [repository](https://github.com/spotahome/redis-operator).
To install the operator, go to you kubernetes control plane and execute the following command:
```bash
kubectl create -f https://raw.githubusercontent.com/spotahome/redis-operator/master/example/operator/all-redis-operator-resources.yaml
```
#### Redis operator usage
After installing the operator you are ready to deploy redisfailover instances using a yaml file, there is an example for persistent memory [here](https://github.com/spotahome/redis-operator/blob/master/example/redisfailover/pmem.yaml). You can download it and change the source of the image to clearlinux/stacks-dbrs-redis. We have created our own yaml based on this example, you can find it in this repo with the name: `redis-failover.yml`
In the `redis-failover.yml` there is a placeholder for the image name, substitute the word `PMEM_REDIS_IMAGE` with the name of the clearlinux/stacks-dbrs-redis image.
To start a redisfailover instance in Kubernetes using our yaml, move the file to the kubernetes server, then run:
```bash
kubectl create -f redis-failover.yml
```
##### Known issues
There is an issue of the sentinels not having enough memory to create the InitContainer. The issue has been reported [here](https://github.com/spotahome/redis-operator/issues/176). The current workaround is to build the image increasing the limits for the InitContainer memory to 32Mb
**Note**
If you already have a redis-operator, you will need to delete it before installing a new one.
+8
View File
@@ -0,0 +1,8 @@
## Additional details on licenses
As with all Docker images, these likely also contain other software which may
be under other licenses (such as Bash, etc from the base distribution, along
with any direct or indirect dependencies of the primary software being
contained). As for any pre-built image usage, it is the image user's
responsibility to ensure that any use of this image complies with any relevant
licenses for all software contained within.
+147
View File
@@ -0,0 +1,147 @@
List of licenses used in Clear Linux OS.
This list is automatically generated. If you spot a mistake or
omission, please mention this on dev@lists.clearlinux.org.
To read the full license text for these licenses, please visit
http://spdx.org/licenses/. A few licenses in this list are not
declared on the http://spdx.org/licenses/ website, they are listed
at the bottom of this list.
AFL-2.0
AFL-2.1
AGPL-3.0
AML
APSL-2.0
Apache-1.1
Apache-2.0
Artistic-1.0
Artistic-1.0-Perl
Artistic-2.0
BSD-2-Clause
BSD-2-Clause-FreeBSD
BSD-2-Clause-NetBSD
BSD-3-Clause
BSD-3-Clause-Attribution
BSD-3-Clause-Clear
BSD-3-Clause-LBNL
BSD-4-Clause
BSD-4-Clause-UC
BSL-1.0
CC-BY-2.0
CC-BY-3.0
CC-BY-4.0
CC-BY-ND-4.0
CC-BY-SA-2.0
CC-BY-SA-3.0
CC-BY-SA-4.0
CC0-1.0
CDDL-1.0
CDDL-1.1
CECILL-1.1
CPL-1.0
ClArtistic
Distributable
EPL-1.0
FSFULLR
FTL
GFDL-1.1
GFDL-1.2
GFDL-1.3
GFDL-1.3+
GL2PS
GPL-1.0
GPL-1.0+
GPL-2.0
GPL-2.0+
GPL-2.0-only
GPL-2.0-or-later
GPL-3.0
GPL-3.0+
GPL-3.0-only
HPND
ICU
IJG
ISC
ImageMagick
Imlib2
Intel
JSON
JasPer-2.0
LAL-1.2
LGPL-2.0
LGPL-2.0+
LGPL-2.1
LGPL-2.1+
LGPL-2.1-only
LGPL-3.0
LGPL-3.0+
LPPL-1.0
LPPL-1.3c
Libpng
MIT
MIT-Opengroup
MIT-enna
MIT-feh
MPL-1.1
MPL-2.0
MPL-2.0-no-copyleft-exception
MS-PL
MTLL
MakeIndex
NCSA
NTP
NetCDF
Nunit
OFL-1.0
OFL-1.1
OLDAP-2.0.1
OLDAP-2.8
OML
OSL-2.0
OpenSSL
PHP-3.01
PostgreSQL
Public-Domain
Python-2.0
QPL-1.0
Qhull
Rdisc
Ruby
SAX-PD
SGI-B-1.0
SGI-B-1.1
SGI-B-2.0
SISSL
Saxpath
Sleepycat
TCL
Unicode-TOU
Unlicense
Vim
W3C
W3C-19980720
WTFPL
X11
ZPL-2.0
ZPL-2.1
Zend-2.0
Zlib
bzip2-1.0.5
bzip2-1.0.6
gnuplot
libtiff
psutils
zlib-acknowledgement
The following licenses are not standard spdx identifiers:
- Copyright
- Distributable
- Public-Domain
These are used for projects that have explicitly granted redistribution
of the project source code, but don't have a typical OSI approved
license identifier.
+10
View File
@@ -0,0 +1,10 @@
Copyright (c) 2006-2015, Salvatore Sanfilippo
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of Redis nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+44
View File
@@ -0,0 +1,44 @@
apiVersion: databases.spotahome.com/v1
kind: RedisFailover
metadata:
name: redisfailover-pmem
spec:
sentinel:
replicas: 3
command:
- "redis-server"
- "/redis/sentinel.conf"
- "--sentinel"
- "--protected-mode"
- "no"
redis:
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
replicas: 3
image: PMEM_REDIS_IMAGE
command:
- "redis-server"
- "/redis/redis.conf"
- "--nvm-maxcapacity"
- "200"
- "--nvm-dir"
- "/data"
- "--nvm-threshold"
- "44"
- "--protected-mode"
- "no"
- "--dir"
- "/tmp"
storage:
persistentVolumeClaim:
metadata:
name: redisfailover-pmem-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
storageClassName: pmem-csi-sc-ext4
+17
View File
@@ -0,0 +1,17 @@
#!/bin/bash
set -x
if [ -d /mnt/pmem0 ]
then
chown redis-user -R /mnt/pmem0/
chmod -R a+rw /mnt/pmem0
else
echo "No pmem devices (fsdax) are attached to the container on /mnt/pmem0"
exit 1
fi
if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then
set -- redis-server "$@"
fi
exec "$@"
+12
View File
@@ -0,0 +1,12 @@
#!/bin/bash
srv=$(ps -C redis-server -o pid=)
cli=$(ps -C redis-cli -o pid=)
bench=$(ps -C redis-benchmark -o pid=)
sentinel=$(ps -C redis-sentinel -o pid=)
if [[ ! -z "$srv$cli$bench$sentinel" ]]; then
exit 0
fi
exit 1
+79
View File
@@ -0,0 +1,79 @@
# Database Reference Stack
The Database Reference Stack, an integrated, highly-performant open source stack optimized for next-generation 2nd Generation Intel® Xeon® Scalable processors with Intel® Optane™ DC persistent memory. This open source community release is part of our effort to ensure datacenters can reduce the bottlenecks and data latency by implementing intelligent, scalable and cost-effective storage mechanisms. The Database Reference Stack boosts the performance of data-intensive applications using traditional SSD storage drives by using DIMM modules as a persistant system storage.
> **Note:**
For more information regarding Intel® Optane™ DC persistent memory please visit the [official Optane web page](https://www.intel.com/content/www/us/en/architecture-and-technology/intel-optane-technology.html).
# The Database Reference Stack Releases
To offer more flexibility, we are releasing multiple versions of the Database Reference Stack. All versions are built on top of the Clear Linux OS, which is optimized for I/O.
> **Note:**
Clear Linux will be automatically updated to the latest release version in the container. The minimum validated version of Clear Linux for this stack is 30770.
## The Database Reference Stack with Cassandra
The release includes:
* Clear Linux* OS
* Cassandra 4.0 with persistent memory feature in App-Direct mode.
* PMDK 1.5.1 library as the storage engine
* openjdk 1.8.0
> **Note:**
The PMDK library support has been added to the kernel since version 4.9, however it has more estability on kernel versions 5.0+
## The Database Reference Stack with Redis
The release includes:
* Clear Linux* OS
* Redis 4.0 with persistent memory feature in App-Direct mode.
* memkind 1.9.0 library as the storage engine
## How to get the Database Reference Stack
The official Database Reference Stack Docker images are hosted at: https://hub.docker.com/u/clearlinux/:
* Pull from the [Cassandra image](https://hub.docker.com/r/clearlinux/stacks-dbrs-cassandra)
* Pull from the [Redis image](https://hub.docker.com/r/clearlinux/stacks-dbrs-redis)
# Licensing
The Database Reference Stack is guided by the same [Terms of Use](https://download.clearlinux.org/TermsOfUse.html) declared by the Clear Linux project. The Docker images are hosted on https://hub.docker.com and as with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc. from the base distribution, along with any direct or indirect dependencies of the primary software being contained).
# Working with the Database Reference Stack
The components of the Database Reference stack where selected because they support use of DCPMM in App-Direct Mode.
The images can be used in a Kubernetes cluster as a multi-node environment. To enable DCPMM support in Kubernetes, it is required to use the [pmem-csi driver](https://github.com/intel/pmem-csi) to create the storage classes which will map to the DCPMM regions in fsdax mode.
Please refer to the [Database Reference Stack tutorial](https://clearlinux.org/documentation/clear-linux/tutorials/dbrs) for detailed instructions for running the benchmarks on the docker images.
# Contributing to the Database Reference Stack
We encourage your contributions to this project, through the established Clear Linux community tools. Our team uses typical open source collaboration tools that are described on the Clear Linux [community page](https://clearlinux.org/community).
# Reporting Security Issues
If you have discovered potential security vulnerability in an Intel product, please contact the iPSIRT at secure@intel.com.
It is important to include the following details:
* The products and versions affected
* Detailed description of the vulnerability
* Information on known exploits
Vulnerability information is extremely sensitive. The iPSIRT strongly recommends that all security vulnerability reports sent to Intel be encrypted using the iPSIRT PGP key. The PGP key is available here: https://www.intel.com/content/www/us/en/security-center/pgp-public-key.html
Software to encrypt messages may be obtained from:
* PGP Corporation
* GnuPG