在云中使用 IPython Notebook 开展出色的数据科学研究(1)
 
- UID
- 1066743
|

在云中使用 IPython Notebook 开展出色的数据科学研究(1)
通过将 IPython Notebook 服务器部署到 SoftLayer,可以克服这些限制。在本教程中,您将:
- 配备一个 SoftLayer 虚拟机 (VM),该虚拟机上包含 (一个应用程序容器引擎)。
- 从 获取一个官方的 IPython 存储库,并在一个容器中运行 IPython Notebook 服务器。
- 随后上传并使用一个示例 Notebook,用该 Notebook分析来自 (美国政府的开放数据站点)的航空公司正点情况数据。

需要做的准备工作- 一个 SoftLayer 帐户。您可以获得一个免费使用 30 天的 。
“创建 SoftLayer VM 实例的命令接受少量的参数,您可以从本示例将这些参数复制并粘贴到您自己的终端中。”
第 1 步. 启动一个 SoftLayer VM首先配备一个带有 Docker 的 SoftLayer VM。可以通过两种方式完成这项任务。如果喜欢使用命令行,而且已经安装了 Python,那么可以使用 订购一个 VM。如果在图形环境中工作,那么您还可以在 Web 浏览器中使用 订购一个 VM。
这里将描述命令行方法。有关通过门户订购的操作说明,请参阅这篇 中的 “配备 VM” 一节。
要从命令行启动 VM,可以使用 中列出的某种受支持的方法来安装 SoftLayer CLI。例如,如果安装了 pip 并且拥有本地 PC 上的根用户访问权,那么可以运行以下代码:
sudo pip install SoftLayer
接下来,通过输入 sl config setup 并回答提示来为 CLI 配置您的凭据:
sl config setup
Username: parente
API Key or Password:******
Endpoint (public|private|custom): public
您的凭据会保留在本地的 ~/.softlayer 中。
现在,输入 ssh-keygen -t rsa 并回答所有提示来创建一个 SSH 密钥对。使用名称 dw-ipy 将该密钥保存在 ~/.ssh 文件夹中:
ssh-keygen -t rsa
Generating public/private rsa key pair.
# Enter file in which to save the key (/Users/parente/.ssh/id_rsa):/Users/parente/.ssh/dw-ipy
Enter passphrase (empty for no passphrase):******
# Enter same passphrase again:******
# Your identification has been saved in /Users/parente/.ssh/dw-ipy.
# Your public key has been saved in /Users/parente/.ssh/dw-ipy.pub.
# The key fingerprint is:
86:f4:c8:84:2f:15:52:74:b4:25:79:49:75:0e:9f:30 parente@localhost.local
将公钥存储在您 SoftLayer 帐户中的标签 dw-ipy 下:
sl sshkey add dw-ipy -f ~/.ssh/dw-ipy.pub
SSH key added:86:f4:c8:84:2f:15:52:74:b4:25:79:49:75:0e:9f:30
现在创建您的 VM 实例。创建命令会接受少量的参数,您可以从本例中将这些参数复制并粘贴到您自己的终端中:
sl vs create --hostname=ipython --domain=dw.ibm.com --key=dw-ipy --cpu=1 --memory=1024 --os=UBUNTU_14_64 --hourly --d sea01 --postinstall=https://bit.ly/1l2xaWE --wait=600
在命令参数中:
- --hostname 和 --domain 是您的 VM 的人类可读的标识符。它们与真正的 DNS 条目没有映射关系。您可以将它们设置为想要的任何值。
- --key 必须是您分配给之前存储的 SSH 公钥的标签。
- --cpu 和 --memory 规定了分配给您的 VM 的资源。
- --os=UBUNTU_14_64 将 Ubuntu LTS 14.04 安装在您的 VM 实例上。
- --hourly 指示该 VM 应每小时(而不是每月)结算一次。
- --d sea01 规定该 VM 应在西雅图数据中心中创建。(您可以运行 sl vs create-options 获得离您最近的数据中心列表。)
- --postinstall 指向一段简单的 hash 脚本,该脚本使用 apt-get 安装来自 Docker, Inc 的最新 Docker 版本。(当然,在信任该脚本之前,应该检查它的内容。)
- --wait 组织该命令指定的秒数,然后再返回。
命令返回时,会打印 VM 的 ID 及其准备状态:
:.........:......................................:
: name : value :
:.........:......................................:
: id : 6229756 :
: created : 2014-09-17T21:04:38-05:00 :
: guid : 506e3de8-6b86-47cc-8830-17e27141424c :
: ready : True :
:.........:......................................:
查询该 VM,确保已准备好此 VM,并获得用于连接它的公共 IP 地址:
sl vs detail VM ID
例如:
sl vs detail 6229756
: ...................:...............................:
: Name : Value :
:....................:...............................:
: id : 6229756 :
: hostname : ipython.dw.ibm.com :
: status : Active :
: active_transaction : - :
: state : Running :
: datacenter : sea01 :
: os : Ubuntu :
: os_version : 14.04-64 Minimal for VSI :
: cores : 1 :
: memory : 1G :
: public_ip : 50.23.141.114 :
: private_ip : 10.28.164.13 :
: private_only : False :
: private_cpu : False :
: created : 2014-09-17T21:04:38-05:00 :
: modified : 2014-09-17T21:6:23-05:00 :
: vlans : :.........:........:........: :
: : : type : number : id : :
: : :.........:........:........: :
: : : PUBLIC : 782 : 605768 : :
: : : PRIVATE : 961 : 605770 : :
: : :.........:........:........: :
:....................:...............................: |
|
|
|
|
|