目录:

  • 连接hadoop配置语法
  • 配置hadoop连接
  • Pushdown配置
  • Create external tables for Azure blob storage

连接hadoop配置语法:


global configuration settings for PolyBase Hadoop and Azure blob storage connectivity, Syntax:

  • sp_configure:  List all of the configuration options
  • 配置与hadoop连接语法:
  • sp_configure [ @configname = ] 'hadoop connectivity',
    [ @configvalue = ] { 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 }
    [;] RECONFIGURE
    [;]
    1. Option 0: Disable Hadoop connectivity
    2. Option 1: Hortonworks HDP 1.3 on Windows Server
    3. Option 1: Azure blob storage (WASB[S])
    4. Option 2: Hortonworks HDP 1.3 on Linux
    5. Option 3: Cloudera CDH 4.3 on Linux
    6. Option 4: Hortonworks HDP 2.0 on Windows Server
    7. Option 4: Azure blob storage (WASB[S])
    8. Option 5: Hortonworks HDP 2.0 on Linux
    9. Option 6: Cloudera 5.1, 5.2, 5.3, 5.4, and 5.5 on Linux
    10. Option 7: Hortonworks 2.1, 2.2, and 2.3 on Linux
    11. Option 7: Hortonworks 2.1, 2.2, and 2.3 on Windows Server
    12. Option 7: Azure blob storage (WASB[S])
  • 示例代码:
    1. 显示所有可用的配置列表: EXEC sp_configure;
    2. 显示某个配置项的配置信息:  EXEC sp_configure @configname='hadoop connectivity';
    3. 设置配置项示例语法如下:
    4. sp_configure @configname = 'hadoop connectivity', @configvalue = 7;
      GO RECONFIGURE
      GO

 配置hadoop连接


  • 在本节示例中,连接HDInsight3.2集,对应关系如下:
  • 配置polybase连接配置项信息信息如下:
  • sp_configure @configname = 'hadoop connectivity', @configvalue = 7;
    GO RECONFIGURE
    GO
  • 命令行:  services.msc, 重启下面的服务
    1. SQL Server PolyBase Data Movement Service
    2. SQL Server PolyBase Engine

 Pushdown配置:


  • To improve query performance, enable pushdown computation to a Hadoop cluster
  1. Find the file yarn-site.xml in the installation path of SQL Server. Typically, the path is: C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Binn\Polybase\Hadoop\conf
  2. On the Hadoop machine, find the analogous(类似) file in the Hadoop configuration directory. In the file, find and copy the value of the configuration key yarn.application.classpath
  3. On the SQL Server machine, in the yarn-site.xml file, find the yarn.application.classpath property. Paste the value from the Hadoop machine into the value element.
  4. $HADOOP_CONF_DIR,/usr/hdp/current/hadoop-client/*,/usr/hdp/current/hadoop-client/lib/*,/usr/hdp/current/hadoop-hdfs-client/*,/usr/hdp/current/hadoop-hdfs-client/lib/*,/usr/hdp/current/hadoop-yarn-client/*,/usr/hdp/current/hadoop-yarn-client/lib/*

 Create external tables for Azure blob storage


  • The Elastic(弹性) Database query feature relies on(依靠) the these four DDL statements. Typically, these DDL statements are used once or rarely when the schema of your application changes
    1. [CREATE MASTER KEY]    (https://msdn.microsoft.com/library/ms174382.aspx)
    2. [CREATE CREDENTIAL]    (https://msdn.microsoft.com/library/ms189522.aspx)
    3. [CREATE DATABASE SCOPED CREDENTIAL]   (https://msdn.microsoft.com/library/mt270260.aspx)
    4. [CREATE/DROP EXTERNAL DATA SOURCE]    (https://msdn.microsoft.com/library/dn935022.aspx)
    5. [CREATE/DROP EXTERNAL TABLE]                (https://msdn.microsoft.com/library/dn935021.aspx)
  • You can use the following syntax to drop the master key and credentials
    1. DROP CREDENTIAL <credential_name> ON DATABASE;
    2. DROP DATABASE SCOPED CREDENTIAL <credential_name>;
    3. DROP MASTER KEY;
  • 模拟简单文本数据,如下:
  • 将文本文件上传到 Azure blob storage, 如下图:
  • 远程连接ploybase1, 打开ssms(注:此版本需单独安装),执行脚本如下:
  • CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'Password01!'; 
    
    CREATE DATABASE SCOPED CREDENTIAL JNAzureCredit
    WITH IDENTITY = 'zhushy', Secret = XXXX'; /*存储访问Key*/ CREATE EXTERNAL DATA SOURCE JNAzureStorage with (
    TYPE = HADOOP,
    LOCATION ='wasb://<blob_container_name>@<azure_storage_account_name>.blob.core.chinacloudapi.cn',
    CREDENTIAL = JNAzureCredit
    ); CREATE EXTERNAL FILE FORMAT TextFileFormat WITH (
    FORMAT_TYPE = DELIMITEDTEXT,
    FORMAT_OPTIONS (FIELD_TERMINATOR =' ', USE_TYPE_DEFAULT = TRUE)) CREATE EXTERNAL TABLE [dbo].[hospital] (
    [ID] varchar(128) NULL,
    [name] varchar(128) null
    )
    WITH (LOCATION='/zhu/data1.txt',
    DATA_SOURCE = JNAzureStorage,
    FILE_FORMAT = TextFileFormat
    );
  • 验证数据,输入如下SQL: select * from [dbo].[hospital] ,如下图,则OK

DW(六):polybase访问Azure Blob Storage的更多相关文章

  1. presto访问 Azure blob storage

    当集群使用Azure Blog Storage时,prestoDB无法获取返回结果,在此记录下 如下,hive里面的两个表,一个使用的是本地的hdfs,一个是使用 azure blob storage ...

  2. hadoop(四): 本地 hbase 集群配置 Azure Blob Storage

    基于 HDP2.4安装(五):集群及组件安装 创建的hadoop集群,修改默认配置,将hbase 存储配置为 Azure Blob Storage 目录: 简述 配置 验证 FAQ 简述: hadoo ...

  3. Azure Storage 系列(六)使用Azure Queue Storage

    一,引言 在之前介绍到 Azure Storage 第一篇文章中就有介绍到 Azure Storage 是 Azure 上提供的一项存储服务,Azure 存储包括 对象.文件.磁盘.队列和表存储.这里 ...

  4. Azure Blob Storage 基本用法 -- Azure Storage 之 Blob

    Azure Storage 是微软 Azure 云提供的云端存储解决方案,当前支持的存储类型有 Blob.Queue.File 和 Table. 笔者在<Azure Table storage ...

  5. Azure Blob Storage从入门到精通

    今天推荐的是一个系列文章,让读者阅读完成后可以对Azure Blob Storage的开发有一个全面的了解,可谓是从入门到精通. Azure在最初的版本里面就提供了非结构化数据的存储服务,也即Blob ...

  6. Python 操作 Azure Blob Storage

    笔者在<Azure 基础:Blob Storage>一文中介绍了 Azure Blob Storage 的基本概念,并通过 C# 代码展示了如何进行基本的操作.最近笔者需要在 Linux ...

  7. [AWS vs Azure] 云计算里AWS和Azure的探究(6) - Amazon Simple Storage Service 和 Microsoft Azure Blob Storage

    这几天Nasuni公司出了一份报告,分析了各个云厂商的云存储的性能,包括Amazon S3,Azure Blob Storage, Google Drive, HP以及Rackspace.其中性能上A ...

  8. Azure Functions(二)集成 Azure Blob Storage 存储文件

    一,引言 上一篇文章有介绍到什么是 SeverLess ,ServerLess 都有哪些特点,以及多云环境下 ServerLess 都有哪些解决方案.在这众多解决方案中就包括 Function App ...

  9. [Windows Azure] How to use the Windows Azure Blob Storage Service in .NET

    How to use the Windows Azure Blob Storage Service in .NET version 1.7 version 2.0 This guide will de ...

随机推荐

  1. window8快捷键

    win8中有很多比较重要的快捷键经常忘记: cmd快捷键:win+x; 截图工具:win+q; 添加环境变量:右键点击左下角window图标; 添加定时任务:右键点击计算机管理->任务计划程序.

  2. Ubuntu sudo NOPASSWD设置

    1.首先查看目标用户的信息,包括所属组: ◄► id cason uid=(cason) gid=(cason) (cason),(adm),(cdrom),((dip),(plugdev),(lpa ...

  3. hdu 2334 March of the Penguins

      题意大意 在X,Y坐标系中有N(N<=100)个冰块,有些冰块上有1若干只企鹅,每只企鹅一次最多跳M距离,一个冰块在有Mi个企鹅离开,就会消失,问有哪些冰块可以作为集合点,就是所有企鹅都能成 ...

  4. JQuery中操作Css样式

    //1.获取和设置样式 $("#tow").attr("class")获取ID为tow的class属性 $("#two").attr(&qu ...

  5. Apache Flex + Adobe Flash Builder环境配置

    在开始学习Flex之前,需要配置开发环境.Apache Flex SDK包含了你开发所需要的东西,当然除了集成开发环境(Integrated Development Environment,IDE). ...

  6. 203. Remove Linked List Elements

    Remove all elements from a linked list of integers that have value val. ExampleGiven: 1 --> 2 --& ...

  7. ZOJ 1016 Parencodings

    原题链接 题目大意:有两串数字P和W.数组P中,数字P[i]表示第i个右括号之前的左括号个数.数组W中,数字W[i]表示在第i个右括号和与它匹配的左括号之间的右括号的个数(包括本身).给出一个数组P, ...

  8. urlscan使用详解

    0x01 简介与下载  URLScan是集成在IIS上的,可以制约的HTTP请求的安全工具.通过阻止特定的HTTP请求,URLScan安全工具有助于防止潜在的有害的请求到达服务器上的应用. 最新版UR ...

  9. mave之:java的web项目必须要的三个jar的pom形式

    jsp-api javax.servlet-api jstl <!-- jsp --> <dependency> <groupId>javax.servlet< ...

  10. thinkphp3.2 学习

    http://www.tuicool.com/articles/nQFnQrR 1,sublime text 增强插件 右键可以打开文件目录 http://www.w3cfuns.com/notes/ ...