Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/36.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 storage 将Apache Drill连接到Google云_Google Cloud Storage_Apache Drill - Fatal编程技术网

Google cloud storage 将Apache Drill连接到Google云

Google cloud storage 将Apache Drill连接到Google云,google-cloud-storage,apache-drill,Google Cloud Storage,Apache Drill,如何将google云存储桶连接到Apache Drill。我想将apachedrill连接到googlecloud存储桶,并从这些存储桶中存储的文件中获取数据 我可以在core-site.xml中指定访问id和密钥,以便连接到AWS。有没有类似的方法将drill连接到谷歌云。我发现这里的答案很有用: 在GoogleCloudDataProc上,您可以使用上面的答案中的初始化操作来设置它。还有一个为您创建GCS插件的工具,默认情况下指向使用dataproc集群创建的临时存储桶 如果您没有使用Clo

如何将google云存储桶连接到Apache Drill。我想将apachedrill连接到googlecloud存储桶,并从这些存储桶中存储的文件中获取数据


我可以在core-site.xml中指定访问id和密钥,以便连接到AWS。有没有类似的方法将drill连接到谷歌云。

我发现这里的答案很有用:

在GoogleCloudDataProc上,您可以使用上面的答案中的初始化操作来设置它。还有一个为您创建GCS插件的工具,默认情况下指向使用dataproc集群创建的临时存储桶

如果您没有使用Cloud Dataproc,您可以在已经安装的钻取集群上执行以下操作

从某个地方获取数据并将其放在Drill的第三方jars目录中。地面军事系统配置详见上述链接。在dataproc上,连接器jar位于/usr/lib/hadoop中,因此上面的初始化操作执行以下操作:

# Link GCS connector to drill jars
ln -sf /usr/lib/hadoop/lib/gcs-connector-1.6.0-hadoop2.jar $DRILL_HOME/jars/3rdparty
您还需要配置core-site.xml并使其可用于钻孔。这是必要的,以便演练人员知道如何连接地面军事系统

# Symlink core-site.xml to $DRILL_HOME/conf
ln -sf /etc/hadoop/conf/core-site.xml $DRILL_HOME/conf
根据需要启动或重新启动钻头

一旦演练完成,您可以创建一个指向GCS bucket的新插件。首先写出包含插件配置的JSON文件:

export DATAPROC_BUCKET=gs://your-bucket-name
cat > /tmp/gcs_plugin.json <<EOF
{
    "config": {
        "connection": "$DATAPROC_BUCKET",
        "enabled": true,
        "formats": {
            "avro": {
                "type": "avro"
            },
            "csv": {
                "delimiter": ",",
                "extensions": [
                    "csv"
                ],
                "type": "text"
            },
            "csvh": {
                "delimiter": ",",
                "extensions": [
                    "csvh"
                ],
                "extractHeader": true,
                "type": "text"
            },
            "json": {
                "extensions": [
                    "json"
                ],
                "type": "json"
            },
            "parquet": {
                "type": "parquet"
            },
            "psv": {
                "delimiter": "|",
                "extensions": [
                    "tbl"
                ],
                "type": "text"
            },
            "sequencefile": {
                "extensions": [
                    "seq"
                ],
                "type": "sequencefile"
            },
            "tsv": {
                "delimiter": "\t",
                "extensions": [
                    "tsv"
                ],
                "type": "text"
            }
        },
        "type": "file",
        "workspaces": {
            "root": {
                "defaultInputFormat": null,
                "location": "/",
                "writable": false
            },
            "tmp": {
                "defaultInputFormat": null,
                "location": "/tmp",
                "writable": true
            }
        }
    },
    "name": "gs"
}
EOF
我相信,如果希望Drill查询多个bucket,则需要重复此过程,更改名称(“上面的gs”)


然后,您可以启动sqlline并检查是否可以查询该存储桶中的文件。

我知道这个问题已经很老了,但是,这里有一种不使用Dataproc的方法

将来自GCP连接器的JAR文件添加到jars/3rdparty目录。 将以下内容添加到conf目录中的site-core.xml文件中(将大写值(如您的\u PROJECT\u ID)更改为您自己的详细信息):


fs.gs.project.id
您的\u项目\u ID
可选。可以访问GCS存储桶的Google云项目ID。
仅列表存储桶和创建存储桶操作需要。
fs.gs.auth.service.account.private.key.id
您的\u私钥\u ID
fs.gs.auth.service.account.private.key
-----开始私钥------\n您的私钥------结束私钥------\n
fs.gs.auth.service.account.email
您的\服务\帐户\电子邮件/价值>
电子邮件地址与用于GCS的服务帐户相关联
当fs.gs.auth.service.account.enable为true时访问。要求的
在配置文件中指定身份验证密钥时(方法1)
或者正在使用PKCS12证书(方法3)。
fs.gs.working.dir
/
默认bucket内部的目录相对gs:uri解析。
fs.gs.implicit.dir.repair.enable
真的
是否为对象的父目录创建对象
在其路径中,例如在删除或删除时创建gs://bucket/foo/
重命名gs://bucket/foo/bar。
fs.gs.glob.flatlist.enable
真的
是否在单个列表中预填充潜在的全局匹配项
请求在嵌套glob情况下最小化对地面军事系统的呼叫。
fs.gs.copy.with.rewrite.enable
真的
是否使用重写请求执行复制操作。允许
在不同位置和存储类之间复制文件。
开始Apache训练

添加自定义存储以进行演练

你可以走了


解决方案来自,我在这里详细介绍了我们使用Apache Drill进行的数据探索。

这个答案和链接的博客文章对我来说很有用,而不需要使用DataProc。在我的例子中,唯一需要注意的是,当我试图指定服务帐户电子邮件和私钥ID和值时,如上所示,我会得到以下错误:
error:SYSTEM error:IOException:Invalid PKCS8 data.
,将GCP提供的JSON文件复制到我的Drill实例,并根据博客对Hadoop连接器repo中指定格式的引用,指定
fs.gs.auth.service.account.JSON.keyfile
,效果非常好。
curl -d@/tmp/gcs_plugin.json \
  -H "Content-Type: application/json" \
  -X POST http://localhost:8047/storage/gs.json
<property>
    <name>fs.gs.project.id</name>
    <value>YOUR_PROJECT_ID</value>
    <description>
      Optional. Google Cloud Project ID with access to GCS buckets.
      Required only for list buckets and create bucket operations.
    </description>
  </property>
  <property>
    <name>fs.gs.auth.service.account.private.key.id</name>
    <value>YOUR_PRIVATE_KEY_ID</value>
  </property>
    <property>
        <name>fs.gs.auth.service.account.private.key</name>
        <value>-----BEGIN PRIVATE KEY-----\nYOUR_PRIVATE_KEY\n-----END PRIVATE KEY-----\n</value>
    </property>
  <property>
    <name>fs.gs.auth.service.account.email</name>
    <value>YOUR_SERVICE_ACCOUNT_EMAIL/value>
    <description>
      The email address is associated with the service account used for GCS
      access when fs.gs.auth.service.account.enable is true. Required
      when authentication key specified in the Configuration file (Method 1)
      or a PKCS12 certificate (Method 3) is being used.
    </description>
  </property>
  <property>
    <name>fs.gs.working.dir</name>
    <value>/</value>
    <description>
      The directory relative gs: uris resolve in inside of the default bucket.
    </description>
  </property>
   <property>
    <name>fs.gs.implicit.dir.repair.enable</name>
    <value>true</value>
    <description>
      Whether or not to create objects for the parent directories of objects
      with / in their path e.g. creating gs://bucket/foo/ upon deleting or
      renaming gs://bucket/foo/bar.
    </description>
  </property>
   <property>
    <name>fs.gs.glob.flatlist.enable</name>
    <value>true</value>
    <description>
      Whether or not to prepopulate potential glob matches in a single list
      request to minimize calls to GCS in nested glob cases.
    </description>
  </property>
   <property>
    <name>fs.gs.copy.with.rewrite.enable</name>
    <value>true</value>
    <description>
      Whether or not to perform copy operation using Rewrite requests. Allows
      to copy files between different locations and storage classes.
    </description>
  </property>