在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:aerospike-examples/interactive-notebooks开源软件地址:https://github.com/aerospike-examples/interactive-notebooks开源编程语言:Jupyter Notebook 96.6%开源软件介绍:This repository contains the build information for the Docker Image used at https://hub.docker.com/r/aerospike/intro-notebooks. Aerospike Interactive NotebooksAerospike is a distributed database designed to serve global applications with low latency, fast throughput, and resilience to failure. The Docker Image in this repo contains a complete Aerospike development environment and two categories of Jupyter Notebooks:
Useful links:
Documentation for Aerospike is available at https://aerospike.com/docs, and Docker Desktop installation at https://docs.docker.com/desktop/. The download and use of this Aerospike software is governed by Aerospike Evaluation License Agreement. Run Client Notebooks in Docker ContainerNotebooks for Java and Python clients are currently avaialble. Some Spark notebooks can currently run in the container.
Example:
Spark NotebooksSpark notebooks can run on Linux (CentOS) and MacOS X. Some Spark notebooks can fully run in the container by following the specific setup provided in the respective notebook. To run any Spark notebook with an external Spark, Aerospike, and/or Jupyter server, follow the instructions below. Set up Spark Notebooks on Linux (CentOS)yum installer used below - use dbpkg/rpm/other if your Linux distribution does not support yum sudo yum -y install gcc zlib-devel openssl-devel libffi-devel sqlite-devel bzip2-devel bzip2 xz-devel screen wget Get your own local copy of Python 3.7 (ignore if you have it already). Below we install to ~/.localpython PYTHON_VERSION=3.7.1
wget http://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz
tar zxvf Python-${PYTHON_VERSION}.tgz
cd Python-${PYTHON_VERSION}
mkdir ~/.localpython
./configure --prefix=$HOME/.localpython
make
make install Set up a virtual Python environment - this is a sandbox which avoids you making system wide changes # Install virtualenv tool
~/.localpython/bin/pip3 install virtualenv
# Create on-disk representation of virtual environment at ~/spark-venv
~/.localpython/bin/virtualenv ~/spark-venv
# Activate virtual environment
source ~/spark-venv/bin/activate Use of a virtual environment is indicated in the command line string - the name of the virtual environment - spark-env is added to the command line prompt - e.g.,
You can return to the system enviroment by typing Get rid of annoying messages concerning pip upgrade
Note at this point, all our Python related tooling is local to our virtual environment. So
Install required Python dependencies
If you plan on using scala in your workbooks you need to install the spylon kernel - some care is needed with Python versioning
Install Spark and set SPARK_VERSION=2.4.7
HADOOP_VERSION=2.7
cd /tmp
wget https://downloads.apache.org/spark/spark-${SPARK_VERSION}/spark-${SPARK_VERSION}-bin-hadoop${HADOOP_VERSION}.tgz
tar xvfz spark-${SPARK_VERSION}-bin-hadoop${HADOOP_VERSION}.tgz
sudo mv spark-${SPARK_VERSION}-bin-hadoop${HADOOP_VERSION} /opt/
export SPARK_HOME=/opt/spark-${SPARK_VERSION}-bin-hadoop${HADOOP_VERSION}
export PYTHONPATH=$SPARK_HOME/python:$PYTHONPATH
cd ~ Use of the Aerospike Spark Connector requires a valid feature key. The notebooks assume this is located at sudo mkdir /etc/aerospike
sudo chmod 777 /etc/aerospike Make sure you have the interactive-notebooks repository locally.
Finally start Jupyter. Change the IP in the string below - it can be localhost, but if you want to access from a remote host, choose the IP of one of your ethernet interfaces. You could replace with $(hostname -I | awk '{print $1}') Note I set the notebook-dir to point to the directory containing the notebooks in this repository. You also will need SPARK_HOME and PYTHONPATH set correctly (reproducing the former from the above).
You will see output similar to
You will need to use the URLs in the output to access jupyter - as the security token is expected. You can omit this step by omitting the --no-browser flag - in that case jupyter will open a browser window local to itself, and request the Notebook app URL above. You may wish to run the jupyter startup command from a screen so it will stay running if your session terminates. We installed screen at the outset to allow for this. pyenv / LinuxYou can go down the pyenv route on Linux as per the instructions for Mac. You install pyenv differently
but once done, just pick up the MacOS instructions at Set Up Spark Notebooks on MacOS XThe main challenge is getting a sufficiently up to date version of Python installed and set as your working version. You mustn't mess with your existing version of Python (see xkcd). pyenv is the tool to help with this. First you'll need brew the package manager for macOS. From instructions
Next install pyenv
and finally we can install our required python version. The subsequent 'global' command sets 3.7.3 as our selected version
The command below sets up our path so the required version of Python is used. Once done, do
You can now set up your virtual environment - this is a sandbox which avoids you making system wide changes. Note this is the same as the steps above for Linux, except we don't have to give explicit paths to pip, virtualenv. # Install virtualenv tool
pip install virtualenv
# Create on-disk representation of virtual environment at ~/spark-venv
virtualenv ~/spark-venv
# Activate virtual environment
source ~/spark-venv/bin/activate You can now follow the Linux instructions from
onwards. Software Contents
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论