Google Cloud Platform In Practice
  • 簡介
  • 有別於其他Cloud的想法
  • 認識Google Cloud
    • Google Cloud Platform服務介紹
      • GCP從Free Trial開始
      • 開始之前先了解線上的資源
      • Project與Billing Account
      • GCP計算機
      • Google Cloud使用者與角色
      • 透過IAM管理專案資源
      • Service Account
      • Organization Node
    • GCP指令列工具 - gcloud
      • 安裝Google Cloud SDK
      • Google Cloud SDK基本使用說明
      • 認證gcloud指令
      • 在gcloud使用service account認證
      • 查詢zone與region
      • 好用的gcloud指令
  • Google Cloud上的運算服務
    • Compute Engine
      • Compute Engine基本介紹
      • Compute Engine的主機類型選擇
      • Compute Engine硬碟的選擇
      • 動手開一台GCE主機
      • 了解GCE上的auto scale
      • 使用HTTP(S) Load Balancer
      • 使用TCP Load Balancer
      • 為您的HTTP Load Balancer建立自簽SSL憑證
      • 淺談StackDriver的監控服務
        • Cloud Logging
        • Cloud Monitor
      • 進階的GCE操作
        • GCE的Software Raid建置
        • 匯入Amazon主機Image
        • Resize Boot Disk
      • GCE進階導讀
    • App Engine
      • GAE的理念
      • Standard Environment介紹
        • 第一個GAE程式 - 以GAE Java為例
      • Flexible Environment介紹
        • 標準執行環境範例 - 以Node.js為例
        • 客製化執行環境範例 - 以Node.js為例
      • GAE進階導讀
    • Container Engine
      • 建立自己的GKE Cluster
      • 基本操作
      • 使用YAML描述部署
      • 結合NLB與HLB部署
      • GKE進階導讀
  • Google Cloud上的儲存服務
    • CloudSQL
      • CloudSQL簡介
      • 建立CloudSQL
      • 連線CloudSQL - 使用Apps Script
    • Cloud Datastore
      • Cloud Datastore簡介
      • Cloud Datastore的基本觀念
      • 簡單的Cloud Datastore範例 - 以Node.js套件為例
    • Cloud Storage
      • Cloud Storage簡介
      • 掛載GCS資料夾
      • 設定Website Bucket
      • 透過HTTP(S) Load Balancer幫GCS加上CDN
      • GCS與GCP服務的整合
      • Cloud Storage進階導讀
    • Cloud Bigtable
      • Cloud BigTable簡介
      • Cloud BigTable與GCP服務的整合
      • Cloud BigTable進階導讀
  • Google Cloud上的大資料處理服務
    • BigQuery
      • BigQuery簡介
      • BigQuery的結構
      • 指令列工具 - bq
      • 載入CSV資料到BigQuery
      • 載入JSON資料到BigQuery
      • 透過 bq 查詢資料
      • BigQuery的省錢祕技
      • BigQuery進階導讀
    • PubSub
      • PubSub簡介
      • PubSub入門
    • Cloud Dataflow
      • Cloud Dataflow簡介
      • 第一個Dataflow Pipeline - 以Java為例
      • Dataflow進階導讀
    • Datalab
      • 啟動您的Datalab
      • 深入了解datalab
      • Datalab進階導讀
    • Cloud Spanner (beta)
      • Spanner簡介
      • Spanner基本操作介紹
      • Spanner進階導讀
  • Google Cloud上的人工智慧服務
    • Cloud Machine Learning Engine
    • Vision API
    • Natual Language API
    • Speech API
    • Video Intelligence API (private beta)
  • 更多GCP學習資源
  • GCP支援服務
Powered by GitBook
On this page
  • 事先準備工作
  • 啟動
  • Datalab Tutorials
  • 停止Datalab
  • 參考
  1. Google Cloud上的大資料處理服務
  2. Datalab

啟動您的Datalab

PreviousDatalabNext深入了解datalab

Last updated 7 years ago

Datalab為Google在大資料家族中針對連結各資料來源進行互動,進一步對資料進行檢視、分析、視覺化呈現的工具,更進一步可以搭配Machine Learning進行更進一步的運算。

事先準備工作

  • 安裝gcloud工具

  • 認證gcloud工具

  • 設定ADC(Application Default Certification)

  • 設定預設的zone與project id

gcloud的詳細設定部分,可以參考前面章節:。

啟動

收先,需要先行安裝gcloud component中的datalab的元件,可以透過下面指令來安裝:

gcloud components install datalab

安裝完成後,可以直接在gcloud的環境中直接使用datalab create來建置,如下:

$ datalab create simonlab
Creating the instance simonlab
Created [https://www.googleapis.com/compute/v1/projects/mitac-simonsu-2017/zones/asia-east1-c/instances/simonlab].
Connecting to simonlab.
This will create an SSH tunnel and may prompt you to create an rsa key pair.
Waiting for Datalab to be reachable at http://localhost:8081/

The connection to Datalab is now open and will remain until this command is killed.
You can connect to Datalab at http://localhost:8081/

在建立好後,我們也可以透過list顯示專案中目前有多少的datalab主機可以使用:

$ datalab list
NAME      ZONE          MACHINE_TYPE   PREEMPTIBLE  INTERNAL_IP  EXTERNAL_IP     STATUS
simonlab  asia-east1-c  n1-standard-1               10.140.0.2   123.123.123.123  RUNNING

下面是實際連線上的狀態:

Datalab Tutorials

我們可以透過/datalab/dosc/turtorials來找到許多與GCP Data Source連線的範例,下面是一個BigQuery連線的畫面..

我們可以開啟其中一個範例後,點選其中的一個查詢範例,然後點選最上方的執行按鈕,系統就會開始執行連接BigQuery的查詢動作...

接下來,執行結果會顯示在該段SQL下面...

停止Datalab

最後完成測試後,可以透過點選右上方人頭後出現的"Stop VM"的按鈕,將Datalab停止。

Stop後的VM在GCE的介面中是以"Stopped"的狀態呈現,如果需要再次把它打開,可以試試從GCE介面中將該主機打開,然後透過datalab connect來連線服務...

$ datalab connect simonlab 
Connecting to simonlab.
This will create an SSH tunnel and may prompt you to create an rsa key pair.
Waiting for Datalab to be reachable at http://localhost:8081/

The connection to Datalab is now open and will remain until this command is killed.
You can connect to Datalab at http://localhost:8081/

連線上後,系統會打開瀏覽器,讓您直接連線使用。

如果最後需要刪除這個資源,可以直接使用delete指令將該資源刪除...

$ datalab delete simonlab
Deleting simonlab
The following instances will be deleted. Attached disks configured to
be auto-deleted will be deleted unless they are attached to any other
instances. Deleting a disk is irreversible and any data on the disk
will be lost.
 - [simonlab] in [asia-east1-c]

Do you want to continue (Y/n)?  Y

Deleted [https://www.googleapis.com/compute/v1/projects/mitac-simonsu-2017/zones/asia-east1-c/instances/simonlab].

請注意,刪除的動作將回連同硬碟一起刪除,如果有需要,請先進行備份。

參考

建立過程會需要一些時間... 當一切建立無誤,則系統會搭配reverse proxy將雲端上的8081 port服務串連回本機,讓您可以使用 來連線datalab服務。

啟動Datalab:

Datalab Github:

GCP指令列工具 - gcloud
http://localhost:8081/
https://cloud.google.com/datalab/docs/quickstarts
https://github.com/googledatalab/datalab