Taming the herd: using Zookeeper and Exhibitor on Google Container Engine

Zookeeper is the cornerstone of many distributed systems, maintaining configuration information, naming and providing distributed synchronization and group services. But using Zookeeper in a dynamic cloud environment can be challenging, because of the way it keeps track of members in the cluster. Luckily, there’s an open source package called Exhibitor that makes it simple to use Zookeeper with Google Container Engine.

With Zookeeper, it’s easy to implement the primitives for coordinating hosts, such as locking and leader election. To provide these features in a highly available manner, Zookeeper uses a clustering mechanism that requires a majority of the cluster members to acknowledge a change before the cluster’s state is committed. In a cloud environment, however, Zookeeper machines come and go from the cluster (or “ensemble” in Zookeeper terms), changing names and IP addresses, and losing state about the ensemble. These sorts of ephemeral cloud instances are not well suited to Zookeeper, which requires all hosts to know the addresses or hostnames of the other hosts in the ensemble.


Netflix tackled this issue, and in order to more easily configure, operate, and debug Zookeeper in cloud environments, created Exhibitor, a supervisor process that coordinates the configuration and execution of Zookeeper processes across many hosts. Exhibitor also provides the following features for Zookeeper operators and users:
  • Backup and restore
  • A lightweight GUI for Zookeeper nodes
  • A REST API for getting the state of the Zookeeper ensemble
  • Rolling updates of configuration changes
Let’s take a look at using Exhibitor in Container Engine in order to run Zookeeper as a shared service for our other applications running in a Kubernetes cluster.

To start, provision a shared file server to host the shared configuration file between your cluster hosts. The easiest way to get a file server up and running in Google Cloud Platform is to create a Single Node File Server using Google Cloud Launcher. For horizontally scalable and highly available shared filesystem options on Cloud Platform, have a look at Red Hat Gluster Storage and Avere. The resulting file server will expose both NFS and SMB file shares.
  1. Provision your file server
  2. Select the Cloud Platform project in which you’d like to launch it
  3. Choose the following parameters for the dimensions of your file server
    • Zone — must match the zone of your Container Engine cluster (to be provisioned later)
    • Machine type — for this tutorial we chose a n1-standard-1 as throughput will not be very high for our hosted files
    • Storage disk size — for this tutorial, we chose a 100GB disk as we will not need high throughput nor IOPS
  4. Click Deploy
Next, create a Container Engine cluster in which to deploy your Zookeeper ensemble.
  1. Create a new Kubernetes cluster using Google Container Engine
  2. Ensure that the zone setting is the same as you use to deploy your file server (for the purposes of this tutorial, leave the defaults for the other settings)
  3. Click Create
Once your cluster is created, open up the Cloud Shell in the Cloud Console by
clicking the button in the top right of the interface.  It looks like:
Now set up your Zookeeper ensemble in Kubernetes.
  1. Set the default zone for the gcloud CLI to the zone you created for your file server and Kubernetes cluster:
    gcloud config set compute/zone us-east1-d
    
  2. Download your Kubernetes credentials via the Cloud SDK:
    gcloud container clusters get-credentials cluster-1
    
  3. Create a file named exhibitor.yaml with the following content. This will define our Exhibitor deployment as well as the service that other applications can use to communicate with it:
    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
      name: exhibitor
    spec:
     replicas: 3
     template:
       metadata:
         labels:
           name: exhibitor
       spec:
        containers:
        - image: mbabineau/zookeeper-exhibitor
        imagePullPolicy: Always
        name: exhibitor
        volumeMounts:
          - name: nfs
          mountPath: "/opt/zookeeper/local_configs"
        livenessProbe:
          tcpSocket:
            port: 8181
          initialDelaySeconds: 60
          timeoutSeconds: 1
        readinessProbe:
          httpGet:
            path: /exhibitor/v1/cluster/4ltr/ruok
            port: 8181
          initialDelaySeconds: 120
          timeoutSeconds: 1
         env:
         - name: HOSTNAME
           valueFrom:
             fieldRef:
               fieldPath: status.podIP
        volumes:
        - name: nfs
          nfs:
            server: singlefs-1-vm
            path: /data
    ---
    apiVersion: v1
    kind: Service
    metadata:
      name: exhibitor
      labels:
        name: exhibitor
    spec:
      ports:
      - port: 2181
        protocol: TCP
        name: zk
      - port: 8181
        protocol: TCP
        name: api
      selector:
        name: exhibitor
    
    In this manifest we’re configuring the NFS volume to be attached on each of the pods and mounted in the folder where Exhibitor expects to find its shared configuration.
  4. Create the artifacts in that manifest with the kubectl CLI
    kubectl apply -f exhibitor.yaml
    
  5. Monitor the pods until they all enter the RUNNING state
    kubectl get pods -w
    
  6. Run the kubectl proxy command so that you can access the Exhibitor REST API for the Zookeeper state:
    kubectl proxy &
    
  7. Query the Exhibitor API using curl, then use jq to format the JSON response to be more human-readable
    export PROXY_URL=http://localhost:8001/api/v1/proxy/
    export EXHIBITOR_URL=${PROXY_URL}namespaces/default/services/exhibitor:8181
    export STATUS_URL=${EXHIBITOR_URL}/exhibitor/v1/cluster/status
    export STATUS=`curl -s $STATUS_URL`
    echo $STATUS | jq '.[] | {hostname: .hostname, leader: .isLeader}'
    
  8. After a few minutes, the cluster state will have settled and elected a stable leader.
You have now completed the tutorial and can use your Exhibitor/Zookeeper cluster just like any other Kubernetes service, by accessing its exposed ports (2181 for Zookeeper and 8181 for Exhibitor) and addressing it via its DNS name, or by using environment variables.

In order to access the Exhibitor web UI, run the kubectl proxy command on a machine with a browser, then visit this page.

To scale up your cluster size, simply edit the exhibitor.yaml file and change the replicas to an odd number greater than 3 (e.g., 5), then run “kubectl apply -f exhibitor.yaml” again. Cause havoc in the cluster by killing pods and nodes in order to see how it responds to failures.


Thank you for reaching out to us. We are happy to receive your opinion and request. If you need advert or sponsored post, We’re excited you’re considering advertising or sponsoring a post on our blog. Your support is what keeps us going. With the current trend, it’s very obvious content marketing is the way to go. Banner advertising and trying to get customers through Google Adwords may get you customers but it has been proven beyond doubt that Content Marketing has more lasting benefits.
We offer majorly two types of advertising:
1. Sponsored Posts: If you are really interested in publishing a sponsored post or a press release, video content, advertorial or any other kind of sponsored post, then you are at the right place.
WHAT KIND OF SPONSORED POSTS DO WE ACCEPT?
Generally, a sponsored post can be any of the following:
Press release
Advertorial
Video content
Article
Interview
This kind of post is usually written to promote you or your business. However, we do prefer posts that naturally flow with the site’s general content. This means we can also promote artists, songs, cosmetic products and things that you love of all products or services.
DURATION & BONUSES
Every sponsored article will remain live on the site as long as this website exists. The duration is indefinite! Again, we will share your post on our social media channels and our email subscribers too will get to read your article. You’re exposing your article to our: Twitter followers, Facebook fans and other social networks.

We will also try as much as possible to optimize your post for search engines as well.

Submission of Materials : Sponsored post should be well written in English language and all materials must be delivered via electronic medium. All sponsored posts must be delivered via electronic version, either on disk or e-mail on Microsoft Word unless otherwise noted.
PRICING
The price largely depends on if you’re writing the content or we’re to do that. But if your are writing the content, it is $60 per article.

2. Banner Advertising: We also offer banner advertising in various sizes and of course, our prices are flexible. you may choose to for the weekly rate or simply buy your desired number of impressions.

Technical Details And Pricing
Banner Size 300 X 250 pixels : Appears on the home page and below all pages on the site.
Banner Size 728 X 90 pixels: Appears on the top right Corner of the homepage and all pages on the site.
Large rectangle Banner Size (336x280) : Appears on the home page and below all pages on the site.
Small square (200x200) : Appears on the right side of the home page and all pages on the site.
Half page (300x600) : Appears on the right side of the home page and all pages on the site.
Portrait (300x1050) : Appears on the right side of the home page and all pages on the site.
Billboard (970x250) : Appears on the home page.

Submission of Materials : Banner ads can be in jpeg, jpg and gif format. All materials must be deliverd via electronic medium. All ads must be delivered via electronic version, either on disk or e-mail in the ordered pixel dimensions unless otherwise noted.
For advertising offers, send an email with your name,company, website, country and advert or sponsored post you want to appear on our website to omodjk(at)gmail(dot)com

Normally, we should respond within 48 hours.

Previous Post Next Post

Ad — After Posts / Before Footer

                     Copyright Notice

All rights reserved. This material, and other digital contents on this website, may not be reproduced, published, rewritten or redistributed in whole or in part without prior express written permission from Alexa News Network Limited (Alexa.ng). 

نموذج الاتصال