mirror of
https://github.com/clearlinux/dockerfiles.git
synced 2026-08-26 18:35:58 +00:00
Cleanup docker images
This commit is contained in:
committed by
William Douglas
parent
5e681067b1
commit
7eb8a1e861
@@ -1,13 +0,0 @@
|
||||
FROM clearlinux:latest
|
||||
|
||||
ARG swupd_args
|
||||
|
||||
COPY setup.py /usr/bin/setup.py
|
||||
|
||||
# Update and add bundles
|
||||
RUN swupd update $swupd_args && \
|
||||
swupd bundle-add os-clr-on-clr $swupd_args && \
|
||||
chmod 755 /usr/bin/setup.py
|
||||
|
||||
ENTRYPOINT ["/usr/bin/setup.py"]
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
# Clear SDK Container
|
||||
[](https://microbadger.com/images/clearlinux/clr-sdk "Get your own image badge on microbadger.com")
|
||||
[](https://microbadger.com/images/clearlinux/clr-sdk "Get your own version badge on microbadger.com")
|
||||
|
||||
This repo provides a Clear Linux* SDK container for running the Clear Linux devloper tools. This container will allow you to use the [mixer tool](https://clearlinux.org/features/mixer) on your Linux host.
|
||||
|
||||
> ### :warning: **IMPORTANT NOTE:**
|
||||
> As of `mixer` version `5.0.0`, you **must** run `mixer` with the `--native`
|
||||
> flag inside the `clr-sdk` container. This is because `mixer` now attempts to
|
||||
> automatically run build commands within a Docker container containing the
|
||||
> correct toolchain version for the mix you are building. This is not possible
|
||||
> if you are already running within the `clr-sdk` container. The `--native` flag
|
||||
> foregoes this container launch, allowing the build to proceed as normal.
|
||||
>
|
||||
> If you _need_ this containerized `mixer` behavior to build across formats, it
|
||||
> is possible to mount the host system's Docker socket when you launch the
|
||||
> container (i.e., passing `-v /var/run/docker.sock:/var/run/docker.sock` to
|
||||
> your `docker run`). This has the effect of the in-container Docker actually
|
||||
> spawning _sibling_ containers on the host system, rather than _child_
|
||||
> containers within the `clr-sdk` container. In this case, the workdir path
|
||||
> _inside_ the container must match the path on the host, as it is the host's
|
||||
> Docker daemon that will be interpreting the path.
|
||||
|
||||
# Build
|
||||
## Building Locally
|
||||
|
||||
```
|
||||
docker build -t clearlinux/clr-sdk .
|
||||
```
|
||||
> #### Note:
|
||||
> If you are behind a firewall, you may need to pass the `--network host`,
|
||||
> `--build-arg http_proxy=http://<proxy>:<port>`,
|
||||
> `--build-arg https_proxy=https://<proxy>:<port>`, and/or
|
||||
> `--build-arg no_proxy=http://<proxy>:<port>`, flags to `docker build` to
|
||||
> configure your proxy.
|
||||
|
||||
#### Optional Build ARGs
|
||||
* `--build-arg swupd_args` specifies [SWUPD](https://github.com/clearlinux/swupd-client/blob/master/docs/swupd.1.rst#options) flags passed to the update during build.
|
||||
## Pulling from Dockerhub
|
||||
```
|
||||
docker pull clearlinux/clr-sdk
|
||||
```
|
||||
|
||||
# Run
|
||||
* **Create a mix directory**
|
||||
|
||||
The directory you create will be used for the output created while using the container.
|
||||
```
|
||||
mkdir -p /home/myuser/mix
|
||||
```
|
||||
*It is important that you are the owner of this directory.* The owner of the
|
||||
directory is what determines the user id used inside the container. If you
|
||||
are not the owner of the directory, you may not have access to the files the
|
||||
container creates.
|
||||
* **Running the Docker container**
|
||||
|
||||
Assuming you created the mix directory as described above, the command t
|
||||
o run the Docker container would be:
|
||||
```
|
||||
docker run --rm -it -v /home/myuser/mix:/home/clr/mix clearlinux/clr-sdk --mixdir=/home/clr/mix
|
||||
```
|
||||
### A note on the arguments:
|
||||
#### `docker run` arguments
|
||||
* `--rm` cleans up and removes the container once you exit it. The files
|
||||
generated in the mounted directory will persist on the host.
|
||||
* `-it` attaches an interactive terminal.
|
||||
* `-v /path/on/host:/path/in/container` bind mounts a directory on the host
|
||||
to a path inside the container. Only the files generated in this path
|
||||
inside the container will be accessible on the host or persist after
|
||||
the container has exited. The container path will be automatically
|
||||
generated within the container if it doesn't already exist, and will
|
||||
replace whatever may already be there, so _use caution_.
|
||||
* If you plan to run `sudo mixer build image` inside the container, you
|
||||
must additionally pass `--privileged -v /dev:/dev` to `docker run`. This is
|
||||
because `mixer build image` needs to mount a loopback device for generating
|
||||
the image filesystem. The `-v /dev:/dev` bind mount is due to an [outstanding
|
||||
issue](https://github.com/moby/moby/issues/27886) where loopback devices
|
||||
created within the container are not visible within the container.
|
||||
> ### :warning: **IMPORTANT NOTE:**
|
||||
> Running the container in this way can have **serious side effects** on
|
||||
> your host machine, so only use these flags for this specific command. **Do
|
||||
> not run the container this way as your regular work flow.**
|
||||
>
|
||||
> * `--privileged` permits the container to create the loopback device, but
|
||||
> also removes other security limitations normally placed on containers.
|
||||
> * `-v /dev:/dev` permits the container to see the loopback device, but
|
||||
> also gives the container direct access to the _host's_ entire device
|
||||
> directory, including all mounted drives.
|
||||
* If you are behind a firewall, you may need to pass the `--network host`
|
||||
flag to `docker run`, and then set your `http_proxy` and `https_proxy`
|
||||
environment variables within the container to configure your proxy.
|
||||
* Please see note above about mounting the host system's Docker socket if
|
||||
you cannot use the `--native` flag when running `mixer`.
|
||||
#### Container arguments
|
||||
* `-d`|`--mixdir` tells the startup script what directory you mounted using
|
||||
the `-v` option above. The owner UID and GID of this directory will be
|
||||
used for user inside the container. This is also the active directory when
|
||||
the container runs. Omitting this argument will result in a default user
|
||||
id and active directory, _even if you mounted a directory with -v_. This
|
||||
can be useful, but is likely not what you want, and may cause the container
|
||||
user to not have permission to access the mounted mix directory.
|
||||
* `--id` manually sets the UID and GID for the user inside the container.
|
||||
Should be in the form UID:GID. Takes precedence over id inferred by
|
||||
mixdir argument. This may cause the container user to not have permission
|
||||
to access the mounted mix directory.
|
||||
|
||||
At this point, you should be able to run the commands described in the
|
||||
[mixer guide](https://clearlinux.org/documentation/clear-linux/guides/maintenance/mixer).
|
||||
**Please see the note above about the `--native` flag.**
|
||||
@@ -1,89 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import argparse
|
||||
import subprocess
|
||||
import os
|
||||
import sys
|
||||
import pathlib
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-d','--mixdir',
|
||||
help='The directory where you intend to make your mix. '
|
||||
'This will be the active directory once the container '
|
||||
'is running. In the abscence of the "id" argument, '
|
||||
'the owner uid and gid of the mixdir will be used for '
|
||||
'the user in the container.')
|
||||
|
||||
parser.add_argument("--id",
|
||||
help='UID and GID to use for the user inside the '
|
||||
'container. It should be in the form UID:GID.')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
mixdir = args.mixdir if args.mixdir else "/home/clr/mix"
|
||||
|
||||
|
||||
# Get UID and GID for user
|
||||
uid,gid = (None, None)
|
||||
if args.id:
|
||||
try:
|
||||
uid,gid = args.id.split(":")
|
||||
uid = int(uid)
|
||||
gid = int(gid)
|
||||
except ValueError:
|
||||
sys.stderr.write("Invalid id: Must be of form UID:GID\n")
|
||||
sys.exit(1)
|
||||
elif args.mixdir:
|
||||
# Use owner of mixdir
|
||||
try:
|
||||
stat = os.stat(args.mixdir)
|
||||
uid,gid = (stat.st_uid, stat.st_gid)
|
||||
except FileNotFoundError:
|
||||
# This implies the --mixdir flag was passed, but to a
|
||||
# directory that doesn't exist. It will get created below.
|
||||
pass
|
||||
|
||||
if not uid or not gid:
|
||||
# Use default
|
||||
uid,gid = (1000, 1000)
|
||||
elif uid == 0 or gid == 0:
|
||||
sys.stderr.write("UID and GID must both be non-zero.\n")
|
||||
sys.exit(1)
|
||||
|
||||
user = "clr"
|
||||
|
||||
# Create the group and user
|
||||
try:
|
||||
cmd = "groupadd -o -g {} {}".format(gid,user)
|
||||
subprocess.run(cmd.split(),stdout=subprocess.PIPE,stderr=subprocess.STDOUT,check=True)
|
||||
# Note: adding user to mock group for access to running mock
|
||||
cmd = "useradd -Nmo -g {} -G mock,wheelnopw -u {} {}".format(gid,uid,user)
|
||||
subprocess.run(cmd.split(),stdout=subprocess.PIPE,stderr=subprocess.STDOUT,check=True)
|
||||
os.chown("/home/{}".format(user),uid,gid)
|
||||
except subprocess.CalledProcessError as e:
|
||||
if e.returncode and e.returncode == 9:
|
||||
# Both 'groupadd' and 'useradd' return error code 9 if the group/user
|
||||
# already exists. This will happen if the container is restarted or
|
||||
# this script is manually re-run.
|
||||
pass
|
||||
else:
|
||||
sys.stderr.write("Error creating user.\n")
|
||||
sys.exit(1)
|
||||
except subprocess.SubprocessError:
|
||||
sys.stderr.write("Error creating user.\n")
|
||||
sys.exit(1)
|
||||
|
||||
# Create the mix directory if it doesn't exist.
|
||||
# Note: we catch FileExistsError rather than using exist_ok=True so
|
||||
# that we only chown the directory if we're the one that created it.
|
||||
try:
|
||||
pathlib.Path(mixdir).mkdir(parents=True)
|
||||
os.chown(mixdir,uid,gid)
|
||||
except FileExistsError:
|
||||
pass
|
||||
|
||||
# Move to mixdir and start bash as new user
|
||||
os.chdir(mixdir)
|
||||
cmd = "su {}".format(user).split()
|
||||
os.execvp(cmd[0], cmd)
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
FROM clearlinux:latest AS builder
|
||||
|
||||
ARG swupd_args
|
||||
# Move to latest Clear Linux release to ensure
|
||||
# that the swupd command line arguments are
|
||||
# correct
|
||||
RUN swupd update --no-boot-update $swupd_args
|
||||
|
||||
# Grab os-release info from the minimal base image so
|
||||
# that the new content matches the exact OS version
|
||||
COPY --from=clearlinux/os-core:latest /usr/lib/os-release /
|
||||
|
||||
# Install additional content in a target directory
|
||||
# using the os version from the minimal base
|
||||
RUN source /os-release && \
|
||||
mkdir /install_root \
|
||||
&& swupd os-install -V ${VERSION_ID} \
|
||||
--path /install_root --statedir /swupd-state \
|
||||
--bundles=os-core-update,curl,computer-vision-openvino --no-boot-update
|
||||
|
||||
# For some Host OS configuration with redirect_dir on,
|
||||
# extra data are saved on the upper layer when the same
|
||||
# file exists on different layers. To minimize docker
|
||||
# image size, remove the overlapped files before copy.
|
||||
RUN mkdir /os_core_install
|
||||
COPY --from=clearlinux/os-core:latest / /os_core_install/
|
||||
RUN cd / && \
|
||||
find os_core_install | sed -e 's/os_core_install/install_root/' | xargs rm -d &> /dev/null || true
|
||||
|
||||
FROM clearlinux/os-core:latest
|
||||
|
||||
COPY --from=builder /install_root /
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# path to save pre-downloaded models
|
||||
ENV MODEL_DIR="/models"
|
||||
ENV MO_PATH="/usr/share/openvino/model-optimizer/mo.py"
|
||||
|
||||
# MODEL will be used by the container
|
||||
# If not pre-downloaded, the entrypoint will try download it and set the MODEL_PATH
|
||||
# ENVs values could be passed by users to dynamically choose model to be used
|
||||
ENV MODEL_NAME="face-detection-retail-0005"
|
||||
ENV MODEL_PRECISION="FP32"
|
||||
|
||||
# pre-downloaded and converted models for openvino
|
||||
COPY ./models.txt /app
|
||||
RUN for m in $(cat /app/models.txt); do \
|
||||
model-downloader --name $m -o $MODEL_DIR && \
|
||||
model-converter --name $m -d $MODEL_DIR -o $MODEL_DIR --mo $MO_PATH; \
|
||||
done
|
||||
|
||||
# Pre-install some python libs for serivce to use
|
||||
COPY ./requirements.txt /app
|
||||
RUN pip3 install -r /app/requirements.txt
|
||||
|
||||
COPY ./set_model_path.sh /app
|
||||
COPY docker-entrypoint.sh /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
|
||||
@@ -1,206 +0,0 @@
|
||||
# Clear Linux* OS `openvino` container image
|
||||
|
||||
<!-- Required -->
|
||||
## What is this image?
|
||||
|
||||
`clearlinux/openvino` is a Docker image with `dldt` running on top of the
|
||||
[official clearlinux base image](https://hub.docker.com/_/clearlinux).
|
||||
|
||||
<!-- application introduction -->
|
||||
> [openvino](https://01.org/openvinotoolkit) OpenVINO™ toolkit, short
|
||||
> for Open Visual Inference and Neural network Optimization toolkit, provides
|
||||
> developers with improved neural network performance on a variety of
|
||||
> Intel® processors and helps them further unlock cost-effective, real-time
|
||||
> vision applications.
|
||||
|
||||
For other Clear Linux* OS
|
||||
based container images, see: https://hub.docker.com/u/clearlinux
|
||||
|
||||
## Why use a clearlinux based image?
|
||||
|
||||
<!-- CL introduction -->
|
||||
> [Clear Linux* OS](https://clearlinux.org/) is an open source, rolling release
|
||||
> Linux distribution optimized for performance and security, from the Cloud to
|
||||
> the Edge, designed for customization, and manageability.
|
||||
|
||||
Clear Linux* OS based container images use:
|
||||
* Optimized libraries that are compiled with latest compiler versions and
|
||||
flags.
|
||||
* Software packages that follow upstream source closely and update frequently.
|
||||
* An aggressive security model and best practices for CVE patching.
|
||||
* A multi-staged build approach to keep a reduced container image size.
|
||||
* The same container syntax as the official images to make getting started
|
||||
easy.
|
||||
|
||||
To learn more about Clear Linux* OS, visit: https://clearlinux.org.
|
||||
|
||||
## Supported Devices
|
||||
|
||||
The dldt package in Clear Linux enables support for below devices.
|
||||
|
||||
|
||||
| PLUGIN | DEVICE TYPES |
|
||||
| ---------------------| -------------|
|
||||
| CPU plugin | Intel® Xeon® with Intel® AVX2 and AVX512, Intel® Core™ Processors with Intel® AVX2, Intel® Atom® Processors with Intel® SSE |
|
||||
| GPU plugin | Intel® Processor Graphics, including Intel® HD Graphics and Intel® Iris® Graphics |
|
||||
| MYRIAD plugin | Intel® Movidius™ Neural Compute Stick powered by the Intel® Movidius™ Myriad™ 2, Intel® Neural Compute Stick 2 powered by the Intel® Movidius™ Myriad™ X |
|
||||
|
||||
Therefore, this clearlinux/opevino container image could be used directly for above.
|
||||
But please keep in mind, to run in docker for GPU/MYRIAD plugin, some devices have to
|
||||
be mapping to the running container.
|
||||
|
||||
Taking GPU plugin for example, attach the GPU to the container using `--device /dev/dri`
|
||||
option and run the container:
|
||||
```
|
||||
docker run -it --device /dev/dri clearlinux/openvino
|
||||
```
|
||||
|
||||
For details please refer to the [link](https://docs.openvinotoolkit.org/latest/_docs_install_guides_installing_openvino_docker_linux.html)
|
||||
|
||||
## Environment variables
|
||||
|
||||
#### MODEL_DIR
|
||||
It is the root directory to save openvino models, default /models.
|
||||
|
||||
#### MO_PATH
|
||||
It points to the path of Model Optimizer mo.py.
|
||||
It is "/usr/share/openvino/model-optimizer/mo.py" in default.
|
||||
|
||||
#### MODEL_NAME
|
||||
The model name to be used.
|
||||
If it is not pre-downloaded, the entrypoint script will do the downloading and
|
||||
converting to IR format.
|
||||
Run the below command can get all supported models.
|
||||
```
|
||||
docker run --rm clearlinux/openvino model-downloader --print_all
|
||||
```
|
||||
|
||||
#### MODEL_PRECISION
|
||||
The model precision to be chosen, FP32, FP16 or INT8.
|
||||
|
||||
#### MODEL_PATH
|
||||
The chosen model path, automatically set by the entrypoint script.
|
||||
|
||||
For example, if using [`mobilenetv2-int8-tf-0001`](https://github.com/opencv/open_model_zoo/blob/master/models/intel/mobilenetv2-int8-tf-0001/description/mobilenetv2-int8-tf-0001.md) model to do classification, two environment variables need to be passed to the container.
|
||||
Details can refer to the deployment below.
|
||||
|
||||
Note, use trained and quantized INT8 fixed-point precision model such as `mobilenetv2-int8-tf-0001`
|
||||
on AVX512 VNNI platform could get [big performance advantage](https://www.intel.ai/vnni-enables-inference/).
|
||||
|
||||
<!-- Required -->
|
||||
## Deployment:
|
||||
|
||||
### Deploy with Docker
|
||||
The easiest way to get started with this image is by simply pulling it from
|
||||
Docker Hub.
|
||||
|
||||
1. Pull the image from Docker Hub:
|
||||
```
|
||||
docker pull clearlinux/openvino
|
||||
```
|
||||
|
||||
2. Start one-time classification_sample with mobilenetv2-int8-tf-0001 model as below:
|
||||
|
||||
* Use docker-compose to start the example:
|
||||
```
|
||||
docker-compose -f docker-compose.yml up
|
||||
```
|
||||
The configuration is defined in the
|
||||
[`docker-compose.yml`](https://github.com/clearlinux/dockerfiles/blob/master/openvino/docker-compose.yml)
|
||||
|
||||
|
||||
Or
|
||||
|
||||
3. Start a simple openvino-server to accept image to do classification_sample with mobilenetv2-int8-tf-0001 model:
|
||||
|
||||
* Use docker-compose to start the server first:
|
||||
```
|
||||
docker-compose -f docker-compose-server.yml up
|
||||
```
|
||||
The configuration is defined in the
|
||||
[`docker-compose-server.yml`](https://github.com/clearlinux/dockerfiles/blob/master/openvino/docker-compose-server.yml)
|
||||
|
||||
* Use curl to send image to the server for classification:
|
||||
```
|
||||
curl -H "Content-type: application/octet-stream" -X POST http://localhost:5000/image --data-binary @cat.bmp
|
||||
```
|
||||
|
||||
|
||||
<!-- Optional -->
|
||||
### Deploy with Kubernetes
|
||||
This image can also be deployed on a Kubernetes cluster, such as
|
||||
[minikube](https://kubernetes.io/docs/setup/learning-environment/minikube/).The
|
||||
following example YAML files are provided in the repository as
|
||||
reference for Kubernetes deployment:
|
||||
|
||||
* [`classification.yaml`](https://github.com/clearlinux/dockerfiles/blob/master/openvino/classification.yaml):
|
||||
yaml file to deploy the openvino classification example
|
||||
|
||||
To deploy the image on a Kubernetes cluster:
|
||||
|
||||
* Start the openvino classification example server.
|
||||
```
|
||||
kubectl apply -f classification.yaml
|
||||
```
|
||||
|
||||
* Then check if the pods are running well.
|
||||
```
|
||||
kubectl get pods -o wide
|
||||
```
|
||||
This may take some time because it requires downloading/converting the model.
|
||||
Note, if your cluster is behind some proxy, you may need set the proxy
|
||||
environment in the yaml file to make the model-init can download the model.
|
||||
|
||||
* Get server PORT and IP
|
||||
```
|
||||
PORT=`kubectl get -o jsonpath="{.spec.ports[0].nodePort}" services openvino-server`
|
||||
NODEIP=`kubectl get nodes -o jsonpath="{.items[0].status.addresses[0].address}"`
|
||||
```
|
||||
|
||||
* Use curl to send image to the server for classification:
|
||||
```
|
||||
curl -H "Content-type: application/octet-stream" -X POST http://$NODEIP:$PORT/image --data-binary @cat.bmp
|
||||
```
|
||||
|
||||
<!-- Required -->
|
||||
## Build and modify:
|
||||
|
||||
The Dockerfiles for all Clear Linux* OS based container images are available at
|
||||
https://github.com/clearlinux/dockerfiles. These can be used to build and
|
||||
modify the container images.
|
||||
|
||||
1. Clone the clearlinux/dockerfiles repository.
|
||||
```
|
||||
git clone https://github.com/clearlinux/dockerfiles.git
|
||||
```
|
||||
|
||||
2. Change to the directory of the application:
|
||||
```
|
||||
cd openvino/
|
||||
```
|
||||
|
||||
3. Build the container image:
|
||||
```
|
||||
docker build -t clearlinux/openvino .
|
||||
```
|
||||
|
||||
[`models.txt`](https://github.com/clearlinux/dockerfiles/blob/master/openvino/models.txt):
|
||||
It defines the models will be pre-downloaded and converted to IR format in container image.
|
||||
|
||||
[`requirements.txt`](https://github.com/clearlinux/dockerfiles/blob/master/openvino/requirements.txt):
|
||||
It defines the python packages to be installed in container image.
|
||||
|
||||
Refer to the Docker documentation for [default build
|
||||
arguments](https://docs.docker.com/engine/reference/builder/#arg).
|
||||
Additionally:
|
||||
|
||||
- `swupd_args` - specifies arguments to pass to the Clear Linux* OS software
|
||||
manager. See the [swupd man
|
||||
pages](https://github.com/clearlinux/swupd-client/blob/master/docs/swupd.1.rst#options)
|
||||
for more information.
|
||||
|
||||
<!-- Required -->
|
||||
## Licenses
|
||||
|
||||
All licenses for the Clear Linux* Project and distributed software can be found
|
||||
at https://clearlinux.org/terms-and-policies
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
import subprocess
|
||||
from flask import Flask, request
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route('/')
|
||||
def classification_sample():
|
||||
return 'Classification sample'
|
||||
|
||||
@app.route('/image', methods=['POST'])
|
||||
def do_classification():
|
||||
if request.headers['Content-Type'] == 'application/octet-stream':
|
||||
f = open('./image', 'wb')
|
||||
f.write(request.data)
|
||||
return subprocess.check_output("classification_sample_async -i ./image -m $MODEL_PATH/$MODEL_NAME.xml", shell=True)
|
||||
else:
|
||||
return "415 Unsupported Media Type ;)"
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True,host='0.0.0.0')
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 703 KiB |
@@ -1,84 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: server
|
||||
data:
|
||||
app.py: |
|
||||
import subprocess
|
||||
from flask import Flask, request
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route('/')
|
||||
def classification_sample():
|
||||
return 'Classification sample'
|
||||
|
||||
@app.route('/image', methods=['POST'])
|
||||
def do_classification():
|
||||
if request.headers['Content-Type'] == 'application/octet-stream':
|
||||
f = open('./image', 'wb')
|
||||
f.write(request.data)
|
||||
return subprocess.check_output("classification_sample_async -i ./image -m $MODEL_PATH/$MODEL_NAME.xml", shell=True)
|
||||
else:
|
||||
return "415 Unsupported Media Type ;)"
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True, host='0.0.0.0')
|
||||
|
||||
---
|
||||
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: openvino-deploy
|
||||
labels:
|
||||
app: classification
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: classification
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: classification
|
||||
spec:
|
||||
containers:
|
||||
- name: classification
|
||||
image: clearlinux/openvino
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
# - name: http_proxy
|
||||
# value: <your proxy>
|
||||
# - name: https_proxy
|
||||
# value: <your proxy>
|
||||
- name: MODEL_NAME
|
||||
value: mobilenetv2-int8-tf-0001
|
||||
- name: MODEL_PRECISION
|
||||
value: FP32
|
||||
args:
|
||||
- "python3"
|
||||
- "app.py"
|
||||
ports:
|
||||
- containerPort: 5000
|
||||
volumeMounts:
|
||||
- name: server-py
|
||||
mountPath: /app/app.py
|
||||
subPath: app.py
|
||||
volumes:
|
||||
- name: server-py
|
||||
configMap:
|
||||
name: server
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: openvino-server
|
||||
spec:
|
||||
type: NodePort
|
||||
ports:
|
||||
- port: 5000
|
||||
nodePort: 30008
|
||||
selector:
|
||||
app: classification
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright (C) 2018 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
classification_sample_async -i cat.bmp -m $MODEL_PATH/$MODEL_NAME.xml
|
||||
@@ -1,16 +0,0 @@
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
openvino:
|
||||
image: clearlinux/openvino:latest
|
||||
environment:
|
||||
http_proxy: $http_proxy
|
||||
https_proxy: $https_proxy
|
||||
MODEL_NAME: mobilenetv2-int8-tf-0001
|
||||
MODEL_PRECISION: FP32
|
||||
ports:
|
||||
- "5000:5000"
|
||||
volumes:
|
||||
- "./app.py:/app/app.py"
|
||||
command: "python3 app.py"
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
openvino:
|
||||
image: clearlinux/openvino:latest
|
||||
environment:
|
||||
http_proxy: $http_proxy
|
||||
https_proxy: $https_proxy
|
||||
MODEL_NAME: mobilenetv2-int8-tf-0001
|
||||
MODEL_PRECISION: FP32
|
||||
volumes:
|
||||
- "./cat.bmp:/app/cat.bmp"
|
||||
- "./demo.sh:/app/demo.sh"
|
||||
command: "/app/demo.sh"
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
source /app/set_model_path.sh
|
||||
|
||||
echo "MODEL NAME: $MODEL_NAME"
|
||||
echo "MODEL PRECISION: $MODEL_PRECISION"
|
||||
echo "MODEL PATH: $MODEL_PATH"
|
||||
|
||||
exec "$@"
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/bin/bash
|
||||
. ../docker-hooks.sh
|
||||
|
||||
image="clearlinux/openvino"
|
||||
package=dldt
|
||||
|
||||
do_tag $image $package
|
||||
@@ -1,4 +0,0 @@
|
||||
face-detection-retail-0005
|
||||
facial-landmarks-35-adas-0002
|
||||
person-vehicle-bike-detection-crossroad-0078
|
||||
person-detection-retail-0013
|
||||
@@ -1,3 +0,0 @@
|
||||
flask
|
||||
redis
|
||||
networkx==2.3
|
||||
@@ -1,34 +0,0 @@
|
||||
#!/bin/sh
|
||||
# set -e
|
||||
|
||||
# download model
|
||||
model_dl() {
|
||||
model-downloader --name $1 -o $MODEL_DIR && \
|
||||
model-converter --name $1 -d $MODEL_DIR -o $MODEL_DIR --mo $MO_PATH; \
|
||||
}
|
||||
|
||||
# set model path
|
||||
set_model_path() {
|
||||
if [ "$MODEL_PRECISION" ]; then
|
||||
MODEL_PATH=$(find $MODEL_DIR -name "$MODEL_NAME.xml" | grep $MODEL_PRECISION)
|
||||
else
|
||||
MODEL_PATH=$(find $MODEL_DIR -name "$MODEL_NAME.xml")
|
||||
fi
|
||||
|
||||
export MODEL_PATH=${MODEL_PATH%/*}
|
||||
}
|
||||
|
||||
# download models if not existed and set the model path
|
||||
if [ "$MODEL_NAME" ]; then
|
||||
set_model_path
|
||||
|
||||
if [ -z "$MODEL_PATH" ]; then
|
||||
model_dl $MODEL_NAME
|
||||
set_model_path
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$MODEL_PATH" ]; then
|
||||
echo "Wrong model $MODEL_NAME, couldn't set MODEL_PATH"
|
||||
fi
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
# Intel System Stacks
|
||||
|
||||
NOTE: This directory will be archived soon, we recommend you use the [Intel System Stacks repo](https://github.com/intel/stacks) instead.
|
||||
@@ -1,9 +0,0 @@
|
||||
# Data Analytics Reference Stack
|
||||
|
||||
This provides the Data Analytics Reference Stack. To offer more flexibility,
|
||||
there are two versions of the Data Analytics Reference Stack:
|
||||
|
||||
* A Clear Linux derived image optimized for [OpenBLAS](https://www.openblas.net/)
|
||||
* A Clear Linux derived image optimized for Intel® Math Kernel Library [MKL](https://software.intel.com/en-us/mkl)
|
||||
|
||||
Please see the folders in this level about the variants and how to build and use them.
|
||||
@@ -1,90 +0,0 @@
|
||||
FROM clearlinux:latest AS builder
|
||||
ARG swupd_args
|
||||
|
||||
# Move to latest Clear Linux release to ensure
|
||||
# that the swupd command line arguments are
|
||||
# correct
|
||||
RUN swupd update --no-boot-update $swupd_args && \
|
||||
swupd bundle-add curl
|
||||
|
||||
# Grab os-release info from the minimal base image so
|
||||
# that the new content matches the exact OS version
|
||||
COPY --from=clearlinux/os-core:latest /usr/lib/os-release /
|
||||
|
||||
# Install additional content in a target directory
|
||||
# using the os version from the minimal base
|
||||
RUN source /os-release && \
|
||||
mkdir /install_root \
|
||||
&& swupd os-install -V ${VERSION_ID} \
|
||||
--path /install_root --statedir /swupd-state \
|
||||
--bundles=big-data-basic,cpio,os-core-update,which --no-boot-update \
|
||||
&& rm -rf /install_root/var/lib/swupd/*
|
||||
|
||||
# fetch MKL library and wrapper
|
||||
RUN URL='http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/15816' && \
|
||||
MKL_VERSION='l_mkl_2019.5.281_online' && \
|
||||
mkdir /install_root/mkl /install_root/mkl_wrapper && \
|
||||
curl ${URL}/${MKL_VERSION}.tgz -o /install_root/mkl/${MKL_VERSION}.tgz && \
|
||||
tar -xvf /install_root/mkl/${MKL_VERSION}.tgz -C /install_root/mkl --strip-components=1 && \
|
||||
curl -L https://github.com/Intel-bigdata/mkl_wrapper_for_non_CDH/raw/master/mkl_wrapper.jar -o /install_root/mkl_wrapper/mkl_wrapper.jar && \
|
||||
curl -L https://github.com/Intel-bigdata/mkl_wrapper_for_non_CDH/raw/master/mkl_wrapper.so -o /install_root/mkl_wrapper/mkl_wrapper.so
|
||||
|
||||
# For some Host OS configuration with redirect_dir on,
|
||||
# extra data are saved on the upper layer when the same
|
||||
# file exists on different layers. To minimize docker
|
||||
# image size, remove the overlapped files before copy.
|
||||
RUN mkdir /os_core_install
|
||||
COPY --from=clearlinux/os-core:latest / /os_core_install/
|
||||
RUN find / os_core_install | sed -e 's/os_core_install/install_root/' | xargs rm -d &> /dev/null || true
|
||||
|
||||
FROM clearlinux/os-core:latest
|
||||
LABEL maintainer=otc-swstacks@intel.com
|
||||
|
||||
ENV HOME=/root
|
||||
|
||||
COPY --from=builder /install_root /
|
||||
COPY --from=builder /install_root/mkl /mkl
|
||||
|
||||
# Configure openjdk11
|
||||
ENV JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk
|
||||
ENV PATH="${JAVA_HOME}/bin:${PATH}"
|
||||
|
||||
# Environment variables to point to Hadoop,
|
||||
# Spark and YARN installation and configuration
|
||||
ENV HADOOP_HOME=/usr
|
||||
ENV HADOOP_CONF_DIR=/etc/hadoop
|
||||
ENV HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
|
||||
ENV HADOOP_DEFAULT_LIBEXEC_DIR=$HADOOP_HOME/libexec
|
||||
ENV HADOOP_IDENT_STRING=root
|
||||
ENV HADOOP_LOG_DIR=/var/log/hadoop
|
||||
ENV HADOOP_PID_DIR=/var/log/hadoop/pid
|
||||
ENV HADOOP_OPTS="-Djava.library.path=$HADOOP_HOME/lib/native"
|
||||
|
||||
ENV HDFS_DATANODE_USER=root
|
||||
ENV HDFS_NAMENODE_USER=root
|
||||
ENV HDFS_SECONDARYNAMENODE_USER=root
|
||||
|
||||
ENV SPARK_HOME=/usr/share/apache-spark
|
||||
ENV SPARK_CONF_DIR=/etc/spark
|
||||
|
||||
ENV YARN_RESOURCEMANAGER_USER=root
|
||||
ENV YARN_NODEMANAGER_USER=root
|
||||
|
||||
COPY dars.ld.so.conf /etc/ld.so.conf
|
||||
COPY silent.cfg /mkl
|
||||
|
||||
RUN /mkl/install.sh -s /mkl/silent.cfg && \
|
||||
ldconfig
|
||||
|
||||
COPY --from=builder /install_root/mkl_wrapper/mkl_wrapper.* /opt/intel/mkl/wrapper/
|
||||
|
||||
RUN rm -rf /mkl_wrapper /mkl /tmp/*
|
||||
|
||||
RUN mkdir -p /etc/spark /etc/hadoop && \
|
||||
cp /usr/share/defaults/hadoop/log4j.properties /etc/hadoop && \
|
||||
cp /usr/share/apache-spark/conf/log4j.properties.template /etc/spark/log4j.properties
|
||||
|
||||
COPY spark_conf/* /etc/spark/
|
||||
COPY hadoop_conf/* /etc/hadoop/
|
||||
|
||||
CMD ["/bin/bash"]
|
||||
@@ -1,635 +0,0 @@
|
||||
## Data Analytics Reference Stack with Intel® MKL
|
||||
|
||||
[](http://microbadger.com/images/clearlinux/stacks-dars-mkl "Get your own image badge on microbadger.com")
|
||||
|
||||
### Building Locally
|
||||
|
||||
Default build args in Docker are on: https://docs.docker.com/engine/reference/builder/#arg
|
||||
|
||||
```bash
|
||||
docker build --no-cache -t clearlinux/stacks-dars-mkl .
|
||||
```
|
||||
|
||||
### Build ARGs
|
||||
|
||||
* `swupd_args` specifies [swupd update](https://github.com/clearlinux/swupd-client/blob/master/docs/swupd.1.rst#options) flags passed to the update during build.
|
||||
|
||||
>NOTE: An empty `swupd_args` will default to Clear Linux OS latest version. Consider this when building from the Dockerfile, as an OS update will be performed. The docker image in this registry was built and validated using version `30970`.
|
||||
|
||||
### Running a DARS Container
|
||||
|
||||
To run a container you must know the name of the image or hash of the image. The name is `clearlinux/stacks-dars-mkl` for MKL-based image.
|
||||
The hash can be retrieved along with all imported images with the command:
|
||||
|
||||
```bash
|
||||
docker images
|
||||
```
|
||||
|
||||
Now that you know the name of the image, you can run it:
|
||||
|
||||
```bash
|
||||
docker run --ulimit nofile=1000000:1000000 --name <container name> --network host --rm -i -t clearlinux/stacks-dars-mkl
|
||||
```
|
||||
|
||||
or if you need to provide volume mappings as per your machines directory paths:
|
||||
|
||||
```bash
|
||||
docker run --ulimit nofile=1000000:1000000 --name <container name> -v /data/datad:/mnt/disk1/dars/mkl -v /data/datae:/mnt/disk2/dars/mkl --network host --rm -i -t clearlinux/stacks-dars-mkl
|
||||
```
|
||||
|
||||
Please note that `/data/datad` and `/data/datae` are directories on the host machine while `/mnt/disk1/dars/mkl`, `/mnt/disk2/dars/mkl` are the mount points inside the container in the form of directories and are created on demand if they do not exist yet.
|
||||
Also, for simplicity we provided --network as host, so host machine IP itself can be used to access container.
|
||||
|
||||
The extra `--ulimit nofile` parameter is currently required in order to increase the
|
||||
number of open files opened at certain point by the spark engine.
|
||||
|
||||
## Java Requirements
|
||||
|
||||
All of the DARS components are compiled on Open JDK11. Container will have preinstalled JDK11 at /usr/lib/jvm/java-1.11.0-openjdk/ and it has been set as the default java version.
|
||||
It is worth mentioning that the containers also contain Open JDK8, but we won't needed on this setup.
|
||||
|
||||
### **NOTE**
|
||||
|
||||
>Since Clear Linux OS is a stateless system, you should never modify the files under the `/usr/share/defaults` directory. The software updater will overwrite those files.
|
||||
|
||||
***
|
||||
|
||||
>In the Dockerfile it's been configured the most common environment variables for you.
|
||||
For Apache Hadoop use `/etc/hadoop` as `HADOOP_CONF_DIR` folder.
|
||||
For Apache Spark use `/etc/spark` as `SPARK_CONF_DIR` folder.
|
||||
|
||||
***
|
||||
|
||||
## Single Node Hadoop Cluster Setup
|
||||
|
||||
In this mode, all the daemons involved i.e. The DataNode, NameNode, TaskTracker and JobTracker run as Java processes on the same machine. This setup is useful for developing and testing Hadoop applications.
|
||||
|
||||
The components of a Hadoop Cluster are described below:
|
||||
|
||||
- **NameNode:** Manages HDFS storage. HDFS exposes a filesystem namespace and allows user data to be stored in files. Internally a file is split into one or more blocks and these blocks are stored in a set of DataNodes.
|
||||
We will indicate that the NameNode runs in our localhost. Follow these steps to set it up correctly:
|
||||
|
||||
- **DataNode:** is also known as Slave node, it is responsible for storing and managing the data in that node and responds to the NameNode for all filesystem operations.
|
||||
|
||||
- **JobTracker:** is a master which creates and runs the job through tasktrackers. It also tracks resource availability and task lifecycle management.
|
||||
|
||||
- **TaskTracker:** Manage the processing resources on each worker node and send status updates to the JobTracker periodically.
|
||||
|
||||
### Configuration
|
||||
|
||||
To setup a single node cluster we need to run a container from stacks-dars-mkl image:
|
||||
|
||||
```bash
|
||||
docker run --ulimit nofile=1000000:1000000 -ti --rm --network host clearlinux/stacks-dars-mkl
|
||||
cp -r -n /usr/share/defaults/hadoop/* /etc/hadoop
|
||||
```
|
||||
|
||||
## Inside the running container we need to edit hadoop configuration files as follows
|
||||
|
||||
`/etc/hadoop/mapred-site.xml`:
|
||||
|
||||
```bash
|
||||
<configuration>
|
||||
<property>
|
||||
<name>mapreduce.framework.name</name>
|
||||
<value>yarn</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>yarn.app.mapreduce.am.env</name>
|
||||
<value>HADOOP_MAPRED_HOME=${HADOOP_HOME}</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>mapreduce.map.env</name>
|
||||
<value>HADOOP_MAPRED_HOME=${HADOOP_HOME}</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>mapreduce.reduce.env</name>
|
||||
<value>HADOOP_MAPRED_HOME=${HADOOP_HOME}</value>
|
||||
</property>
|
||||
</configuration>
|
||||
```
|
||||
|
||||
`/etc/hadoop/yarn-site.xml`:
|
||||
|
||||
```bash
|
||||
<configuration>
|
||||
<property>
|
||||
<name>yarn.nodemanager.aux-services</name>
|
||||
<value>mapreduce_shuffle</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>yarn.nodemanager.auxservices.mapreduce.shuffle.class</name>
|
||||
<value>org.apache.hadoop.mapred.ShuffleHandler</value>
|
||||
</property>
|
||||
</configuration>
|
||||
```
|
||||
|
||||
## Start Hadoop daemons
|
||||
|
||||
1. Format the NameNode server using the following command:
|
||||
|
||||
```bash
|
||||
hdfs namenode -format
|
||||
```
|
||||
|
||||
2. **Start Hadoop services** as indicated below:
|
||||
|
||||
To start HDFS Namenode service :
|
||||
|
||||
```bash
|
||||
hdfs --daemon start namenode
|
||||
```
|
||||
|
||||
To start HDFS Datanode service :
|
||||
|
||||
```bash
|
||||
hdfs --daemon start datanode
|
||||
```
|
||||
|
||||
To start Yarn ResourceManager :
|
||||
|
||||
```bash
|
||||
yarn --daemon start resourcemanager
|
||||
```
|
||||
|
||||
To start Yarn NodeManager :
|
||||
|
||||
```bash
|
||||
yarn --daemon start nodemanager
|
||||
```
|
||||
|
||||
To start jobhistory service :
|
||||
|
||||
```bash
|
||||
mapred --daemon start historyserver
|
||||
```
|
||||
|
||||
3. Verify the alive node(s) using the following command:
|
||||
|
||||
```bash
|
||||
yarn node -list 2
|
||||
```
|
||||
|
||||
Your output will look like:
|
||||
|
||||
```bash
|
||||
Total Nodes:1
|
||||
Node-Id Node-State Node-Http-Address Number-of-Running-Containers
|
||||
<hostname>:43489 RUNNING <hostname>:8042 0
|
||||
```
|
||||
|
||||
### Run an example
|
||||
|
||||
Run the Pi Calculator Example on Hadoop
|
||||
|
||||
Hadoop comes packaged with a set of example applications. In the next example we will show how to use Hadoop to calculate Pi number.
|
||||
The JAR file containing the compiled class can be found on your running DARS container at: `/usr/share/hadoop/mapreduce/hadoop-mapreduce-examples-3.2.0.jar`
|
||||
|
||||
```bash
|
||||
hadoop jar /usr/share/hadoop/mapreduce/hadoop-mapreduce-examples-$(hadoop version | grep Hadoop | cut -d ' ' -f2).jar pi 16 100
|
||||
```
|
||||
|
||||
If the program runs correctly, you should see output similar to the following:
|
||||
|
||||
```bash
|
||||
Estimated value of Pi is 3.14159125000000000000
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## Single Node Spark Cluster Setup
|
||||
|
||||
### Start the master server and a worker daemons
|
||||
|
||||
1. Start the master server using:
|
||||
|
||||
```bash
|
||||
/usr/share/apache-spark/sbin/start-master.sh
|
||||
```
|
||||
|
||||
2. Start the worker daemon and connect it to the master:
|
||||
|
||||
```bash
|
||||
/usr/share/apache-spark/sbin/start-slave.sh spark://$(hostname):7077
|
||||
```
|
||||
|
||||
3. You can open an internet browser to monitor and inspect Spark job executions. The web UI is available at the master’s IP address and port 8080:
|
||||
|
||||
```bash
|
||||
http://hostname:8080
|
||||
```
|
||||
|
||||
### Run an example
|
||||
|
||||
Run the Pi Calculator Example on Spark
|
||||
|
||||
```bash
|
||||
spark-submit --class org.apache.spark.examples.SparkPi --master spark://$(hostname):7077 --deploy-mode client /usr/share/apache-spark/examples/jars/spark-examples_2.12-$(cat /usr/share/apache-spark/RELEASE | grep Spark | cut -d ' ' -f2).jar 100
|
||||
```
|
||||
|
||||
If the program runs correctly, you should see output similar to the following:
|
||||
|
||||
```bash
|
||||
Pi is roughly 3.1413871141387113
|
||||
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## Run the Pi Calculator Example on spark-shell
|
||||
|
||||
```bash
|
||||
root@86dafb0d7521~ $ spark-shell --conf "spark.hadoop.fs.defaultFS=file:///"
|
||||
```
|
||||
|
||||
```bash
|
||||
scala> import scala.math.random
|
||||
import org.apache.spark._
|
||||
val conf = new SparkConf().setAppName("Spark Pi")
|
||||
val sc = new SparkContext(conf)
|
||||
val slices = 5
|
||||
val n = math.min(100000L * slices, Int.MaxValue).toInt
|
||||
val xs = 1 until n
|
||||
val rdd = sc.parallelize(xs, slices).setName("'Initial rdd'")
|
||||
val sample = rdd.map { i =>
|
||||
val x = random * 2 - 1
|
||||
val y = random * 2 - 1
|
||||
(x, y)
|
||||
}.setName("'Random points sample'")
|
||||
|
||||
val inside = sample.filter { case (x, y) => (x * x + y * y < 1) }.setName("'Random points inside circle'")
|
||||
val count = inside.count()
|
||||
println("Pi is roughly " + 4.0 * count / n)
|
||||
sc.stop()
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## Run the Pi Calculator Example on pyspark
|
||||
|
||||
```bash
|
||||
root@86dafb0d7521~ $ pyspark --conf "spark.hadoop.fs.defaultFS=file:///"
|
||||
```
|
||||
|
||||
```bash
|
||||
>>> import random
|
||||
NUM_SAMPLES = 100000000
|
||||
def inside(p):
|
||||
x, y = random.random(), random.random()
|
||||
return x*x + y*y < 1
|
||||
|
||||
count = sc.parallelize(range(0, NUM_SAMPLES)).filter(inside).count()
|
||||
print ("Pi is roughly %f" % (4.0 * count / NUM_SAMPLES))
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## Deploy DARS on Kubernetes
|
||||
|
||||
Many containerized workloads are deployed in clusters and orchestration software like Kubernetes, for this purpose it is provided a Dockerfile and an entrypoint script.
|
||||
|
||||
### Prerequisites
|
||||
|
||||
* A running Kubernetes cluster at version >= 1.6 with access configured to it using kubectl.
|
||||
* You must have appropriate permissions to list, create, edit and delete pods in your cluster.
|
||||
* The service account credentials used by the driver pods must be allowed to create pods, services and configmaps.
|
||||
* You must have Kubernetes DNS configured in your cluster.
|
||||
|
||||
1. For this will example use the following `Dockerfile`. Execute the following to create the file.
|
||||
|
||||
```bash
|
||||
cat > $(pwd)/Dockerfile << 'EOF'
|
||||
ARG DERIVED_IMAGE
|
||||
FROM ${DERIVED_IMAGE}
|
||||
|
||||
RUN mkdir -p /etc/passwd /etc/pam.d /opt/spark/conf /opt/spark/work-dir
|
||||
|
||||
RUN set -ex && \
|
||||
rm /bin/sh && \
|
||||
ln -sv /bin/bash /bin/sh && \
|
||||
touch /etc/pam.d/su \
|
||||
echo "auth required pam_wheel.so use_uid" >> /etc/pam.d/su && \
|
||||
chgrp root /etc/passwd && chmod ug+rw /etc/passwd
|
||||
|
||||
RUN ln -s /usr/share/apache-spark/jars/ /opt/spark/ && \
|
||||
ln -s /usr/share/apache-spark/bin/ /opt/spark/ && \
|
||||
ln -s /usr/share/apache-spark/sbin/ /opt/spark/ && \
|
||||
ln -s /usr/share/apache-spark/examples/ /opt/spark/ && \
|
||||
ln -s /usr/share/apache-spark/kubernetes/tests/ /opt/spark/ && \
|
||||
ln -s /usr/share/apache-spark/data/ /opt/spark/ && \
|
||||
ln -s /etc/spark/* /opt/spark/conf/
|
||||
|
||||
COPY entrypoint.sh /opt/
|
||||
ENV JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk
|
||||
ENV PATH="${JAVA_HOME}/bin:${PATH}"
|
||||
ENV SPARK_HOME /opt/spark
|
||||
WORKDIR /opt/spark/work-dir
|
||||
ENTRYPOINT [ "/opt/entrypoint.sh" ]
|
||||
EOF
|
||||
```
|
||||
|
||||
2. The Dockerfile require an entrypoint script, this allows to `spark-submit` interact with the container using given arguments. Create the `entrypoint.sh` file.
|
||||
|
||||
```bash
|
||||
cat > $(pwd)/entrypoint.sh << 'EOF'
|
||||
#!/bin/bash
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You 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.
|
||||
#
|
||||
|
||||
# echo commands to the terminal output
|
||||
set -ex
|
||||
|
||||
# Check whether there is a passwd entry for the container UID
|
||||
myuid=$(id -u)
|
||||
mygid=$(id -g)
|
||||
# turn off -e for getent because it will return error code in anonymous uid case
|
||||
set +e
|
||||
uidentry=$(getent passwd $myuid)
|
||||
set -e
|
||||
|
||||
# If there is no passwd entry for the container UID, attempt to create one
|
||||
if [ -z "$uidentry" ] ; then
|
||||
if [ -w /etc/passwd ] ; then
|
||||
echo "$myuid:x:$myuid:$mygid:anonymous uid:$SPARK_HOME:/bin/false" >> /etc/passwd
|
||||
else
|
||||
echo "Container ENTRYPOINT failed to add passwd entry for anonymous UID"
|
||||
fi
|
||||
fi
|
||||
|
||||
SPARK_K8S_CMD="$1"
|
||||
case "$SPARK_K8S_CMD" in
|
||||
driver | driver-py | driver-r | executor)
|
||||
shift 1
|
||||
;;
|
||||
"")
|
||||
;;
|
||||
*)
|
||||
echo "Non-spark-on-k8s command provided, proceeding in pass-through mode..."
|
||||
exec /sbin/tini -s -- "$@"
|
||||
;;
|
||||
esac
|
||||
|
||||
SPARK_CLASSPATH="$SPARK_CLASSPATH:${SPARK_HOME}/jars/*"
|
||||
env | grep SPARK_JAVA_OPT_ | sort -t_ -k4 -n | sed 's/[^=]*=\(.*\)/\1/g' > /tmp/java_opts.txt
|
||||
readarray -t SPARK_EXECUTOR_JAVA_OPTS < /tmp/java_opts.txt
|
||||
|
||||
if [ -n "$SPARK_EXTRA_CLASSPATH" ]; then
|
||||
SPARK_CLASSPATH="$SPARK_CLASSPATH:$SPARK_EXTRA_CLASSPATH"
|
||||
fi
|
||||
|
||||
if [ -n "$PYSPARK_FILES" ]; then
|
||||
PYTHONPATH="$PYTHONPATH:$PYSPARK_FILES"
|
||||
fi
|
||||
|
||||
PYSPARK_ARGS=""
|
||||
if [ -n "$PYSPARK_APP_ARGS" ]; then
|
||||
PYSPARK_ARGS="$PYSPARK_APP_ARGS"
|
||||
fi
|
||||
|
||||
R_ARGS=""
|
||||
if [ -n "$R_APP_ARGS" ]; then
|
||||
R_ARGS="$R_APP_ARGS"
|
||||
fi
|
||||
|
||||
if [ "$PYSPARK_MAJOR_PYTHON_VERSION" == "2" ]; then
|
||||
pyv="$(python -V 2>&1)"
|
||||
export PYTHON_VERSION="${pyv:7}"
|
||||
export PYSPARK_PYTHON="python"
|
||||
export PYSPARK_DRIVER_PYTHON="python"
|
||||
elif [ "$PYSPARK_MAJOR_PYTHON_VERSION" == "3" ]; then
|
||||
pyv3="$(python3 -V 2>&1)"
|
||||
export PYTHON_VERSION="${pyv3:7}"
|
||||
export PYSPARK_PYTHON="python3"
|
||||
export PYSPARK_DRIVER_PYTHON="python3"
|
||||
fi
|
||||
|
||||
case "$SPARK_K8S_CMD" in
|
||||
driver)
|
||||
CMD=(
|
||||
"$SPARK_HOME/bin/spark-submit"
|
||||
--conf "spark.driver.bindAddress=$SPARK_DRIVER_BIND_ADDRESS"
|
||||
--deploy-mode client
|
||||
"$@"
|
||||
)
|
||||
;;
|
||||
driver-py)
|
||||
CMD=(
|
||||
"$SPARK_HOME/bin/spark-submit"
|
||||
--conf "spark.driver.bindAddress=$SPARK_DRIVER_BIND_ADDRESS"
|
||||
--deploy-mode client
|
||||
"$@" $PYSPARK_PRIMARY $PYSPARK_ARGS
|
||||
)
|
||||
;;
|
||||
driver-r)
|
||||
CMD=(
|
||||
"$SPARK_HOME/bin/spark-submit"
|
||||
--conf "spark.driver.bindAddress=$SPARK_DRIVER_BIND_ADDRESS"
|
||||
--deploy-mode client
|
||||
"$@" $R_PRIMARY $R_ARGS
|
||||
)
|
||||
;;
|
||||
executor)
|
||||
CMD=(
|
||||
${JAVA_HOME}/bin/java
|
||||
"${SPARK_EXECUTOR_JAVA_OPTS[@]}"
|
||||
-Xms$SPARK_EXECUTOR_MEMORY
|
||||
-Xmx$SPARK_EXECUTOR_MEMORY
|
||||
-cp "$SPARK_CLASSPATH"
|
||||
org.apache.spark.executor.CoarseGrainedExecutorBackend
|
||||
--driver-url $SPARK_DRIVER_URL
|
||||
--executor-id $SPARK_EXECUTOR_ID
|
||||
--cores $SPARK_EXECUTOR_CORES
|
||||
--app-id $SPARK_APPLICATION_ID
|
||||
--hostname $SPARK_EXECUTOR_POD_IP
|
||||
)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown command: $SPARK_K8S_CMD" 1>&2
|
||||
exit 1
|
||||
esac
|
||||
|
||||
# Execute the container CMD
|
||||
exec "${CMD[@]}"
|
||||
EOF
|
||||
```
|
||||
|
||||
3. Give execute permission to `entrypoint.sh` script.
|
||||
|
||||
```bash
|
||||
sudo chmod +x $(pwd)/entrypoint.sh
|
||||
```
|
||||
|
||||
4. Build Image, for this example use `dars_k8s_spark` as name.
|
||||
|
||||
```bash
|
||||
docker build . --build-arg DERIVED_IMAGE=clearlinux/stacks-dars-mkl -t dars_k8s_spark
|
||||
```
|
||||
|
||||
5. Verify your built image. Execute the following command looking for the given name `dars_k8s_spark`
|
||||
|
||||
```bash
|
||||
docker images | grep "dars_k8s_spark"
|
||||
```
|
||||
|
||||
You should see something like:
|
||||
|
||||
```bash
|
||||
dars_k8s_spark latest 1fa3278a3421 1 minutes ago 6.56GB
|
||||
```
|
||||
|
||||
6. Use a variable to store the image's given name:
|
||||
|
||||
```bash
|
||||
DARS_K8S_IMAGE=dars_k8s_spark
|
||||
```
|
||||
|
||||
### Configure RBAC
|
||||
|
||||
1. Create the spark service account and cluster role binding to allow Spark on Kubernetes create Executors as required. In this example use the `default` namespace.
|
||||
|
||||
```bash
|
||||
kubectl create serviceaccount spark-serviceaccount --namespace default
|
||||
kubectl create clusterrolebinding spark-rolebinding --clusterrole=edit --serviceaccount=default:spark-serviceaccount --namespace=default
|
||||
```
|
||||
|
||||
### Prepare to Submit Spark Job
|
||||
|
||||
1. Determine the Kubernetes master address:
|
||||
|
||||
```bash
|
||||
kubectl cluster-info
|
||||
```
|
||||
|
||||
You should see something like:
|
||||
|
||||
```bash
|
||||
Kubernetes master is running at https://192.168.39.127:8443
|
||||
```
|
||||
|
||||
2. Use a variable to store the master address:
|
||||
|
||||
```bash
|
||||
MASTER_ADDRESS='https://192.168.39.127:8443'
|
||||
```
|
||||
|
||||
### Submit Spark Job on Minikube
|
||||
|
||||
1. Execute following command using `MASTER_ADDRESS` and `DARS_K8S` variables. Driver pod will be called `spark-pi-driver`.
|
||||
|
||||
More information about `spark-submit` configuration on [running-on-kubernetes documentation](https://spark.apache.org/docs/latest/running-on-kubernetes.html#configuration).
|
||||
|
||||
```bash
|
||||
spark-submit \
|
||||
--master k8s://${MASTER_ADDRESS} \
|
||||
--deploy-mode cluster \
|
||||
--name spark-pi \
|
||||
--class org.apache.spark.examples.SparkPi \
|
||||
--conf spark.executor.instances=2 \
|
||||
--conf spark.kubernetes.container.image=${DARS_K8S_IMAGE} \
|
||||
--conf spark.kubernetes.driver.pod.name=spark-pi-driver \
|
||||
--conf spark.kubernetes.namespace=default \
|
||||
--conf spark.kubernetes.authenticate.driver.serviceAccountName=spark-serviceaccount \
|
||||
local:///usr/share/apache-spark/examples/jars/spark-examples_2.12-2.4.0.jar
|
||||
```
|
||||
|
||||
2. Check the Job. Read the logs and look for the Pi result:
|
||||
|
||||
```bash
|
||||
kubectl logs spark-pi-driver | grep "Pi is roughly"
|
||||
```
|
||||
|
||||
You should see something like:
|
||||
|
||||
```bash
|
||||
Pi is roughly 3.1418957094785473
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## 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)
|
||||
|
||||
## **FAQ**
|
||||
|
||||
* Pyspark / Spark-shell drops `connection exception` or `Connection refused` this happens due HADOOP_CONF_DIR environment variable is set and these APIs are assuming will use Hadoop Distributed File System.
|
||||
You can `unset HADOOP_CONF_DIR` and use Spark RDD, or start Hadoop services and then create your directories and files as you required using `hdfs`.
|
||||
|
||||
Also it is possible to change the file system to local without `unset HADOOP_CONF_DIR` as is further described below:
|
||||
|
||||
```bash
|
||||
pyspark --conf "spark.hadoop.fs.defaultFS=file:///"
|
||||
```
|
||||
|
||||
and
|
||||
|
||||
```bash
|
||||
spark-shell --conf "spark.hadoop.fs.defaultFS=file:///"
|
||||
```
|
||||
|
||||
* How to set proxies in Spark:
|
||||
|
||||
There is two ways to work with proxies:
|
||||
|
||||
1. Add in $SPARK_CONF_DIR/spark-defaults.conf the following line for both `spark.executor.extraJavaOptions` and `spark.driver.extraJavaOptions` variables:
|
||||
|
||||
```bash
|
||||
-Dhttp.proxyHost=<URL> -Dhttp.proxyPort=<PORT> -Dhttps.proxyHost=<URL> -Dhttps.proxyPort=<PORT>
|
||||
```
|
||||
|
||||
e.g.
|
||||
|
||||
```bash
|
||||
# MKL flags
|
||||
spark.executor.extraJavaOptions=-Dcom.github.fommil.netlib.BLAS=com.intel.mkl.MKLBLAS -Dcom.github.fommil.netlib.LAPACK=com.intel.mkl.MKLLAPACK -Dhttp.proxyHost=example.proxy -Dhttp.proxyPort=111 -Dhttps.proxyHost=example.proxy -Dhttps.proxyPort=112
|
||||
|
||||
spark.driver.extraJavaOptions=-Dcom.github.fommil.netlib.BLAS=com.intel.mkl.MKLBLAS -Dcom.github.fommil.netlib.LAPACK=com.intel.mkl.MKLLAPACK -Dhttp.proxyHost=example.proxy -Dhttp.proxyPort=111 -Dhttps.proxyHost=example.proxy -Dhttps.proxyPort=112
|
||||
```
|
||||
|
||||
2. Give as `conf` parameter the proxies URL and Port.
|
||||
|
||||
e.g.
|
||||
|
||||
```bash
|
||||
pyspark --conf "spark.hadoop.fs.defaultFS=file:///" --conf "spark.driver.extraJavaOptions=-Dhttp.proxyHost=example.proxy -Dhttp.proxyPort=111 -Dhttps.proxyHost=example.proxy -Dhttps.proxyPort=112"
|
||||
```
|
||||
|
||||
and
|
||||
|
||||
```bash
|
||||
spark-shell --conf "spark.hadoop.fs.defaultFS=file:///" --conf "spark.driver.extraJavaOptions=-Dhttp.proxyHost=example.proxy -Dhttp.proxyPort=111 -Dhttps.proxyHost=example.proxy -Dhttps.proxyPort=112"
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
#### Non functional known issues
|
||||
|
||||
* spark-shell:
|
||||
|
||||
>There is an exception message `Unrecognized Hadoop major version number: 3.2.0 at org.apache.hadoop.hive.shims.ShimLoader.getMajorVersion`.
|
||||
This is not a problem, DARS is not using hadoop.hive.shims.
|
||||
Hive binaries installed from [Apache](http://www.apache.org/dyn/closer.cgi/hive) on Clearlinux + JDK 11 does not work, this is an issue reported on [Jira's Hive](https://issues.apache.org/jira/browse/HIVE-21237) since February.
|
||||
|
||||
* pyspark:
|
||||
|
||||
>There is an exception message `Exception in thread "Thread-3" java.lang.ExceptionInInitializerError at org.apache.hadoop.hive.conf.HiveConf`
|
||||
Hive binaries installed from [Apache](http://www.apache.org/dyn/closer.cgi/hive) on Clearlinux + JDK 11 does not work, this is an issue reported on [Jira's Hive](https://issues.apache.org/jira/browse/HIVE-21237) since February.
|
||||
@@ -1,2 +0,0 @@
|
||||
/opt/intel/mkl/lib/intel64_lin
|
||||
/opt/intel/lib/intel64_lin
|
||||
@@ -1,6 +0,0 @@
|
||||
<configuration>
|
||||
<property>
|
||||
<name>fs.defaultFS</name>
|
||||
<value>hdfs://localhost:9000</value>
|
||||
</property>
|
||||
</configuration>
|
||||
@@ -1,6 +0,0 @@
|
||||
<configuration>
|
||||
<property>
|
||||
<name>dfs.replication</name>
|
||||
<value>1</value>
|
||||
</property>
|
||||
</configuration>
|
||||
@@ -1,6 +0,0 @@
|
||||
<configuration>
|
||||
<property>
|
||||
<name>mapreduce.framework.name</name>
|
||||
<value>yarn</value>
|
||||
</property>
|
||||
</configuration>
|
||||
@@ -1 +0,0 @@
|
||||
localhost
|
||||
@@ -1,6 +0,0 @@
|
||||
<configuration>
|
||||
<property>
|
||||
<name>yarn.nodemanager.aux-services</name>
|
||||
<value>mapreduce_shuffle</value>
|
||||
</property>
|
||||
</configuration>
|
||||
@@ -1,8 +0,0 @@
|
||||
## 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.
|
||||
@@ -1,147 +0,0 @@
|
||||
|
||||
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.
|
||||
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
Copyright (c) 2018 Intel Corporation.
|
||||
|
||||
Use and Redistribution. You may use and redistribute the software (the “Software”), without modification, provided the following conditions are met:
|
||||
|
||||
* Redistributions must reproduce the above copyright notice and the following terms of use in the Software and in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Intel nor the names of its suppliers may be used to endorse or promote products derived from this Software without specific prior written permission.
|
||||
|
||||
* No reverse engineering, decompilation, or disassembly of this Software is permitted.
|
||||
|
||||
Limited patent license. Intel grants you a world-wide, royalty-free, non-exclusive license under patents it now or hereafter owns or controls to make, have made, use, import, offer to sell
|
||||
and sell (“Utilize”) this Software, but solely to the extent that any such patent is necessary to Utilize the Software alone. The patent license shall not apply to any combinations which include
|
||||
this software. No hardware per se is licensed hereunder.
|
||||
|
||||
Third party and other Intel programs. “Third Party Programs” are the files listed in the “third-party-programs.txt” text file that is included with the Software and may include Intel programs under
|
||||
separate license terms. Third Party Programs, even if included with the distribution of the Materials, are governed by separate license terms and those license terms solely govern your use of those programs.
|
||||
|
||||
DISCLAIMER. THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
|
||||
NON-INFRINGEMENT ARE DISCLAIMED. THIS SOFTWARE IS NOT INTENDED FOR USE IN SYSTEMS OR APPLICATIONS WHERE FAILURE OF THE SOFTWARE MAY CAUSE PERSONAL INJURY OR DEATH AND YOU AGREE THAT YOU ARE FULLY
|
||||
RESPONSIBLE FOR ANY CLAIMS, COSTS, DAMAGES, EXPENSES, AND ATTORNEYS’ FEES ARISING OUT OF ANY SUCH USE, EVEN IF ANY CLAIM ALLEGES THAT INTEL WAS NEGLIGENT REGARDING THE DESIGN OR MANUFACTURE OF THE MATERIALS.
|
||||
|
||||
LIMITATION OF LIABILITY. IN NO EVENT WILL INTEL 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. YOU AGREE TO INDEMNIFY AND HOLD INTEL HARMLESS AGAINST ANY CLAIMS AND EXPENSES RESULTING FROM
|
||||
YOUR USE OR UNAUTHORIZED USE OF THE SOFTWARE.
|
||||
|
||||
No support. Intel may make changes to the Software, at any time without notice, and is not obligated to support, update or provide training for the Software.
|
||||
|
||||
Termination. Intel may terminate your right to use the Software in the event of your breach of this Agreement and you fail to cure the breach within a reasonable period of time.
|
||||
|
||||
Feedback. Should you provide Intel with comments, modifications, corrections, enhancements or other input (“Feedback”) related to the Software Intel will be free to use, disclose, reproduce,
|
||||
license or otherwise distribute or exploit the Feedback in its sole discretion without any obligations or restrictions of any kind, including without limitation, intellectual property rights or
|
||||
licensing obligations.
|
||||
|
||||
Compliance with laws. You agree to comply with all relevant laws and regulations governing your use, transfer, import or export (or prohibition thereof) of the Software.
|
||||
|
||||
Governing law. All disputes will be governed by the laws of the United States of America and the State of Delaware without reference to conflict of law principles and subject to the exclusive
|
||||
jurisdiction of the state or federal courts sitting in the State of Delaware, and each party agrees that it submits to the personal jurisdiction and venue of those courts and waives any objections.
|
||||
The United Nations Convention on Contracts for the International Sale of Goods (1980) is specifically excluded and will not apply to the Software.
|
||||
|
||||
*Other names and brands may be claimed as the property of others.
|
||||
@@ -1,37 +0,0 @@
|
||||
# Patterns used to check silent configuration file
|
||||
#
|
||||
# anythingpat - any string
|
||||
# filepat - the file location pattern (/file/location/to/license.lic)
|
||||
# lspat - the license server address pattern (0123@hostname)
|
||||
# snpat - the serial number pattern (ABCD-01234567)
|
||||
|
||||
# Accept EULA, valid values are: {accept, decline}
|
||||
ACCEPT_EULA=accept
|
||||
|
||||
# Optional error behavior, valid values are: {yes, no}
|
||||
CONTINUE_WITH_OPTIONAL_ERROR=yes
|
||||
|
||||
# Install location, valid values are: {/opt/intel, filepat}
|
||||
PSET_INSTALL_DIR=/opt/intel
|
||||
|
||||
# Continue with overwrite of existing installation directory, valid values are: {yes, no}
|
||||
CONTINUE_WITH_INSTALLDIR_OVERWRITE=yes
|
||||
|
||||
# List of components to install, valid values are: {ALL, DEFAULTS, anythingpat}
|
||||
COMPONENTS=DEFAULTS
|
||||
|
||||
# Installation mode, valid values are: {install, repair, uninstall}
|
||||
PSET_MODE=install
|
||||
|
||||
# Directory for non-RPM database, valid values are: {filepat}
|
||||
#NONRPM_DB_DIR=filepat
|
||||
|
||||
# Path to the cluster description file, valid values are: {filepat}
|
||||
#CLUSTER_INSTALL_MACHINES_FILE=filepat
|
||||
|
||||
# Perform validation of digital signatures of RPM files, valid values are: {yes, no}
|
||||
SIGNING_ENABLED=yes
|
||||
|
||||
# Select target architecture of your applications, valid values are: {IA32, INTEL64, ALL}
|
||||
ARCH_SELECTED=INTEL64
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
# MKL flags
|
||||
spark.executor.extraJavaOptions=-Dcom.github.fommil.netlib.BLAS=com.intel.mkl.MKLBLAS -Dcom.github.fommil.netlib.LAPACK=com.intel.mkl.MKLLAPACK
|
||||
spark.driver.extraJavaOptions=-Dcom.github.fommil.netlib.BLAS=com.intel.mkl.MKLBLAS -Dcom.github.fommil.netlib.LAPACK=com.intel.mkl.MKLLAPACK
|
||||
@@ -1,2 +0,0 @@
|
||||
MKL_NUM_THREADS=1
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/native
|
||||
@@ -1,73 +0,0 @@
|
||||
FROM clearlinux:latest AS builder
|
||||
ARG swupd_args
|
||||
|
||||
# Move to latest Clear Linux release to ensure
|
||||
# that the swupd command line arguments are
|
||||
# correct
|
||||
RUN swupd update --no-boot-update $swupd_args
|
||||
|
||||
# Grab os-release info from the minimal base image so
|
||||
# that the new content matches the exact OS version
|
||||
COPY --from=clearlinux/os-core:latest /usr/lib/os-release /
|
||||
|
||||
# Install additional content in a target directory
|
||||
# using the os version from the minimal base
|
||||
RUN source /os-release && \
|
||||
mkdir /install_root \
|
||||
&& swupd os-install -V ${VERSION_ID} \
|
||||
--path /install_root --statedir /swupd-state \
|
||||
--bundles=big-data-basic,cpio,os-core-update,python-basic-dev,which --no-boot-update \
|
||||
&& rm -rf /install_root/var/lib/swupd/*
|
||||
|
||||
# For some Host OS configuration with redirect_dir on,
|
||||
# extra data are saved on the upper layer when the same
|
||||
# file exists on different layers. To minimize docker
|
||||
# image size, remove the overlapped files before copy.
|
||||
RUN mkdir /os_core_install
|
||||
COPY --from=clearlinux/os-core:latest / /os_core_install/
|
||||
RUN find / os_core_install | sed -e 's/os_core_install/install_root/' | xargs rm -d &> /dev/null || true
|
||||
|
||||
FROM clearlinux/os-core:latest
|
||||
LABEL maintainer=otc-swstacks@intel.com
|
||||
|
||||
ENV HOME=/root
|
||||
|
||||
# Configure openjdk11
|
||||
ENV JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk
|
||||
ENV PATH="${JAVA_HOME}/bin:${PATH}"
|
||||
|
||||
# Environment variables to point to Hadoop,
|
||||
# Spark and YARN installation and configuration
|
||||
ENV HADOOP_HOME=/usr
|
||||
ENV HADOOP_CONF_DIR=/etc/hadoop
|
||||
ENV HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
|
||||
ENV HADOOP_DEFAULT_LIBEXEC_DIR=$HADOOP_HOME/libexec
|
||||
ENV HADOOP_IDENT_STRING=root
|
||||
ENV HADOOP_LOG_DIR=/var/log/hadoop
|
||||
ENV HADOOP_PID_DIR=/var/log/hadoop/pid
|
||||
ENV HADOOP_OPTS="-Djava.library.path=$HADOOP_HOME/lib/native"
|
||||
|
||||
ENV HDFS_DATANODE_USER=root
|
||||
ENV HDFS_NAMENODE_USER=root
|
||||
ENV HDFS_SECONDARYNAMENODE_USER=root
|
||||
|
||||
ENV SPARK_HOME=/usr/share/apache-spark
|
||||
ENV SPARK_CONF_DIR=/etc/spark
|
||||
|
||||
ENV YARN_RESOURCEMANAGER_USER=root
|
||||
ENV YARN_NODEMANAGER_USER=root
|
||||
|
||||
COPY --from=builder /install_root /
|
||||
|
||||
COPY dars.ld.so.conf /etc/ld.so.conf
|
||||
|
||||
RUN ldconfig
|
||||
|
||||
RUN mkdir -p /etc/spark /etc/hadoop && \
|
||||
cp /usr/share/defaults/hadoop/log4j.properties /etc/hadoop && \
|
||||
cp /usr/share/apache-spark/conf/log4j.properties.template /etc/spark/log4j.properties
|
||||
|
||||
COPY spark_conf/* /etc/spark/
|
||||
COPY hadoop_conf/* /etc/hadoop/
|
||||
|
||||
CMD ["/bin/bash"]
|
||||
@@ -1,635 +0,0 @@
|
||||
## Data Analytics Reference Stack with OpenBLAS
|
||||
|
||||
[](http://microbadger.com/images/clearlinux/stacks-dars-openblas "Get your own image badge on microbadger.com")
|
||||
|
||||
### Building Locally
|
||||
|
||||
Default build args in Docker are on: https://docs.docker.com/engine/reference/builder/#arg
|
||||
|
||||
```bash
|
||||
docker build --no-cache -t clearlinux/stacks-dars-openblas .
|
||||
```
|
||||
|
||||
### Build ARGs
|
||||
|
||||
* `swupd_args` specifies [swupd update](https://github.com/clearlinux/swupd-client/blob/master/docs/swupd.1.rst#options) flags passed to the update during build.
|
||||
|
||||
>NOTE: An empty `swupd_args` will default to Clear Linux OS latest version. Consider this when building from the Dockerfile, as an OS update will be performed. The docker image in this registry was built and validated using version `30970`.
|
||||
|
||||
### Running a DARS Container
|
||||
|
||||
To run a container you must know the name of the image or hash of the image. The name is `clearlinux/stacks-dars-openblas` for MKL-based image.
|
||||
The hash can be retrieved along with all imported images with the command:
|
||||
|
||||
```bash
|
||||
docker images
|
||||
```
|
||||
|
||||
Now that you know the name of the image, you can run it:
|
||||
|
||||
```bash
|
||||
docker run --ulimit nofile=1000000:1000000 --name <container name> --network host --rm -i -t clearlinux/stacks-dars-openblas
|
||||
```
|
||||
|
||||
or if you need to provide volume mappings as per your machines directory paths:
|
||||
|
||||
```bash
|
||||
docker run --ulimit nofile=1000000:1000000 --name <container name> -v /data/datad:/mnt/disk1/dars/oblas -v /data/datae:/mnt/disk2/dars/oblas --network host --rm -i -t clearlinux/stacks-dars-openblas
|
||||
```
|
||||
|
||||
Please note that `/data/datad` and `/data/datae` are directories on the host machine while `/mnt/disk1/dars/mkl`, `/mnt/disk2/dars/oblas` are the mount points inside the container in the form of directories and are created on demand if they do not exist yet.
|
||||
Also, for simplicity we provided --network as host, so host machine IP itself can be used to access container.
|
||||
|
||||
The extra `--ulimit nofile` parameter is currently required in order to increase the
|
||||
number of open files opened at certain point by the spark engine.
|
||||
|
||||
## Java Requirements
|
||||
|
||||
All of the DARS components are compiled on Open JDK11. Container will have preinstalled JDK11 at /usr/lib/jvm/java-1.11.0-openjdk/ and it has been set as the default java version.
|
||||
It is worth mentioning that the containers also contain Open JDK8, but we won't needed on this setup.
|
||||
|
||||
### **NOTE**
|
||||
|
||||
>Since Clear Linux OS is a stateless system, you should never modify the files under the `/usr/share/defaults` directory. The software updater will overwrite those files.
|
||||
|
||||
***
|
||||
|
||||
>In the Dockerfile it's been configured the most common environment variables for you.
|
||||
For Apache Hadoop use `/etc/hadoop` as `HADOOP_CONF_DIR` folder.
|
||||
For Apache Spark use `/etc/spark` as `SPARK_CONF_DIR` folder.
|
||||
|
||||
***
|
||||
|
||||
## Single Node Hadoop Cluster Setup
|
||||
|
||||
In this mode, all the daemons involved i.e. The DataNode, NameNode, TaskTracker and JobTracker run as Java processes on the same machine. This setup is useful for developing and testing Hadoop applications.
|
||||
|
||||
The components of a Hadoop Cluster are described below:
|
||||
|
||||
- **NameNode:** Manages HDFS storage. HDFS exposes a filesystem namespace and allows user data to be stored in files. Internally a file is split into one or more blocks and these blocks are stored in a set of DataNodes.
|
||||
We will indicate that the NameNode runs in our localhost. Follow these steps to set it up correctly:
|
||||
|
||||
- **DataNode:** is also known as Slave node, it is responsible for storing and managing the data in that node and responds to the NameNode for all filesystem operations.
|
||||
|
||||
- **JobTracker:** is a master which creates and runs the job through tasktrackers. It also tracks resource availability and task lifecycle management.
|
||||
|
||||
- **TaskTracker:** Manage the processing resources on each worker node and send status updates to the JobTracker periodically.
|
||||
|
||||
### Configuration
|
||||
|
||||
To setup a single node cluster we need to run a container from stacks-dars-openblas image:
|
||||
|
||||
```bash
|
||||
docker run --ulimit nofile=1000000:1000000 -ti --rm --network host clearlinux/stacks-dars-openblas
|
||||
cp -r -n /usr/share/defaults/hadoop/* /etc/hadoop
|
||||
```
|
||||
|
||||
## Inside the running container we need to edit hadoop configuration files as follows
|
||||
|
||||
`/etc/hadoop/mapred-site.xml`:
|
||||
|
||||
```bash
|
||||
<configuration>
|
||||
<property>
|
||||
<name>mapreduce.framework.name</name>
|
||||
<value>yarn</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>yarn.app.mapreduce.am.env</name>
|
||||
<value>HADOOP_MAPRED_HOME=${HADOOP_HOME}</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>mapreduce.map.env</name>
|
||||
<value>HADOOP_MAPRED_HOME=${HADOOP_HOME}</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>mapreduce.reduce.env</name>
|
||||
<value>HADOOP_MAPRED_HOME=${HADOOP_HOME}</value>
|
||||
</property>
|
||||
</configuration>
|
||||
```
|
||||
|
||||
`/etc/hadoop/yarn-site.xml`:
|
||||
|
||||
```bash
|
||||
<configuration>
|
||||
<property>
|
||||
<name>yarn.nodemanager.aux-services</name>
|
||||
<value>mapreduce_shuffle</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>yarn.nodemanager.auxservices.mapreduce.shuffle.class</name>
|
||||
<value>org.apache.hadoop.mapred.ShuffleHandler</value>
|
||||
</property>
|
||||
</configuration>
|
||||
```
|
||||
|
||||
## Start Hadoop daemons
|
||||
|
||||
1. Format the NameNode server using the following command:
|
||||
|
||||
```bash
|
||||
hdfs namenode -format
|
||||
```
|
||||
|
||||
2. **Start Hadoop services** as indicated below:
|
||||
|
||||
To start HDFS Namenode service :
|
||||
|
||||
```bash
|
||||
hdfs --daemon start namenode
|
||||
```
|
||||
|
||||
To start HDFS Datanode service :
|
||||
|
||||
```bash
|
||||
hdfs --daemon start datanode
|
||||
```
|
||||
|
||||
To start Yarn ResourceManager :
|
||||
|
||||
```bash
|
||||
yarn --daemon start resourcemanager
|
||||
```
|
||||
|
||||
To start Yarn NodeManager :
|
||||
|
||||
```bash
|
||||
yarn --daemon start nodemanager
|
||||
```
|
||||
|
||||
To start jobhistory service :
|
||||
|
||||
```bash
|
||||
mapred --daemon start historyserver
|
||||
```
|
||||
|
||||
3. Verify the alive node(s) using the following command:
|
||||
|
||||
```bash
|
||||
yarn node -list 2
|
||||
```
|
||||
|
||||
Your output will look like:
|
||||
|
||||
```bash
|
||||
Total Nodes:1
|
||||
Node-Id Node-State Node-Http-Address Number-of-Running-Containers
|
||||
<hostname>:43489 RUNNING <hostname>:8042 0
|
||||
```
|
||||
|
||||
### Run an example
|
||||
|
||||
Run the Pi Calculator Example on Hadoop
|
||||
|
||||
Hadoop comes packaged with a set of example applications. In the next example we will show how to use Hadoop to calculate Pi number.
|
||||
The JAR file containing the compiled class can be found on your running DARS container at: `/usr/share/hadoop/mapreduce/hadoop-mapreduce-examples-3.2.0.jar`
|
||||
|
||||
```bash
|
||||
hadoop jar /usr/share/hadoop/mapreduce/hadoop-mapreduce-examples-$(hadoop version | grep Hadoop | cut -d ' ' -f2).jar pi 16 100
|
||||
```
|
||||
|
||||
If the program runs correctly, you should see output similar to the following:
|
||||
|
||||
```bash
|
||||
Estimated value of Pi is 3.14159125000000000000
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## Single Node Spark Cluster Setup
|
||||
|
||||
### Start the master server and a worker daemons
|
||||
|
||||
1. Start the master server using:
|
||||
|
||||
```bash
|
||||
/usr/share/apache-spark/sbin/start-master.sh
|
||||
```
|
||||
|
||||
2. Start the worker daemon and connect it to the master:
|
||||
|
||||
```bash
|
||||
/usr/share/apache-spark/sbin/start-slave.sh spark://$(hostname):7077
|
||||
```
|
||||
|
||||
3. You can open an internet browser to monitor and inspect Spark job executions. The web UI is available at the master’s IP address and port 8080:
|
||||
|
||||
```bash
|
||||
http://hostname:8080
|
||||
```
|
||||
|
||||
### Run an example
|
||||
|
||||
Run the Pi Calculator Example on Spark
|
||||
|
||||
```bash
|
||||
spark-submit --class org.apache.spark.examples.SparkPi --master spark://$(hostname):7077 --deploy-mode client /usr/share/apache-spark/examples/jars/spark-examples_2.12-$(cat /usr/share/apache-spark/RELEASE | grep Spark | cut -d ' ' -f2).jar 100
|
||||
```
|
||||
|
||||
If the program runs correctly, you should see output similar to the following:
|
||||
|
||||
```bash
|
||||
Pi is roughly 3.1413871141387113
|
||||
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## Run the Pi Calculator Example on spark-shell
|
||||
|
||||
```bash
|
||||
root@86dafb0d7521~ $ spark-shell --conf "spark.hadoop.fs.defaultFS=file:///"
|
||||
```
|
||||
|
||||
```bash
|
||||
scala> import scala.math.random
|
||||
import org.apache.spark._
|
||||
val conf = new SparkConf().setAppName("Spark Pi")
|
||||
val sc = new SparkContext(conf)
|
||||
val slices = 5
|
||||
val n = math.min(100000L * slices, Int.MaxValue).toInt
|
||||
val xs = 1 until n
|
||||
val rdd = sc.parallelize(xs, slices).setName("'Initial rdd'")
|
||||
val sample = rdd.map { i =>
|
||||
val x = random * 2 - 1
|
||||
val y = random * 2 - 1
|
||||
(x, y)
|
||||
}.setName("'Random points sample'")
|
||||
|
||||
val inside = sample.filter { case (x, y) => (x * x + y * y < 1) }.setName("'Random points inside circle'")
|
||||
val count = inside.count()
|
||||
println("Pi is roughly " + 4.0 * count / n)
|
||||
sc.stop()
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## Run the Pi Calculator Example on pyspark
|
||||
|
||||
```bash
|
||||
root@86dafb0d7521~ $ pyspark --conf "spark.hadoop.fs.defaultFS=file:///"
|
||||
```
|
||||
|
||||
```bash
|
||||
>>> import random
|
||||
NUM_SAMPLES = 100000000
|
||||
def inside(p):
|
||||
x, y = random.random(), random.random()
|
||||
return x*x + y*y < 1
|
||||
|
||||
count = sc.parallelize(range(0, NUM_SAMPLES)).filter(inside).count()
|
||||
print ("Pi is roughly %f" % (4.0 * count / NUM_SAMPLES))
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## Deploy DARS on Kubernetes
|
||||
|
||||
Many containerized workloads are deployed in clusters and orchestration software like Kubernetes, for this purpose it is provided a Dockerfile and an entrypoint script.
|
||||
|
||||
### Prerequisites
|
||||
|
||||
* A running Kubernetes cluster at version >= 1.6 with access configured to it using kubectl.
|
||||
* You must have appropriate permissions to list, create, edit and delete pods in your cluster.
|
||||
* The service account credentials used by the driver pods must be allowed to create pods, services and configmaps.
|
||||
* You must have Kubernetes DNS configured in your cluster.
|
||||
|
||||
1. For this will example use the following `Dockerfile`. Execute the following to create the file.
|
||||
|
||||
```bash
|
||||
cat > $(pwd)/Dockerfile << 'EOF'
|
||||
ARG DERIVED_IMAGE
|
||||
FROM ${DERIVED_IMAGE}
|
||||
|
||||
RUN mkdir -p /etc/passwd /etc/pam.d /opt/spark/conf /opt/spark/work-dir
|
||||
|
||||
RUN set -ex && \
|
||||
rm /bin/sh && \
|
||||
ln -sv /bin/bash /bin/sh && \
|
||||
touch /etc/pam.d/su \
|
||||
echo "auth required pam_wheel.so use_uid" >> /etc/pam.d/su && \
|
||||
chgrp root /etc/passwd && chmod ug+rw /etc/passwd
|
||||
|
||||
RUN ln -s /usr/share/apache-spark/jars/ /opt/spark/ && \
|
||||
ln -s /usr/share/apache-spark/bin/ /opt/spark/ && \
|
||||
ln -s /usr/share/apache-spark/sbin/ /opt/spark/ && \
|
||||
ln -s /usr/share/apache-spark/examples/ /opt/spark/ && \
|
||||
ln -s /usr/share/apache-spark/kubernetes/tests/ /opt/spark/ && \
|
||||
ln -s /usr/share/apache-spark/data/ /opt/spark/ && \
|
||||
ln -s /etc/spark/* /opt/spark/conf/
|
||||
|
||||
COPY entrypoint.sh /opt/
|
||||
ENV JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk
|
||||
ENV PATH="${JAVA_HOME}/bin:${PATH}"
|
||||
ENV SPARK_HOME /opt/spark
|
||||
WORKDIR /opt/spark/work-dir
|
||||
ENTRYPOINT [ "/opt/entrypoint.sh" ]
|
||||
EOF
|
||||
```
|
||||
|
||||
2. The Dockerfile require an entrypoint script, this allows to `spark-submit` interact with the container using given arguments. Create the `entrypoint.sh` file.
|
||||
|
||||
```bash
|
||||
cat > $(pwd)/entrypoint.sh << 'EOF'
|
||||
#!/bin/bash
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You 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.
|
||||
#
|
||||
|
||||
# echo commands to the terminal output
|
||||
set -ex
|
||||
|
||||
# Check whether there is a passwd entry for the container UID
|
||||
myuid=$(id -u)
|
||||
mygid=$(id -g)
|
||||
# turn off -e for getent because it will return error code in anonymous uid case
|
||||
set +e
|
||||
uidentry=$(getent passwd $myuid)
|
||||
set -e
|
||||
|
||||
# If there is no passwd entry for the container UID, attempt to create one
|
||||
if [ -z "$uidentry" ] ; then
|
||||
if [ -w /etc/passwd ] ; then
|
||||
echo "$myuid:x:$myuid:$mygid:anonymous uid:$SPARK_HOME:/bin/false" >> /etc/passwd
|
||||
else
|
||||
echo "Container ENTRYPOINT failed to add passwd entry for anonymous UID"
|
||||
fi
|
||||
fi
|
||||
|
||||
SPARK_K8S_CMD="$1"
|
||||
case "$SPARK_K8S_CMD" in
|
||||
driver | driver-py | driver-r | executor)
|
||||
shift 1
|
||||
;;
|
||||
"")
|
||||
;;
|
||||
*)
|
||||
echo "Non-spark-on-k8s command provided, proceeding in pass-through mode..."
|
||||
exec /sbin/tini -s -- "$@"
|
||||
;;
|
||||
esac
|
||||
|
||||
SPARK_CLASSPATH="$SPARK_CLASSPATH:${SPARK_HOME}/jars/*"
|
||||
env | grep SPARK_JAVA_OPT_ | sort -t_ -k4 -n | sed 's/[^=]*=\(.*\)/\1/g' > /tmp/java_opts.txt
|
||||
readarray -t SPARK_EXECUTOR_JAVA_OPTS < /tmp/java_opts.txt
|
||||
|
||||
if [ -n "$SPARK_EXTRA_CLASSPATH" ]; then
|
||||
SPARK_CLASSPATH="$SPARK_CLASSPATH:$SPARK_EXTRA_CLASSPATH"
|
||||
fi
|
||||
|
||||
if [ -n "$PYSPARK_FILES" ]; then
|
||||
PYTHONPATH="$PYTHONPATH:$PYSPARK_FILES"
|
||||
fi
|
||||
|
||||
PYSPARK_ARGS=""
|
||||
if [ -n "$PYSPARK_APP_ARGS" ]; then
|
||||
PYSPARK_ARGS="$PYSPARK_APP_ARGS"
|
||||
fi
|
||||
|
||||
R_ARGS=""
|
||||
if [ -n "$R_APP_ARGS" ]; then
|
||||
R_ARGS="$R_APP_ARGS"
|
||||
fi
|
||||
|
||||
if [ "$PYSPARK_MAJOR_PYTHON_VERSION" == "2" ]; then
|
||||
pyv="$(python -V 2>&1)"
|
||||
export PYTHON_VERSION="${pyv:7}"
|
||||
export PYSPARK_PYTHON="python"
|
||||
export PYSPARK_DRIVER_PYTHON="python"
|
||||
elif [ "$PYSPARK_MAJOR_PYTHON_VERSION" == "3" ]; then
|
||||
pyv3="$(python3 -V 2>&1)"
|
||||
export PYTHON_VERSION="${pyv3:7}"
|
||||
export PYSPARK_PYTHON="python3"
|
||||
export PYSPARK_DRIVER_PYTHON="python3"
|
||||
fi
|
||||
|
||||
case "$SPARK_K8S_CMD" in
|
||||
driver)
|
||||
CMD=(
|
||||
"$SPARK_HOME/bin/spark-submit"
|
||||
--conf "spark.driver.bindAddress=$SPARK_DRIVER_BIND_ADDRESS"
|
||||
--deploy-mode client
|
||||
"$@"
|
||||
)
|
||||
;;
|
||||
driver-py)
|
||||
CMD=(
|
||||
"$SPARK_HOME/bin/spark-submit"
|
||||
--conf "spark.driver.bindAddress=$SPARK_DRIVER_BIND_ADDRESS"
|
||||
--deploy-mode client
|
||||
"$@" $PYSPARK_PRIMARY $PYSPARK_ARGS
|
||||
)
|
||||
;;
|
||||
driver-r)
|
||||
CMD=(
|
||||
"$SPARK_HOME/bin/spark-submit"
|
||||
--conf "spark.driver.bindAddress=$SPARK_DRIVER_BIND_ADDRESS"
|
||||
--deploy-mode client
|
||||
"$@" $R_PRIMARY $R_ARGS
|
||||
)
|
||||
;;
|
||||
executor)
|
||||
CMD=(
|
||||
${JAVA_HOME}/bin/java
|
||||
"${SPARK_EXECUTOR_JAVA_OPTS[@]}"
|
||||
-Xms$SPARK_EXECUTOR_MEMORY
|
||||
-Xmx$SPARK_EXECUTOR_MEMORY
|
||||
-cp "$SPARK_CLASSPATH"
|
||||
org.apache.spark.executor.CoarseGrainedExecutorBackend
|
||||
--driver-url $SPARK_DRIVER_URL
|
||||
--executor-id $SPARK_EXECUTOR_ID
|
||||
--cores $SPARK_EXECUTOR_CORES
|
||||
--app-id $SPARK_APPLICATION_ID
|
||||
--hostname $SPARK_EXECUTOR_POD_IP
|
||||
)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown command: $SPARK_K8S_CMD" 1>&2
|
||||
exit 1
|
||||
esac
|
||||
|
||||
# Execute the container CMD
|
||||
exec "${CMD[@]}"
|
||||
EOF
|
||||
```
|
||||
|
||||
3. Give execute permission to `entrypoint.sh` script.
|
||||
|
||||
```bash
|
||||
sudo chmod +x $(pwd)/entrypoint.sh
|
||||
```
|
||||
|
||||
4. Build Image, for this example use `dars_k8s_spark` as name.
|
||||
|
||||
```bash
|
||||
docker build . --build-arg DERIVED_IMAGE=clearlinux/stacks-dars-openblas -t dars_k8s_spark
|
||||
```
|
||||
|
||||
5. Verify your built image. Execute the following command looking for the given name `dars_k8s_spark`
|
||||
|
||||
```bash
|
||||
docker images | grep "dars_k8s_spark"
|
||||
```
|
||||
|
||||
You should see something like:
|
||||
|
||||
```bash
|
||||
dars_k8s_spark latest 1fa3278a3421 1 minutes ago 6.56GB
|
||||
```
|
||||
|
||||
6. Use a variable to store the image's given name:
|
||||
|
||||
```bash
|
||||
DARS_K8S_IMAGE=dars_k8s_spark
|
||||
```
|
||||
|
||||
### Configure RBAC
|
||||
|
||||
1. Create the spark service account and cluster role binding to allow Spark on Kubernetes create Executors as required. In this example use the `default` namespace.
|
||||
|
||||
```bash
|
||||
kubectl create serviceaccount spark-serviceaccount --namespace default
|
||||
kubectl create clusterrolebinding spark-rolebinding --clusterrole=edit --serviceaccount=default:spark-serviceaccount --namespace=default
|
||||
```
|
||||
|
||||
### Prepare to Submit Spark Job
|
||||
|
||||
1. Determine the Kubernetes master address:
|
||||
|
||||
```bash
|
||||
kubectl cluster-info
|
||||
```
|
||||
|
||||
You should see something like:
|
||||
|
||||
```bash
|
||||
Kubernetes master is running at https://192.168.39.127:8443
|
||||
```
|
||||
|
||||
2. Use a variable to store the master address:
|
||||
|
||||
```bash
|
||||
MASTER_ADDRESS='https://192.168.39.127:8443'
|
||||
```
|
||||
|
||||
### Submit Spark Job on Minikube
|
||||
|
||||
1. Execute following command using `MASTER_ADDRESS` and `DARS_K8S` variables. Driver pod will be called `spark-pi-driver`.
|
||||
|
||||
More information about `spark-submit` configuration on [running-on-kubernetes documentation](https://spark.apache.org/docs/latest/running-on-kubernetes.html#configuration).
|
||||
|
||||
```bash
|
||||
spark-submit \
|
||||
--master k8s://${MASTER_ADDRESS} \
|
||||
--deploy-mode cluster \
|
||||
--name spark-pi \
|
||||
--class org.apache.spark.examples.SparkPi \
|
||||
--conf spark.executor.instances=2 \
|
||||
--conf spark.kubernetes.container.image=${DARS_K8S_IMAGE} \
|
||||
--conf spark.kubernetes.driver.pod.name=spark-pi-driver \
|
||||
--conf spark.kubernetes.namespace=default \
|
||||
--conf spark.kubernetes.authenticate.driver.serviceAccountName=spark-serviceaccount \
|
||||
local:///usr/share/apache-spark/examples/jars/spark-examples_2.12-2.4.0.jar
|
||||
```
|
||||
|
||||
2. Check the Job. Read the logs and look for the Pi result:
|
||||
|
||||
```bash
|
||||
kubectl logs spark-pi-driver | grep "Pi is roughly"
|
||||
```
|
||||
|
||||
You should see something like:
|
||||
|
||||
```bash
|
||||
Pi is roughly 3.1418957094785473
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## 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)
|
||||
|
||||
## **FAQ**
|
||||
|
||||
* Pyspark / Spark-shell drops `connection exception` or `Connection refused` this happens due HADOOP_CONF_DIR environment variable is set and these APIs are assuming will use Hadoop Distributed File System.
|
||||
You can `unset HADOOP_CONF_DIR` and use Spark RDD, or start Hadoop services and then create your directories and files as you required using `hdfs`.
|
||||
|
||||
Also it is possible to change the file system to local without `unset HADOOP_CONF_DIR` as is further described below:
|
||||
|
||||
```bash
|
||||
pyspark --conf "spark.hadoop.fs.defaultFS=file:///"
|
||||
```
|
||||
|
||||
and
|
||||
|
||||
```bash
|
||||
spark-shell --conf "spark.hadoop.fs.defaultFS=file:///"
|
||||
```
|
||||
|
||||
* How to set proxies in Spark:
|
||||
|
||||
There is two ways to work with proxies:
|
||||
|
||||
1. Add in $SPARK_CONF_DIR/spark-defaults.conf the following line for both `spark.executor.extraJavaOptions` and `spark.driver.extraJavaOptions` variables:
|
||||
|
||||
```bash
|
||||
-Dhttp.proxyHost=<URL> -Dhttp.proxyPort=<PORT> -Dhttps.proxyHost=<URL> -Dhttps.proxyPort=<PORT>
|
||||
```
|
||||
|
||||
e.g.
|
||||
|
||||
```bash
|
||||
# OpenBlas confs
|
||||
spark.executor.extraJavaOptions=-Dcom.github.fommil.netlib.BLAS=com.github.fommil.netlib.NativeSystemBLAS -Dcom.github.fommil.netlib.LAPACK=com.github.fommil.netlib.NativeSystemLAPACK -Dcom.github.fommil.netlib.ARPACK=com.github.fommil.netlib.NativeSystemARPACK -Dhttp.proxyHost=example.proxy -Dhttp.proxyPort=111 -Dhttps.proxyHost=example.proxy -Dhttps.proxyPort=112
|
||||
|
||||
spark.driver.extraJavaOptions=-Dcom.github.fommil.netlib.BLAS=com.github.fommil.netlib.NativeSystemBLAS -Dcom.github.fommil.netlib.LAPACK=com.github.fommil.netlib.NativeSystemLAPACK -Dcom.github.fommil.netlib.ARPACK=com.github.fommil.netlib.NativeSystemARPACK -Dhttp.proxyHost=example.proxy -Dhttp.proxyPort=111 -Dhttps.proxyHost=example.proxy -Dhttps.proxyPort=112
|
||||
```
|
||||
|
||||
2. Give as `conf` parameter the proxies URL and Port.
|
||||
|
||||
e.g.
|
||||
|
||||
```bash
|
||||
pyspark --conf "spark.hadoop.fs.defaultFS=file:///" --conf "spark.driver.extraJavaOptions=-Dhttp.proxyHost=example.proxy -Dhttp.proxyPort=111 -Dhttps.proxyHost=example.proxy -Dhttps.proxyPort=112"
|
||||
```
|
||||
|
||||
and
|
||||
|
||||
```bash
|
||||
spark-shell --conf "spark.hadoop.fs.defaultFS=file:///" --conf "spark.driver.extraJavaOptions=-Dhttp.proxyHost=example.proxy -Dhttp.proxyPort=111 -Dhttps.proxyHost=example.proxy -Dhttps.proxyPort=112"
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
#### Non functional known issues
|
||||
|
||||
* spark-shell:
|
||||
|
||||
>There is an exception message `Unrecognized Hadoop major version number: 3.2.0 at org.apache.hadoop.hive.shims.ShimLoader.getMajorVersion`.
|
||||
This is not a problem, DARS is not using hadoop.hive.shims.
|
||||
Hive binaries installed from [Apache](http://www.apache.org/dyn/closer.cgi/hive) on Clearlinux + JDK 11 does not work, this is an issue reported on [Jira's Hive](https://issues.apache.org/jira/browse/HIVE-21237) since February.
|
||||
|
||||
* pyspark:
|
||||
|
||||
>There is an exception message `Exception in thread "Thread-3" java.lang.ExceptionInInitializerError at org.apache.hadoop.hive.conf.HiveConf`
|
||||
Hive binaries installed from [Apache](http://www.apache.org/dyn/closer.cgi/hive) on Clearlinux + JDK 11 does not work, this is an issue reported on [Jira's Hive](https://issues.apache.org/jira/browse/HIVE-21237) since February.
|
||||
@@ -1 +0,0 @@
|
||||
/usr/lib64/haswell/avx512_1
|
||||
@@ -1,6 +0,0 @@
|
||||
<configuration>
|
||||
<property>
|
||||
<name>fs.defaultFS</name>
|
||||
<value>hdfs://localhost:9000</value>
|
||||
</property>
|
||||
</configuration>
|
||||
@@ -1,6 +0,0 @@
|
||||
<configuration>
|
||||
<property>
|
||||
<name>dfs.replication</name>
|
||||
<value>1</value>
|
||||
</property>
|
||||
</configuration>
|
||||
@@ -1,6 +0,0 @@
|
||||
<configuration>
|
||||
<property>
|
||||
<name>mapreduce.framework.name</name>
|
||||
<value>yarn</value>
|
||||
</property>
|
||||
</configuration>
|
||||
@@ -1 +0,0 @@
|
||||
localhost
|
||||
@@ -1,6 +0,0 @@
|
||||
<configuration>
|
||||
<property>
|
||||
<name>yarn.nodemanager.aux-services</name>
|
||||
<value>mapreduce_shuffle</value>
|
||||
</property>
|
||||
</configuration>
|
||||
@@ -1,8 +0,0 @@
|
||||
## 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.
|
||||
@@ -1,147 +0,0 @@
|
||||
|
||||
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.
|
||||
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Configure openjdk11
|
||||
|
||||
export JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk
|
||||
export PATH="${JAVA_HOME}/bin:${PATH}"
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
# OpenBlas confs
|
||||
spark.executor.extraJavaOptions=-Dcom.github.fommil.netlib.BLAS=com.github.fommil.netlib.NativeSystemBLAS -Dcom.github.fommil.netlib.LAPACK=com.github.fommil.netlib.NativeSystemLAPACK -Dcom.github.fommil.netlib.ARPACK=com.github.fommil.netlib.NativeSystemARPACK
|
||||
spark.driver.extraJavaOptions=-Dcom.github.fommil.netlib.BLAS=com.github.fommil.netlib.NativeSystemBLAS -Dcom.github.fommil.netlib.LAPACK=com.github.fommil.netlib.NativeSystemLAPACK -Dcom.github.fommil.netlib.ARPACK=com.github.fommil.netlib.NativeSystemARPACK
|
||||
@@ -1,2 +0,0 @@
|
||||
OPENBLAS_NUM_THREADS=1
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/native
|
||||
@@ -1,66 +0,0 @@
|
||||
|
||||
# Data Analytics Reference Stack
|
||||
|
||||
The Data Analytics Reference Stack, is an integrated, highly-performant stack optimized for Intel® Xeon® Scalable platforms. This open source community release is part of an effort to ensure enterprises have easy access to all features and functionality of Intel platforms.
|
||||
|
||||
Highly-tuned and built for enterprises, the release enables application developers and architects a powerful way to store and process large amounts of data using a distributed processing framework to efficiently build big-data solutions and solve domain-specific problems. Having a streamlined system stack frees users from the complexity of integrating multiple components and software versions, and delivers a stable, performant platform upon which to quickly develop, test, and deploy solutions.
|
||||
|
||||
The stack includes tuned software components across the operating system (Clear Linux OS), Runtimes (Open Java Development Kit* (OpenJDK)), Math Libraries (Intel ® Math Kernel Library (MKL), open source Basic Linear Algebra Subprograms (OpenBLAS)), frameworks (Apache Hadoop*, Apache Spark*), and other software components.
|
||||
|
||||
> **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 30970.
|
||||
|
||||
## Stack Features
|
||||
|
||||
The Data Analytics Reference Stack provides two pre-built Docker images, available on Docker Hub:
|
||||
|
||||
A Clear Linux OS-derived [DARS with OpenBlas](https://hub.docker.com/r/clearlinux/stacks-dars-openblas) stack optimized for [OpenBLAS](http://www.openblas.net)
|
||||
A Clear Linux OS-derived [DARS with Intel® MKL](https://hub.docker.com/r/clearlinux/stacks-dars-mkl) stack optimized for [MKL](https://software.intel.com/en-us/mkl) (Intel® Math Kernel Library)
|
||||
|
||||
## The Data Analytics Reference Stack with MKL
|
||||
|
||||
The release includes:
|
||||
* Clear Linux* OS
|
||||
* Apache Spark 2.4.0
|
||||
* Apache Hadoop 3.2.0
|
||||
* OpenJDK 11.0.4
|
||||
* Intel® Math Kernel Library 2019 [Update 5](https://software.intel.com/en-us/articles/intel-math-kernel-library-release-notes-and-new-features)
|
||||
|
||||
## The Data Analytics Reference Stack with OpenBLAS
|
||||
|
||||
The release includes:
|
||||
* Clear Linux* OS
|
||||
* Apache Spark 2.4.0
|
||||
* Apache Hadoop 3.2.0
|
||||
* OpenJDK 11.0.4
|
||||
* OpenBLAS 0.3.6
|
||||
|
||||
# Licensing
|
||||
|
||||
The Data Analytics 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 Data Analytics Reference Stack
|
||||
|
||||
The images can be used in a Kubernetes cluster as a multi-node environment. Please see the [Data Analytics Reference Stack documentation](https://docs.01.org/clearlinux/latest/guides/stacks/dars.html) to get detailed instructions.
|
||||
Please refer to the [Data Analytics Reference Stack tutorial](https://clearlinux.org/documentation/clear-linux/tutorials/dars) 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
|
||||
@@ -1,8 +0,0 @@
|
||||
# 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.
|
||||
@@ -1,67 +0,0 @@
|
||||
FROM clearlinux/stacks-clearlinux:latest
|
||||
|
||||
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
|
||||
|
||||
|
||||
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"]
|
||||
@@ -1,302 +0,0 @@
|
||||
## Database Reference Stack with Cassandra
|
||||
|
||||
[](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`.
|
||||
@@ -1,22 +0,0 @@
|
||||
# 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/
|
||||
@@ -1,5 +0,0 @@
|
||||
apiVersion: v1
|
||||
appVersion: "1.0"
|
||||
description: A Helm chart for deploying Cassandra PMEM on K8s
|
||||
name: cassandra-pmem-helm
|
||||
version: 0.1.0
|
||||
@@ -1,2 +0,0 @@
|
||||
monitorRole readonly
|
||||
controlRole readwrite
|
||||
@@ -1,3 +0,0 @@
|
||||
##Role password
|
||||
monitorRole testpass
|
||||
controlRole testpass
|
||||
@@ -1,3 +0,0 @@
|
||||
# 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.
|
||||
@@ -1,2 +0,0 @@
|
||||
# Test profiles
|
||||
When using `enableClientToolsPod: true` in values.yaml, the test profiles located in this directory are mounted on `/testProfiles` inside the pod.
|
||||
-78
@@ -1,78 +0,0 @@
|
||||
#
|
||||
# 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)
|
||||
@@ -1,109 +0,0 @@
|
||||
#
|
||||
# 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
|
||||
-89
@@ -1,89 +0,0 @@
|
||||
#
|
||||
# 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)
|
||||
-71
@@ -1,71 +0,0 @@
|
||||
# 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
|
||||
@@ -1,11 +0,0 @@
|
||||
{{- 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 }}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
{{- 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 }}
|
||||
@@ -1,10 +0,0 @@
|
||||
{{- 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 }}
|
||||
@@ -1,21 +0,0 @@
|
||||
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 }}
|
||||
@@ -1,22 +0,0 @@
|
||||
{{- 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 }}
|
||||
@@ -1,129 +0,0 @@
|
||||
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 }}
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
{{- 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 }}
|
||||
@@ -1,72 +0,0 @@
|
||||
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
@@ -1,194 +0,0 @@
|
||||
###########################################################################
|
||||
# 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
|
||||
@@ -1,96 +0,0 @@
|
||||
###########################################################################
|
||||
# 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
|
||||
@@ -1,77 +0,0 @@
|
||||
###########################################################################
|
||||
# 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
|
||||
@@ -1,8 +0,0 @@
|
||||
## 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.
|
||||
@@ -1,209 +0,0 @@
|
||||
|
||||
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.
|
||||
@@ -1,147 +0,0 @@
|
||||
|
||||
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.
|
||||
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
#!/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
|
||||
@@ -1,2 +0,0 @@
|
||||
#!/bin/bash
|
||||
/usr/bin/chown cassandra-user /dev/dax0.0
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
/usr/bin/chown cassandra-user -R /mnt/pmem
|
||||
/usr/bin/chmod a+rw -R /mnt/pmem
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/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
|
||||
@@ -1,109 +0,0 @@
|
||||
#!/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 "$@"
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/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
|
||||
@@ -1,32 +0,0 @@
|
||||
FROM clearlinux AS build-redis
|
||||
|
||||
RUN swupd bundle-add --quiet --no-progress git c-basic devpkg-ndctl curl package-utils
|
||||
|
||||
RUN clr_ver=$(grep VERSION_ID /usr/lib/os-release | awk -F= '{print $2}') && \
|
||||
NUMA_DEV="https://cdn.download.clearlinux.org/releases/$clr_ver/clear/x86_64/os/Packages/numactl-dev-2.0.12-20.x86_64.rpm" && \
|
||||
NUMA_LIB="https://cdn.download.clearlinux.org/releases/$clr_ver/clear/x86_64/os/Packages/numactl-lib-2.0.12-20.x86_64.rpm" && \
|
||||
rpm -ihv --nodeps $NUMA_DEV $NUMA_LIB
|
||||
|
||||
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
|
||||
@@ -1,76 +0,0 @@
|
||||
## Database Reference Stack with Redis
|
||||
|
||||
[](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.
|
||||
@@ -1,8 +0,0 @@
|
||||
## 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.
|
||||
@@ -1,147 +0,0 @@
|
||||
|
||||
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.
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
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.
|
||||
@@ -1,44 +0,0 @@
|
||||
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
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/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 "$@"
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/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
|
||||
@@ -1,79 +0,0 @@
|
||||
|
||||
# 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://docs.01.org/clearlinux/latest/guides/stacks/dbrs.html) 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
|
||||
@@ -1,10 +0,0 @@
|
||||
# Deep Learning Reference Stack
|
||||
|
||||
This provides the Deep Learning Reference Stack. To offer more flexibility, there are multiple versions of the Deep Learning Reference Stack:
|
||||
* Intel® Math Kernel Library for Deep Neural Networks (Intel® MKL-DNN) primitives and AVX-512 Deep Learning Boost (formerly known as AVX-512 VNNI)
|
||||
* Eigen optimized for Intel Architecture
|
||||
* Intel® Math Kernel Library for Deep Neural Networks (Intel® MKL-DNN) primitives
|
||||
* OSS PyTorch DLRS Docker image
|
||||
* PyTorch DLRS Docker image w/ Intel® Math Kernel Library
|
||||
|
||||
Please see the folders in this level about the variants and how to build and use them.
|
||||
@@ -1,3 +0,0 @@
|
||||
# Kubeflow Specific Files
|
||||
|
||||
This folder is home for kubeflow specific files to enable DLRS images with various workloads that exist as part of kubeflow.
|
||||
@@ -1,10 +0,0 @@
|
||||
# PyTorch Training (PyTorch Job) with Kubeflow and DLRS
|
||||
|
||||
A [PyTorch Job](https://www.kubeflow.org/docs/components/pytorch/) is Kubeflow's custom resource used to run PyTorch training jobs on Kubernetes.
|
||||
|
||||
## Submitting PyTorch Jobs
|
||||
|
||||
In this folder you will find PyToch Job examples that use the Deep Learning Reference Stack as base image for creating the container(s) that will run training workloads in your Kubernetes cluster.
|
||||
Select one form the list below:
|
||||
|
||||
* [Pytorch CNN Benchmarks](https://github.com/clearlinux/dockerfiles/tree/master/stacks/dlrs/kubeflow/dlrs-pytorchjob/pytorch_cnn_benchmarks)
|
||||
@@ -1,6 +0,0 @@
|
||||
FROM clearlinux/stacks-pytorch-mkl:v0.4.0
|
||||
|
||||
WORKDIR /var
|
||||
COPY cnn_benchmarks.py /var
|
||||
|
||||
ENTRYPOINT ["mpirun", "-n", "1", "--allow-run-as-root", "python", "/var/cnn_benchmarks.py"]
|
||||
@@ -1,11 +0,0 @@
|
||||
# Training PyTorch CNN Benchmarks
|
||||
|
||||
This directory contains code to train convolutional neural networks using cnn_benchmarks.
|
||||
|
||||
## Build Image
|
||||
|
||||
The PyTorch Job consumes a custom DLRS image for deployment. The default image name and tag is project-name/stacks-pytorch-kf-mkl:0.4.0; you should change the image name to match your project and make the proper changes in pytorch_job_cnn_benchmarks.yaml.
|
||||
|
||||
```bash
|
||||
docker build -f Dockerfile -t project-name/stacks-pytorch-kf-mkl:0.4.0 .
|
||||
```
|
||||
@@ -1,219 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# This is free and unencumbered software released into the public domain.
|
||||
#
|
||||
# Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
# distribute this software, either in source code form or as a compiled
|
||||
# binary, for any purpose, commercial or non-commercial, and by any
|
||||
# means.
|
||||
#
|
||||
# In jurisdictions that recognize copyright laws, the author or authors
|
||||
# of this software dedicate any and all copyright interest in the
|
||||
# software to the public domain. We make this dedication for the benefit
|
||||
# of the public at large and to the detriment of our heirs and
|
||||
# successors. We intend this dedication to be an overt act of
|
||||
# relinquishment in perpetuity of all present and future rights to this
|
||||
# software under copyright law.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
# OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
# For more information, please refer to <http://unlicense.org>
|
||||
"""mini cnn benchmarks in pytorch to identify regression issues"""
|
||||
|
||||
import argparse
|
||||
from collections import namedtuple
|
||||
import logging
|
||||
import multiprocessing as mps
|
||||
import os
|
||||
import platform
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
import torch
|
||||
import torchvision.models as models
|
||||
import torch.nn as nn
|
||||
import torch.optim as optim
|
||||
|
||||
|
||||
class BenchMarks:
|
||||
"""set of convnet benchmarks"""
|
||||
|
||||
Model = namedtuple("Model", "name model batch")
|
||||
alexnet = Model(name="alexnet", model=models.alexnet, batch=(64, 224, 224))
|
||||
resnet18 = Model(name="resnet18", model=models.resnet18, batch=(128, 224, 224))
|
||||
resnet50 = Model(name="resnet50", model=models.resnet50, batch=(256, 224, 224))
|
||||
vgg16 = Model(name="vgg16", model=models.vgg16, batch=(256, 224, 224))
|
||||
squeezenet = Model(
|
||||
name="squeezenet", model=models.squeezenet1_1, batch=(256, 224, 224)
|
||||
)
|
||||
|
||||
def select(self, model_name=None):
|
||||
"""select models to be run"""
|
||||
logging.info("Run details")
|
||||
logging.info("=" * 71)
|
||||
models = [
|
||||
self.alexnet,
|
||||
self.resnet18,
|
||||
self.resnet50,
|
||||
self.vgg16,
|
||||
self.squeezenet,
|
||||
]
|
||||
if model_name:
|
||||
self.models = [
|
||||
model for model in models for name in model_name if name == model.name
|
||||
]
|
||||
logging.info("Selected model(s) :: ")
|
||||
for m in self.models:
|
||||
logging.info("%s ------------- Batchsize :: %s " % (m.name, m.batch))
|
||||
logging.info("=" * 71)
|
||||
|
||||
@staticmethod
|
||||
def synth_data(batch):
|
||||
channel = 3
|
||||
batch_size = batch[0]
|
||||
height = batch[1]
|
||||
weight = batch[2]
|
||||
inp_data = torch.rand(batch_size, channel, height, weight)
|
||||
label = torch.arange(1, batch_size + 1).long()
|
||||
return inp_data, label
|
||||
|
||||
def main(self, models, dry_run=True):
|
||||
if not dry_run:
|
||||
self.select(models)
|
||||
if not self.models:
|
||||
logging.info("Requested model(s) not available")
|
||||
for m in self.models:
|
||||
logging.info("=" * 71)
|
||||
logging.info("Running an instance of :: %s" % m.name)
|
||||
self.run(m)
|
||||
|
||||
def run(self, model_tuple):
|
||||
"""Run each model `step` times"""
|
||||
t_forward, t_backward, t_update = 0, 0, 0
|
||||
steps = 10
|
||||
model, batch = model_tuple.model(), model_tuple.batch
|
||||
learning_rate = 0.01
|
||||
input_data, label = BenchMarks.synth_data(batch)
|
||||
optimizer = optim.SGD(model.parameters(), lr=learning_rate)
|
||||
loss_fn = nn.CrossEntropyLoss()
|
||||
model.eval()
|
||||
optimizer.zero_grad()
|
||||
logging.info("Number of iterations :: %d" % steps)
|
||||
logging.info("Learning rate:: %f" % learning_rate)
|
||||
for _ in range(steps):
|
||||
t_1 = time.time()
|
||||
output = model(input_data)
|
||||
t_2 = time.time()
|
||||
loss = loss_fn(output, label)
|
||||
loss.backward()
|
||||
t_3 = time.time()
|
||||
optimizer.step()
|
||||
t_4 = time.time()
|
||||
t_forward += t_2 - t_1
|
||||
t_backward += t_3 - t_2
|
||||
t_update += t_4 - t_2
|
||||
forward_avg = t_forward / steps
|
||||
backward_avg = t_backward / steps
|
||||
update_avg = t_update / steps
|
||||
total_time = forward_avg + backward_avg + update_avg
|
||||
logging.info(
|
||||
"Avg time taken for training %s :: %f" % (model_tuple.name, total_time)
|
||||
)
|
||||
logging.info("Avg inference time:: %f" % forward_avg)
|
||||
logging.info(
|
||||
"Training throughput :: %f images/sec" % (model_tuple.batch[0] / total_time)
|
||||
)
|
||||
logging.info(
|
||||
"Inference throughput :: %f images/sec"
|
||||
% (model_tuple.batch[0] / forward_avg)
|
||||
)
|
||||
logging.info("=" * 71)
|
||||
|
||||
|
||||
def set_env_vars():
|
||||
"""env variables to tune performance"""
|
||||
os.environ["OMP_NUM_THREADS"] = str(int(mps.cpu_count() / 2))
|
||||
os.environ["KMP_BLOCKTIME"] = "0"
|
||||
os.environ["KMP_AFFINITY"] = "granularity=fine,verbose,compact,1,0"
|
||||
|
||||
|
||||
def print_config_details():
|
||||
"""details about the platform, and the stack"""
|
||||
logging.info("Platform details")
|
||||
logging.info("=" * 71)
|
||||
logging.info(
|
||||
"cpu name :: %s"
|
||||
% str(
|
||||
subprocess.check_output(
|
||||
"cat /proc/cpuinfo | grep 'model name' | head -n 1", shell=True
|
||||
)
|
||||
).split(":")[1][:-3]
|
||||
)
|
||||
logging.info("operating system :: %s" % platform.platform())
|
||||
logging.info("processor count :: %d" % mps.cpu_count())
|
||||
logging.info("OMP_NUM_THREADS :: %s" % os.environ["OMP_NUM_THREADS"])
|
||||
logging.info("KMP BLOCKTIME :: %s" % os.environ["KMP_BLOCKTIME"])
|
||||
logging.info("KMP_AFFINITY :: %s" % os.environ["KMP_AFFINITY"])
|
||||
logging.info("=" * 71)
|
||||
logging.info("Pytorch config")
|
||||
logging.info("=" * 71)
|
||||
logging.info("pytorch version :: %s" % torch.__version__)
|
||||
logging.info("mkl available :: %s" % "Yes" if torch.has_lapack else "No")
|
||||
logging.info("lapack available :: %s" % "Yes" if torch.has_mkl else "No")
|
||||
mkldnn = os.path.isfile(
|
||||
os.path.join(torch.get_file_path(), "torch", "lib", "libmkldnn.so")
|
||||
)
|
||||
logging.info("mkldnn available :: %s" % "Yes" if mkldnn else "No")
|
||||
logging.info("=" * 71)
|
||||
|
||||
|
||||
def config_parser():
|
||||
"""cli and logger definitions"""
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"-o",
|
||||
"--log_to_file",
|
||||
help="log output to file",
|
||||
action="store_true",
|
||||
default=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"-d",
|
||||
"--dry_run",
|
||||
help="Don't run the actual models",
|
||||
action="store_true",
|
||||
default=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"-m", "--models", help="input models as a comma sep list", type=str, nargs="*"
|
||||
)
|
||||
args = parser.parse_args()
|
||||
if args.log_to_file:
|
||||
logging.basicConfig(
|
||||
filename="benchmark.log",
|
||||
filemode="a",
|
||||
level=logging.DEBUG,
|
||||
format="%(asctime)s - %(levelname)s - %(message)s",
|
||||
)
|
||||
else:
|
||||
logging.basicConfig(
|
||||
level=logging.DEBUG, format="%(asctime)s - %(levelname)s - %(message)s"
|
||||
)
|
||||
return args
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = config_parser()
|
||||
if platform.system() != "Linux":
|
||||
logging.info("Exiting... not a linux system")
|
||||
exit(1)
|
||||
set_env_vars()
|
||||
print_config_details()
|
||||
bmarks = BenchMarks()
|
||||
models = args.models if args.models else ["alexnet", "resnet18"]
|
||||
bmarks.main(models, dry_run=args.dry_run)
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
apiVersion: "kubeflow.org/v1beta2"
|
||||
kind: "PyTorchJob"
|
||||
metadata:
|
||||
name: "pytorch-job-cnn-benchmark"
|
||||
spec:
|
||||
pytorchReplicaSpecs:
|
||||
Master:
|
||||
replicas: 1
|
||||
restartPolicy: Never
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: pytorch
|
||||
image: your-project/stacks-pytorch-kf-mkl:0.4.0
|
||||
Worker:
|
||||
replicas: 1
|
||||
restartPolicy: Never
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: pytorch
|
||||
image: your-project/stacks-pytorch-kf-mkl:0.4.0
|
||||
@@ -1,3 +0,0 @@
|
||||
# Seldon and OpenVINO model server using the Deep Learning Reference Stack
|
||||
|
||||
[Seldon Core](https://docs.seldon.io/projects/seldon-core/en/latest/) is an open source platform for deploying machine learning models on a Kubernetes cluster.
|
||||
@@ -1,13 +0,0 @@
|
||||
FROM clearlinux/stacks-dlrs-mkl:v0.4.0
|
||||
|
||||
RUN pip install jaeger-client==3.13.0 seldon-core tornado>=5.0\
|
||||
&& pip install --upgrade setuptools \
|
||||
&& sed -i "s/max_workers=10/max_workers=1/g" /usr/lib/python3.7/site-packages/seldon_core/wrapper.py
|
||||
|
||||
RUN git clone https://github.com/SeldonIO/seldon-core.git /opt/seldon-core \
|
||||
&& mkdir -p /s2i/bin \
|
||||
&& cp -a /opt/seldon-core/wrappers/s2i/python/s2i/bin/ /s2i/bin/
|
||||
|
||||
WORKDIR /microservice
|
||||
|
||||
EXPOSE 5000
|
||||
@@ -1,22 +0,0 @@
|
||||
# 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/
|
||||
@@ -1,5 +0,0 @@
|
||||
apiVersion: v1
|
||||
appVersion: "v0.1"
|
||||
description: Simple Seldon and OpenVINO Server
|
||||
name: seldon-model-server
|
||||
version: 0.1.0
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user