Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google cloud platform 在Google Cloud dataproc中使用非默认服务帐户_Google Cloud Platform_Google Cloud Dataproc - Fatal编程技术网

Google cloud platform 在Google Cloud dataproc中使用非默认服务帐户

Google cloud platform 在Google Cloud dataproc中使用非默认服务帐户,google-cloud-platform,google-cloud-dataproc,Google Cloud Platform,Google Cloud Dataproc,我想创建一个在非默认服务帐户下运行的dataproc集群。以下内容适用于计算实例: gcloud compute instances create instance-1 --machine-type "n1-standard-1" --zone "europe-west1-b" --scopes xxxxxxxx@yyyyyyyy.iam.gserviceaccount.com="https://www.googleapis.com/auth/cloud-platform" gcloud da

我想创建一个在非默认服务帐户下运行的dataproc集群。以下内容适用于计算实例:

gcloud compute instances create instance-1 --machine-type "n1-standard-1" --zone "europe-west1-b" --scopes xxxxxxxx@yyyyyyyy.iam.gserviceaccount.com="https://www.googleapis.com/auth/cloud-platform"
gcloud dataproc clusters create --zone "europe-west1-b" --scopes xxxxxxxx@yyyyyyyy.iam.gserviceaccount.com="https://www.googleapis.com/auth/cloud-platform" testdataproc12345
但在创建dataproc实例时,相同的
--scopes
参数失败:

gcloud compute instances create instance-1 --machine-type "n1-standard-1" --zone "europe-west1-b" --scopes xxxxxxxx@yyyyyyyy.iam.gserviceaccount.com="https://www.googleapis.com/auth/cloud-platform"
gcloud dataproc clusters create --zone "europe-west1-b" --scopes xxxxxxxx@yyyyyyyy.iam.gserviceaccount.com="https://www.googleapis.com/auth/cloud-platform" testdataproc12345
错误:(gcloud.dataproc.clusters.create)无效的服务帐户作用域:'xxxxxxxxx@yyyyyyyy.iam.gserviceaccount.com='


是否可以在非默认服务帐户下运行dataproc?

不幸的是,目前无法使用正常的“作用域和元数据”中介身份验证设置指定自定义服务帐户。然而,这是一个已知的特性请求,因此它应该在未来的Dataproc更新中可用

同时,即使您在使用Dataproc时无法使用默认GCE服务帐户禁用“存储读/写”作用域的存在,您也可以通过keyfiles让Hadoop端使用特定的服务帐户,方法是使用页面下的“创建密钥”选项为您的服务帐户获取JSON密钥文件,然后做两件事:

  • 在群集创建时添加以下属性:

    --properties core:fs.gs.auth.service.account.json.keyfile=/etc/hadoop/conf/my-service-account.json
    
  • 使用init操作将JSON密钥文件复制到节点;请注意,这仍然意味着您的JSON密钥文件必须能够作为读卡器被GCE默认服务帐户访问,并且任何能够访问您的JSON密钥文件的GCS位置的人现在也能够代表该服务帐户行事,因此您仍然需要在必要时确保项目的安全

    #!/bin/bash
    # Save this somewhere as gs://somepath/my-keyfile-setup.sh
    
    gsutil cp gs://path/to/your/json/file/in/gcs/my=service-account.json \
        /etc/hadoop/conf/my-service-account.json
    
    然后应用该初始化操作:

    gcloud dataproc clusters create --initialization-actions gs://somepath/my-keyfile-setup.sh ...