gsutil 挂载工具

挂载方式使用

gcs-fuse

github-gcsfuse

1.安装Cloud Storage FUSE

export GCSFUSE_REPO=gcsfuse-`lsb_release -c -s`
echo "deb http://packages.cloud.google.com/apt $GCSFUSE_REPO main" | sudo tee /etc/apt/sources.list.d/gcsfuse.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo apt-get update
sudo apt-get install gcsfuse
sudo usermod -a -G fuse $USER
gcsfuse --key-file="{keyfile path}" {bucket name} /{mount path}

2.设置验证的json文件.(GCS.json文件)

可以多种方式设置认证

3.本地创建一个目录

$ mkdir /path/to/mount

4.创建一个bucket

if it doesn't already exist, using the Google Cloud Console.

5.使用 Cloud Storage FUSE 来挂载 bucket (e.g. example-bucket).

$ gcsfuse --key-file="{keyfile path}/GCS.json" example-bucket /path/to/mount

6.开始使用挂载的目录

$ ls /path/to/mount

注意:在china使用需要开代理才能使用,但是经过测试开启debug可以测试用

$ gcsfuse --foreground  --debug_fuse --debug_gcs --debug_invariants --debug_http --key-file="/home/vidaxl/google/user.json" selling-products /home/vidaxl/google/export

取消挂载

fusermount -u /path/to/mount

Last updated

Was this helpful?