Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md

README.md

Set up your own zeppelin server

There are two options to setup your own zeppelin server. You can use the official docker image, or you can download the binaries and run the server on your host machine.

Use the official docker image

Make sure that docker is installed in your local machine.

Open a terminal and create a directory for your work.

In the directory you jsut created, create a file named 'Dockerfile' and add the following:

FROM apache/zeppelin:0.8.1

RUN pip install pandas pyjwt

Now run the following command from the command line:

docker build -t zep-img .
docker run -p 8080:8080 --name zep zep-img

Once the container is running, navigate to 'localhost:8080' in your browser.

If you have trouble accessing localhost:8080 in the browser, please clear browser cache.

Run on host machine

Download the zeppelin binaries from http://zeppelin.apache.org/download.html

Untar the file and navigate into the directory.

tar -zxvf zeppelin-0.8.1-bin-all

cd zeppelin-0.8.1-bin-all

Start the zeppelin server from the command line.

Unix:

bin/zeppelin-daemon.sh start

Windows:

bin\zeppelin.cmd

Stop the zeppelin server:

Unix:

bin/zeppelin-daemon.sh stop

More documentation can be found at http://zeppelin.apache.org

Example python code to execute a query against Uptycs database from a Zeppelin notebook

Create a new notebook with Python set as the interpreter. Copy the following into the notebook, replacing the values for the global variables with values found in your api key file which can be downloaded form the Uptycs UI in the Configuration->Users section.

import jwt
import datetime
import requests
import pandas as pd

#Set the following global variables from api key file generated in Uptycs UI
KEY = <key found in api file>
SECRET = <secret found in api file>
DOMAIN = <domain found in api file>
CUSTOMER_ID = <customer id found in api file>

def generateHeaders(key, secret):
  #Generate http request headers
  header={}
  utcnow=datetime.datetime.utcnow()
  date=utcnow.strftime("%a, %d %b %Y %H:%M:%S GMT")
  authVar = jwt.encode({'iss':key},secret).decode('utf-8')
  authorization="Bearer %s" % (authVar)

  header['date']=date
  header['authorization']=authorization
  return header

def executeQuery(query):
  #Execute query against Uptycs database
  header=generateHeaders(KEY, SECRET)
  url='https://%s.uptycs.io/public/api/customers/%s/query' % (DOMAIN,CUSTOMER_ID)
  post_data = {'query':query}
  response = requests.post(url, headers=header, json=post_data, verify=False )
 
  ret_data = pd.DataFrame(response.json().get('items'))
 
  return ret_data

Example usage

data = executeQuery('SELECT * FROM processes LIMIT 10')
z.show(data)
You can’t perform that action at this time.