Code Monkey home page Code Monkey logo

openshift-cassandra's Introduction

Openshift- Cassandra

Proof of concept with Apache Cassandra on OpenShift 3.4. 2 pods that represents the Cassandra's ring.

Quick start

Firs of all, you should have persistent storage assigned.

  1. Create a new OpenShift project

  2. Import the templates in your OpenShift project throw the UI. Once yo have do it, the build and deployment should start automatically.

  3. Once the deployment has finished, create a route throw the UI.

Template.yaml

In this template, there are two objects:

  • ImageStream: brings toghether a set of ‘n’ tagged container images in Docker format, so each time a new build is released, it will be tagged as ‘latest’. It’s similar than an image repository.
  • BuildConfig: configuration that’s will receive a Dockerfile as input and will generate a container image as output, this image will be used later to generating the pods

Deploy.yaml

In this template, there are the objects bellow:

  • PersistentVolumeClaim: it allows us to request for persistent storage for our data. It’s important to provide a name in order to associate it later (inside the deploy) to the logic volume, where Cassandra will store such data, in our case /var/lib/cassabdra/data
  • DeploymentConfig: configuration that we want to attach to our deployment, it’s consist of several attributes:
  • Replicas: number of pods for our deployment (ring nodes)
  • Containers: over this attribute we attach the base image of our containers, it allows us different options (among others)
  • Command: script or command that we want execute on the container start, in our case will be the one that modifies the Cassandra’s configuration file(docker-entrypoint.sh)
  • Env: it allows us to defining environment variables inside the container
  • Ports: published ports by the container
  • volumeMounts: logical volumes which will be generated inside the container
  • triggers: will be responsible of executing a new deploy if the base image has changed or if the deploys configuration has changed to.
  • Services: we’ll need two services:
  • Cassandra-peers: this service will be used for the seeds to starting the gossip-protocol, thus, we’ll attached the ports 7000 and 7001, moreover we will indicate it throw the clusterIP = none attribute that it’s a headless service, that’s to say, we don’t
  • Cassandra-cql: this service will be exposed to the outside, for that their type attribute must take the LoadBalancer or NodePort value, service’s port will be 9042 and finally we will indicate that the nodePort (the port for which the service will listen to the outside) Is of the range [30000-32767], this way we get it to be routed by the latter from the outside to our cql service. For more information on how OpenShift does this I recommend visiting: https://docs.openshift.com/container-platform/3.4/install_config/routing_from_edge_lb.html and https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport

Openshift UI

From the UI, we can test our solution:

alt tag

openshift-cassandra's People

Contributors

jucaf avatar lucarosellini avatar vshulkin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openshift-cassandra's Issues

deploy.yaml fails

Just sharing, while trying to run on Minishift....


Cloning "https://github.com/keedio/openshift-cassandra.git " ...
--
  | Commit:	7f36edb28af4ca3bfce580b4f6ee0c4c7a518d7b (Merge pull request #2 from vshulkin/patch-1)
  | Author:	Luca Rosellini <[email protected]>
  | Date:	Tue Apr 3 09:56:14 2018 +0200
  | Step 1/15 : FROM jboss/base-jdk:8
  | ---> 8a832b9f0f57
  | Step 2/15 : EXPOSE 9042 9160 7000 7001
  | ---> Using cache
  | ---> e289e21bb170
  | Step 3/15 : ENV CASSANDRA_VERSION "3.11.2" CASSANDRA_HOME "/opt/apache-cassandra" HOME "/home/cassandra" PATH "/opt/apache-cassandra/bin:$PATH"
  | ---> Using cache
  | ---> cb7c0860ea9c
  | Step 4/15 : USER root
  | ---> Using cache
  | ---> 2542123d8670
  | Step 5/15 : RUN yum install -y -q bind-utils &&    yum clean all
  | ---> Using cache
  | ---> 20d15603da91
  | Step 6/15 : RUN cd /opt &&	curl -LO http://apache.uvigo.es/cassandra/$CASSANDRA_VERSION/apache-cassandra-$CASSANDRA_VERSION-bin.tar.gz  && ls -l &&    tar xvzf apache-cassandra-$CASSANDRA_VERSION-bin.tar.gz &&     rm apache-cassandra-$CASSANDRA_VERSION-bin.tar.gz &&     ln -s apache-cassandra-$CASSANDRA_VERSION apache-cassandra
  | ---> Running in 7d492f0cabae
  | % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  | Dload  Upload   Total   Spent    Left  Speed
  | 0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0100   249  100   249    0     0    133      0  0:00:01  0:00:01 --:--:--   133100   249  100   249    0     0    133      0  0:00:01  0:00:01 --:--:--   133
  | total 4
  | -rw-r--r--. 1 root  root  249 Jun 10 23:22 apache-cassandra-3.11.2-bin.tar.gz
  | drwxr-xr-x. 2 jboss jboss  62 Feb 13 10:56 jboss
  |  
  | gzip: stdin: not in gzip format
  | tar: Child returned status 1
  | tar: Error is not recoverable: exiting now
  | Removing intermediate container 7d492f0cabae
  | error: build error: The command '/bin/sh -c cd /opt &&	curl -LO http://apache.uvigo.es/cassandra/$CASSANDRA_VERSION/apache-cassandra-$CASSANDRA_VERSION-bin.tar.gz  && ls -l &&    tar xvzf apache-cassandra-$CASSANDRA_VERSION-bin.tar.gz &&     rm apache-cassandra-$CASSANDRA_VERSION-bin.tar.gz &&     ln -s apache-cassandra-$CASSANDRA_VERSION apache-cassandra' returned a non-zero code: 2

Build fails on step 7

When kicking off the Yaml it fails on downloading the cassandra source.

I added env variables with vertison 3.11.0 and it still fails.

Step 7 : RUN cd /opt &&	curl -LO http://apache.uvigo.es/cassandra/$CASSANDRA_VERSION/apache-cassandra-$CASSANDRA_VERSION-bin.tar.gz && ls -l &&    tar xvzf apache-cassandra-$CASSANDRA_VERSION-bin.tar.gz &&     rm apache-cassandra-$CASSANDRA_VERSION-bin.tar.gz &&     ln -s apache-cassandra-$CASSANDRA_VERSION apache-cassandra
--
  | ---> Running in df3fc674fad8
  | % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  | Dload  Upload   Total   Spent    Left  Speed
  | 0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0 100   245  100   245    0     0   1089      0 --:--:-- --:--:-- --:--:--  1093
  | total 4
  | -rw-r--r--. 1 root  root  245 Oct  8 15:06 apache-cassandra-3.10-bin.tar.gz
  | drwxr-xr-x. 2 jboss jboss  62 Sep 14 17:10 jboss
  |  
  | gzip: stdin: not in gzip format
  | tar: Child returned status 1
  | tar: Error is not recoverable: exiting now
  | error: build error: The command '/bin/sh -c cd /opt &&	curl -LO http://apache.uvigo.es/cassandra/$CASSANDRA_VERSION/apache-cassandra-$CASSANDRA_VERSION-bin.tar.gz && ls -l &&    tar xvzf apache-cassandra-$CASSANDRA_VERSION-bin.tar.gz &&     rm apache-cassandra-$CASSANDRA_VERSION-bin.tar.gz &&     ln -s apache-cassandra-$CASSANDRA_VERSION apache-cassandra' returned a non-zero code: 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.