python_note
  • Introduction
  • My Python
    • Anaconda
    • argparse
    • datetime
    • json
    • logging
    • numpy
    • open
    • openCC
    • pandas & csv
    • Socket & SocketServer
    • re
    • yaml
    • smtp
    • 物件操作
    • unittest
    • 線程
    • prettytable
    • IO
    • pycurl
    • sys
    • pickle
    • auto-python-to-exe
    • cython
    • nuitka
  • Crawler
    • Urllib & Requests
      • User-agent
      • Percent-Encoding
      • mail code
    • Selenium
    • TCP & UDP
    • 控制字符(control character)
  • Web Development
    • Flask
      • RESTful api
      • Template
      • blueprint
    • Django
      • 環境佈署(windows)
    • 檢查Port
    • Apache
    • 使用者行為
    • jQuery
    • 壓力測試
    • DataTable
    • Bootstrap
    • CSS
    • JavaScript
    • Chart.js
  • Deep Learning
    • Keras 設定
    • RNN
    • LSTM
  • Test
    • T-Test
  • 資料結構
    • Hash
    • 時間複雜度
  • NLP
    • N-gram
    • CKIP
    • 中文轉數字
    • CRF
    • Mutual Information
    • 模糊比對
  • Linebot
    • Heroku
    • 圖文選單
    • channel
  • Linux
    • 常用指令
    • shell script
    • sshfs
    • ssh
    • nodejs & npm
    • debug
  • GCP
    • app engine
    • ssh(gcp)
    • gsutil
    • brabrabra
    • Load Balancer
    • k8s
  • Database
    • mysql
    • elasticsearch
      • Query
      • Backup and Restore
      • elasticdump
      • es2csv
      • ELK
    • mongodb
      • install
      • authentication
      • pymongo
    • sql server
  • go
    • Swarm
  • Docker
    • Kitematic
    • Dockerfile
    • Swarm
  • Git
  • 其他
    • USB軟體保護
    • Windows效能監視器
  • Blockchain
Powered by GitBook
On this page
  • 從storage下載檔案
  • 上傳檔案至storage
  • 403 insufficient permission
  • vm與storage之間的資料夾傳輸
  • 指用指令操作vm

Was this helpful?

  1. GCP

gsutil

Previousssh(gcp)Nextbrabrabra

Last updated 5 years ago

Was this helpful?

從storage下載檔案

sudo gsutil -m cp gs://[storage路徑] [下載存放位置]

上傳檔案至storage

sudo gsutil cp [file] gs://[storage路徑]

# 如果要上傳資料夾,請加上 -r 參數

參考連結:

403 insufficient permission

表示執行命令的VM可能沒有讀寫storage的權限

  1. 先關閉VM並開啟編輯,直接將Cloud API 存取權範圍設定為允許所有 Cloud API 的完整存取權;或者只更改storage的權限設定

  2. 打開防火牆

參考連結:

vm與storage之間的資料夾傳輸

下列指令會將資料從 data 值區與所有子目錄複製到 /mnt/filer 目錄。
gsutil rsync -r gs://data /mnt/filer

下列指令會將資料從 /mnt/filer 目錄與所有子目錄複製到 archive 值區。
gsutil rsync -r /mnt/filer gs://archive

指用指令操作vm

# 建立
gcloud compute instances create (VM名稱) 
--zone (區域) 
--image-project (image建立者) 
--image (image名稱) 
--tags (設定網路標記) 
--custom-cpu (數字, 設定cpu) 
--custom-memory (數字, 設定記憶體) 
--boot-disk-size (數字, 設定開機硬碟容量:容量沒給單位預設是 GB) 
--boot-disk-type (硬碟類型, 設定開機硬碟類型)
--boot-disk-device-name=(名稱)
--create-disk size=(數字單位),type=(硬碟類型),name=(名稱)   (設定掛載其他硬碟:容量沒給單位預設是 GB)
--no-boot-disk-auto-delete  (設定刪除 VM 開機硬碟會保留,預設是會刪除開機硬碟)
--service-account (服務帳戶)

--accelerator=type=(名稱),count=(數字)  (使用gpu加速器)
--labels=[KEY=VALUE]  (只能有小寫英文數字-_)
--description=[字串]  (vm簡述)
--machine-type=[字串]  (gcp的套裝機器類型,n1-highmem-16= cpu*16 + 104gb ram)
--maintenance-policy=[TERMINATE/MIGRATE]  (在主機維護期間Compute Engine 可以在執行定期基礎架構維護作業期間,將您的 VM 執行個體遷移至其他硬體,而不會發生服務中斷的情況。)
--scopes=[服務別名]  (加載gcp相關服務,如:default,sql-admin,storage-rw,useraccounts-rw)
# 停止 (建議額外指定zone與project)
yes |  gcloud compute instances stop training-363-2019-12-27-17-46-32 --project ai-clerk-platform --zone asia-east1-b

https://coder.tw/?p=6981
http://ps.hsuweni.idv.tw/?p=4751
https://cloud.google.com/filestore/docs/copying-data?hl=zh-tw
https://snoopy30485.github.io/2018/06/19/GCP-GoogleCloudPlatform-creat-vm-%E6%8C%87%E4%BB%A4/#%E8%A8%AD%E5%AE%9A%E8%A8%98%E6%86%B6%E9%AB%94%E8%B7%9F-cpu
https://cloud.google.com/sdk/gcloud/reference/compute/instances/create#--accelerator
https://blog.taiker.space/gcp/