026 数据仓库

1、数据仓库

数仓分层:ODS(Operational Data Store)直接存放原始数据,DWD(Data Warehouse Detail)对数据进行清洗 ,DWS(Data Warehouse Service)轻度汇总(存储每天数据的汇总),DWT(Data Warehouse Topic)重度汇总(存储一段时间数据的汇总),DIM维度层(事实表的描述信息,何人、何时、何地,即分析时所站的角度),ADS(Application Data Store)提供报表数据;
在这里插入图片描述
分层原因:简化复杂问题,减少重复开发,隔离原始数据;
几个概念:1)数据集市部门级的,2)数据仓库公司级的,3)数据湖包含各种类型的数据;
一文看懂:什么是数据库、数据湖、数据仓库、湖仓一体、智能湖仓?

2、关系建模与维度建模

三大范式:1NF消除非原子性,2NF消除部分依赖,3NF消除传递依赖,BCNF消除主属性对码的部分依赖。符合3NF要求的数据库设计,基本上解决了数据冗余过大,插入异常,修改异常,删除异常的问题。
详解第一范式、第二范式、第三范式、BCNF范式

关系模型严格遵循第三范式(3NF),数据冗余程度低,数据的一致性容易得到保证。由于数据分布于众多的表中,查询会相对复杂,在大数据的场景下,查询效率相对较低。
维度模型以数据分析作为出发点,不遵循三范式,故数据存在一定的冗余。维度模型面向业务,将业务用事实表和维度表呈现出来。表结构简单,故查询简单,查询效率较高。
雪花模型、星型模型和星座模型

在DWD层,以业务过程为建模驱动,基于每个具体业务过程的特点,构建最细粒度的明细层事实表。DWS层、DWT层和ADS层都是以需求为驱动,和维度建模已经没有关系了。事实表可做适当的宽表化处理。ADS层对特定系统各大主题指标分别进行分析。

Hive on Spark大体与Spark on Hive结构类似,只是SQL引擎(SQL的解析优化)不同,但是计算引擎都是Spark、存储引擎都是Hive!
大数据Hadoop之——Spark on Hive 和 Hive on Spark的区别与实现

Oracle只有一个数据库名,一般对应一个实例(数据库名和实例名不一定相同),但是Oracle的真正应用集群(Real Application Clusters,RAC)有多个实例同时装载并打开一个数据库,允许在集群环境中的多台计算机上操作数据库;使用Oracle_SID来标识一个实例,使用Service_name来标识一个数据库;一个实例下面有多个Schema,一个Schema下面有多张表,Oracle中Schema与User同名、同量。连接Oracle数据库:sqlplus 用户名/密码@ip地址[:端口]/service_name。

MySQL可以配置多个实例(默认情况是一个实例),使用IP:PORT区分不同实例,一个实例下有多个Schema(与Database等效),一个Schema下面有多张表。

在Oracle、MySql中,特定IP:PORT下对应多个Schema,Oracle中Database与Schema是一对多的关系(口语就是,一个IP:PORT对应一个数据库),Mysql中Database与Schema是等效关系(口语就是,一个IP:PORT对应多个数据库)。Oracle中的多个实例通过SID标识(RAC时访问同一份数据,其他情况不一定),MySql中多个实例通过IP:PORT标识(用于主从架构时访问同一份数据,其他情况不一定)


如果系统在非常大的数据集中包含多个索引表,则很难在索引表与原始数据之间保持一致性。可能围绕最终一致性模型设计应用程序。例如,要插入,更新或删除数据,应用程序可以将消息发布到队列,并让单独的任务执行操作并维护异步引用此数据的索引表。有关实现最终一致性的更多信息,请参阅数据一致性入门
索引表模式
ORACLE索引表学习

数据库实例名是用于和操作系统之间的联系,用于对外部连接时使用。在操作系统中,要取得于数据库之间的联系必须通过实例名。比如:要和某一个数据库Server进行连接,必须通过实例名,只知道数据库名是没用的,与数据库名不同的是,数据库实例名在数据库的安装或者创建之后,是可以被修改的。数据库在安装之后,对应的实例名会被写入到数据库控制参数文件pfile(格式如下代码块)中,可以通过修改这个文件,来修改Oracle数据库的实例名,当然,数据库名是不能修改的!在很多情况下,对于数据库实例名的描述,有些时候使用(instance_name)参数,有些时候使用Oracle_SID参数,这两个都是数据库实例名参数,但是以下是他们的区别:
a、Oracle_SID是操系统环境变量
b、instance_name是Oracle数据库配置文件参数
c、操作系统想要获得数据库实例名必须通过系统环境变量Oracle_SID,而Oracle数据库如果想获得数据库实例名,则可以通过参数文件得到。

db_name="orcl" #(数据库名:不允许修改) 
db_domain=dbcenter.toys.com 
instance_name=orcl #(数据库实例名:可以修改,可以与db_name相同也可不同) 
service_names=orcl.dbcenter.toys.com 
control_file=(............... 
.........

Oracle 数据库名、实例名、Oracle_SID

实例就是一组操作系统进程(或者是一个多线程的进程)以及一些内存。这些进程可以操作数据库;而数据库只是一个文件集合(包括数据文件、临时文件、重做日志文件和控制文件)。在任何时刻,一个实例只能有一组相关的文件(与一个数据库关联)。大多数情况下,反过来也成立:一个数据库上只有一个实例对其进行操作。不过,Oracle的真正应用集群(Real Application Clusters,RAC)是一个例外,这是Oracle提供的一个选项,允许在集群环境中的多台计算机上操作,这样就可以有多台实例同时装载并打开一个数据库(位于一组共享物理磁盘上)。由此,我们可以同时从多台不同的计算机访问这个数据库。Oracle RAC能支持高度可用的系统,可用于构建可扩缩性极好的解决方案。
15.Oracle的用户、Schema、数据库、表空间、数据文件的相互关系

在8i以前,使用SID来表示标识数据库的一个实例,但是在Oracle的并行环境中,一个数据库对应多个实例,这样就需要多个网络服务名,设置繁琐。为了方便并行环境中的设置,引进了Service_name参数,该参数对应一个数据库,而不是一个实例。一句话来说就是:SID是对内的,是实例级别的一个名字,用来内部之间称呼用。SERVICE_name是对外的,是数据库级别的一个名字,用来告诉外面的人,我数据库叫"SERVICE_NAME"。
Oracle 服务名/实例名,Service_name 和Sid的区别

不用进行网络配置,其实就是tnsname.ora文件,但只支持oracle10G以上。
命令:sqlplus 用户名/密码@ip地址[:端口]/service_name [as sysdba]
示例:sqlplus sys/pwd@ip:1521/test as sysdba (注意这里的test是tnsnames.ora中的SERVICE_NAME,而非其它)
备注:使用默认1521端口时可省略输入
格式一: Oracle JDBC Thin using a ServiceName: 
jdbc:oracle:thin:@//<host>:<port>/<service_name> 
Example: jdbc:oracle:thin:@//192.168.2.1:1521/XE 
注意这里的格式,@后面有//, 这是与使用SID的主要区别。 
这种格式是Oracle 推荐的格式,因为对于集群来说,每个节点的SID 是不一样的,
但是SERVICE_NAME 确可以包含所有节点。 
 
格式二: Oracle JDBC Thin using an SID: 
jdbc:oracle:thin:@<host>:<port>:<SID> 
Example: jdbc:oracle:thin:@192.168.2.1:1521:X01A 
Note: 
Support for SID is being phased out. Oracle recommends that users switch over to usingservice names. 
 
格式三:Oracle JDBC Thin using a TNSName: 
jdbc:oracle:thin:@<TNSName> 
Example: jdbc:oracle:thin:@GL 
Note: 
Support for TNSNames was added in the driver release 10.2.0.1``

在关系型数据库中,分三级:database.schema.table。即一个数据库下面可以包含多个schema,一个schema下可以包含多个数据库对象,比如表、存储过程、触发器等。但并非所有数据库都实现了schema这一层,比如mysql直接把schema和database等效了,PostgreSQL、Oracle、SQL server等的schema也含义不太相同。

在Oracle数据库中不能新建一个schema,要想创建一个schema,只能通过创建一个用户的方法解决,在创建一个用户的同时为这个用户创建一个与用户名同名的schem并作为该用户的缺省shcema。即schema的个数同user的个数相同,而且schema名字同user名字一一 对应并且相同。

MySQL实例指的是MySQL进程及其所持有的内存结构,我们对数据的操作实际上是通过MySQL实例来访问物理数据库文件的。在实际生产中,可以用一个IP:PORT组合来表示一个实例。如“192.168.7.101:3307”这个MySQL实例表示在主机上起了一个MySQL服务,它的服务端口是3307。
mysql有实例名这个概念,MySQL的一些概念笔记

mysql中建立一个会话,不是和具体的数据库相连接,而是跟instance建立会话,在一个实体机上可以建立多个instance,通过port来区分实例。而一个实例可以建立多个数据库。即一个会话可以操作一个实例上的多个数据库。MySQL 中 Schema 等价于数据库。
mysql中数据库database、Schema、实例instance、会话session的关系
mysql 多实例配置记录(多配置文件)

3、数仓环境搭建

启动Spark历史服务器

[atguigu@hadoop102 conf]$ hadoop dfs -mkdir /directory
[atguigu@hadoop102 conf]$ start-history-server.sh

启动Spark的thriftserver(Spark对HiveServer2的实现),使用DBeaver连接Hive。Spark Thrift Server本身的Server服务就是一个Driver,直接接收sql执行,也就是所有的session都共享一个Application,因此它能使用的集群资源就和单个Application直接挂钩。
Spark On Yarn的两种模式yarn-cluster和yarn-client深度剖析

[atguigu@hadoop102 hadoop]$ start-thriftserver.sh

hive与hiveserver关系图
在这里插入图片描述
我们要部署Spark这套计算框架,有多种方式,可以部署到一台计算机,也可以是多台(cluster)。我们要去计算数据,就必须要有计算机帮我们计算,当然计算机越多(集群规模越大),我们的计算力就越强。但有时候我们只想在本机做个试验或者小型的计算,因此直接部署在单机上也是可以的。Spark部署方式可以用如下图形展示:
在这里插入图片描述
Spark启动时的master参数以及Spark的部署方式

通过Spark Thrift Server创建Hive表:hive -e,spark-sql -e (Spark通过Spark-SQL使用hive语句,操作hive,底层运行的还是 spark rdd)
Hive中的内部表、外部表、分区表和分桶表
Spark on Hive & Hive on Spark,傻傻分不清楚
Spark SQL 与 Hive 的区别简介【学习笔记】
Hive on Spark配置
hive 的注释(comment) 中文乱码的解决方法(亲测有效)[记得重启hadoop、hive、Spark Thrift Server]

4、数仓实战

In Spark 3.0, SHOW CREATE TABLE table_identifier always returns Spark DDL, even when the given table is a Hive SerDe table. For generating Hive DDL, use SHOW CREATE TABLE table_identifier AS SERDE command instead.
sql-migration-guide
hive的serde解析与应用

增量表:记录更新周期内新增的数据,即在原表中数据的基础上新增本周期内产生的新数据;
全量表:记录更新周期内的全量数据,无论数据是否有变化都需要记录;
拉链表:一种数据存储和处理的技术方式,可以记录数据的历史信息,记录数据从开始一直到当前所有变化的信息。
真正秒懂增量表、全量表和拉链表

Spark为了提高性能会缓存Parquet的元数据信息。当更新了Parquet表时,缓存的元数据信息未更新,导致Spark SQL查询不到新插入的数据作业执行报错,报错信息参考如下:
SQL 错误: Error running query: java.io.FileNotFoundException: File does not exist:
更新hive的metastore信息:Hive 修复分区 MSCK REPAIR TABLE的使用
更新Spark-sql的metastore:REFRESH TABLE刷新表元数据

根据ORC和parquet的要求,一般有如下配合
① ORC格式存储,Snappy压缩
② Parquet格式存储,Lzo压缩
③ Parquet格式存储,Snappy压缩
在实际生产中,使用Parquet存储,lzo压缩的方式更为常见,这种情况下可以避免由于读取不可分割大文件引发的数据倾斜(实际上能不能切片是看文件格式的,parquet本身支持切片采用lzo只是它的内部在进行压缩,切片只看文件格式,parquet支持切片所以没问题的)。 但是,如果数据量并不大(预测不会有超大文件,若干G以上)的情况下,使用ORC存储,snappy压缩的效率还是非常高的。
Hive数仓建表该选用ORC还是Parquet,压缩选LZO还是Snappy?

LZO是一个适合实时解压、压缩的压缩库,LZOP基于LZO库的压缩解压工具,有了压缩解压库LZO,还不能直接操作文件压缩解压,需要LZOP;LZOP输出后缀文件就是.lzo,而且LZOP支持通过DistributedLzoIndexer生成index切片索引,而LZO本身是不支持索引的。
关于lzop和lzo区别,以及lzop文件格式和parquet文件格式加lzo压缩区别

lateral view UDTF(expression) tableAliasName as colAliasName
其中UDTF(expression)表示行转列的生成函数,即一行变为多行的函数,比如explode,当然也可以通过UDF自定义函数把一行转为多行,或者UDF返回Array再通过explode炸成多行。
Hive中explode和lateral view组合的用法

解决:FAILED: SemanticException [Error 10096]: Dynamic partition strict mode requires at least one static partition column. To turn this off set hive.exec.dynamic.partition.mode=nonstrict
因为要做动态分区, 所以要先设定partition参数,由于default是false, 需要额外下指令打开这个开关,default是strick, 表示不允许动态分区, 所以要改成nostrick
解决方法:
set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode=nostrick;
Hive动态分区

5、数仓表的设计

数仓建模—宽表的设计

附录

PS:针对Spark on Hive(Spark Thrift Server)的一些配置

[atguigu@hadoop102 conf]$ cat /opt/module/spark-3.0.0-bin-hadoop3.2/conf/hive-site.xml 
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
    <!-- 修改Hive的计算引擎 -->
    <property>
        <name>hive.execution.engine</name>
        <value>tez</value>
    </property>
    <property>
        <name>hive.tez.container.size</name>
        <value>1024</value>
    </property>

    <!-- hive窗口打印默认库和表头 -->
    <property>
        <name>hive.cli.print.header</name>
        <value>true</value>
    </property>
    <property>
        <name>hive.cli.print.current.db</name>
        <value>true</value>
    </property>

    <!-- 指定hiveserver2连接的host -->
    <property>
        <name>hive.server2.thrift.bind.host</name>
        <value>hadoop102</value>
    </property>

    <!-- 指定hiveserver2连接的端口号 -->
    <property>
        <name>hive.server2.thrift.port</name>
        <value>10000</value>
    </property>

    <!-- jdbc连接的URL -->
    <property>
        <name>javax.jdo.option.ConnectionURL</name>
        <value>jdbc:mysql://hadoop102:3306/metastore?useSSL=false</value>
    </property>

    <!-- jdbc连接的Driver-->
    <property>
        <name>javax.jdo.option.ConnectionDriverName</name>
        <value>com.mysql.jdbc.Driver</value>
    </property>

    <!-- jdbc连接的username-->
    <property>
        <name>javax.jdo.option.ConnectionUserName</name>
        <value>root</value>
    </property>

    <!-- jdbc连接的password -->
    <property>
        <name>javax.jdo.option.ConnectionPassword</name>
        <value>root</value>
    </property>

    <!-- Hive默认在HDFS的工作目录 -->
    <property>
        <name>hive.metastore.warehouse.dir</name>
        <value>/user/hive/warehouse</value>
    </property>
    
   <!-- Hive元数据存储的验证 -->
    <property>
        <name>hive.metastore.schema.verification</name>
        <value>false</value>
    </property>
   
    <!-- 元数据存储授权  -->
    <property>
        <name>hive.metastore.event.db.notification.api.auth</name>
        <value>false</value>
    </property>
  
    <!-- 开启动态分区 -->
    <property>
    	<name>hive.exec.dynamic.partition.mode</name>
    	<value>nonstrict</value>
    </property>

</configuration>
[atguigu@hadoop102 conf]$ cat /opt/module/spark-3.0.0-bin-hadoop3.2/conf/spark-defaults.conf 
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# Default system properties included when running spark-submit.
# This is useful for setting default environmental settings.

# Example:
# spark.master                     spark://master:7077
#是否记录Spark任务日志
spark.eventLog.enabled           true
#Spark任务日志的存储路径
spark.eventLog.dir               hdfs://hadoop102:9820/directory
# spark.serializer                 org.apache.spark.serializer.KryoSerializer
# spark.driver.memory              5g
# spark.executor.extraJavaOptions  -XX:+PrintGCDetails -Dkey=value -Dnumbers="one two three"
#Spark历史服务器地址
spark.yarn.historyServer.address=hadoop102:18080
spark.history.ui.port=18080
#------------------------------------
#指定Spark master为yarn
spark.master=yarn
#Spark历史服务器读取历史任务日志的路径
spark.history.fs.logDirectory=hdfs://hadoop102:9820/directory
#开启Spark-sql自适应优化
spark.sql.adaptive.enabled=true
#开启Spark-sql中Reduce阶段分区数自适应
spark.sql.adaptive.coalescePartitions.enabled=true
#使用Hive提供的Parquet文件的序列化和反序列化工具,以兼容Hive
spark.sql.hive.convertMetastoreParquet=false
#使用老版的Parquet文件格式,以兼容Hive
spark.sql.parquet.writeLegacyFormat=true
#解决SPARK-21725问题
spark.hadoop.fs.hdfs.impl.disable.cache=true
#降低Spark-sql中类型检查级别,兼容Hive
spark.sql.storeAssignmentPolicy=LEGACY
[atguigu@hadoop102 conf]$ cat /opt/module/hadoop-3.1.3/etc/hadoop/capacity-scheduler.xml 
<!--
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License. See accompanying LICENSE file.
-->
<configuration>

  <property>
    <name>yarn.scheduler.capacity.maximum-applications</name>
    <value>10000</value>
    <description>
      Maximum number of applications that can be pending and running.
    </description>
  </property>

  <property>
    <name>yarn.scheduler.capacity.maximum-am-resource-percent</name>
    <!-- 学习环境调大Application Master可以获得的最大资源百分比,生产使用默认的0.1就可以 -->
    <value>0.8</value>
    <description>
      Maximum percent of resources in the cluster which can be used to run 
      application masters i.e. controls number of concurrent running
      applications.
    </description>
  </property>

  <property>
    <name>yarn.scheduler.capacity.resource-calculator</name>
    <value>org.apache.hadoop.yarn.util.resource.DefaultResourceCalculator</value>
    <description>
      The ResourceCalculator implementation to be used to compare 
      Resources in the scheduler.
      The default i.e. DefaultResourceCalculator only uses Memory while
      DominantResourceCalculator uses dominant-resource to compare 
      multi-dimensional resources such as Memory, CPU etc.
    </description>
  </property>
  
  <!-- 指定hive队列的资源额定容量 -->
<property>
    <name>yarn.scheduler.capacity.root.hive.capacity</name>
    <value>50</value>
</property>
<!-- 指定队列中,用户提交job占用集群资源的百分比-->
<property>
    <name>yarn.scheduler.capacity.root.hive.user-limit-factor</name>
    <value>2</value>
</property>
<!-- 指定hive队列的资源最大容量 -->
<property>
    <name>yarn.scheduler.capacity.root.hive.maximum-capacity</name>
    <value>100</value>
</property>
<!--指定队列的工作状态-->
<property>
    <name>yarn.scheduler.capacity.root.hive.state</name>
    <value>RUNNING</value>
</property>
<!--访问权限,设定那些用户可以提交应用,*表示所有用户-->
<property>
    <name>yarn.scheduler.capacity.root.hive.acl_submit_applications</name>
    <value>*</value>
</property>
<!--访问权限,设定那些用户是管理者,*表示所有用户-->
<property>
    <name>yarn.scheduler.capacity.root.hive.acl_administer_queue</name>
    <value>*</value>
</property>
<!--访问权限,设定那些用户有优先,*表示所有用户平等-->
<property>
    <name>yarn.scheduler.capacity.root.hive.acl_application_max_priority</name>
    <value>*</value>
</property>
<!--访问权限,设定job的最大存活时间,-1表示没有限定-->
<property>
    <name>yarn.scheduler.capacity.root.hive.maximum-application-lifetime</name>
    <value>-1</value>
</property>
<!--访问权限,设定job的默认存活时间,-1表示没有限定-->
<property>
    <name>yarn.scheduler.capacity.root.hive.default-application-lifetime</name>
    <value>-1</value>
</property>

  <property>
    <name>yarn.scheduler.capacity.root.queues</name>
    <value>default,hive</value>
    <description>
      The queues at the this level (root is the root queue).
    </description>
  </property>

  <property>
    <name>yarn.scheduler.capacity.root.default.capacity</name>
    <value>50</value>
    <description>Default queue target capacity.</description>
  </property>

  <property>
    <name>yarn.scheduler.capacity.root.default.user-limit-factor</name>
    <value>1</value>
    <description>
      Default queue user limit a percentage from 0.0 to 1.0.
    </description>
  </property>

  <property>
    <name>yarn.scheduler.capacity.root.default.maximum-capacity</name>
    <value>60</value>
    <description>
      The maximum capacity of the default queue. 
    </description>
  </property>

  <property>
    <name>yarn.scheduler.capacity.root.default.state</name>
    <value>RUNNING</value>
    <description>
      The state of the default queue. State can be one of RUNNING or STOPPED.
    </description>
  </property>

  <property>
    <name>yarn.scheduler.capacity.root.default.acl_submit_applications</name>
    <value>*</value>
    <description>
      The ACL of who can submit jobs to the default queue.
    </description>
  </property>

  <property>
    <name>yarn.scheduler.capacity.root.default.acl_administer_queue</name>
    <value>*</value>
    <description>
      The ACL of who can administer jobs on the default queue.
    </description>
  </property>

  <property>
    <name>yarn.scheduler.capacity.root.default.acl_application_max_priority</name>
    <value>*</value>
    <description>
      The ACL of who can submit applications with configured priority.
      For e.g, [user={name} group={name} max_priority={priority} default_priority={priority}]
    </description>
  </property>

   <property>
     <name>yarn.scheduler.capacity.root.default.maximum-application-lifetime
     </name>
     <value>-1</value>
     <description>
        Maximum lifetime of an application which is submitted to a queue
        in seconds. Any value less than or equal to zero will be considered as
        disabled.
        This will be a hard time limit for all applications in this
        queue. If positive value is configured then any application submitted
        to this queue will be killed after exceeds the configured lifetime.
        User can also specify lifetime per application basis in
        application submission context. But user lifetime will be
        overridden if it exceeds queue maximum lifetime. It is point-in-time
        configuration.
        Note : Configuring too low value will result in killing application
        sooner. This feature is applicable only for leaf queue.
     </description>
   </property>

   <property>
     <name>yarn.scheduler.capacity.root.default.default-application-lifetime
     </name>
     <value>-1</value>
     <description>
        Default lifetime of an application which is submitted to a queue
        in seconds. Any value less than or equal to zero will be considered as
        disabled.
        If the user has not submitted application with lifetime value then this
        value will be taken. It is point-in-time configuration.
        Note : Default lifetime can't exceed maximum lifetime. This feature is
        applicable only for leaf queue.
     </description>
   </property>

  <property>
    <name>yarn.scheduler.capacity.node-locality-delay</name>
    <value>40</value>
    <description>
      Number of missed scheduling opportunities after which the CapacityScheduler 
      attempts to schedule rack-local containers.
      When setting this parameter, the size of the cluster should be taken into account.
      We use 40 as the default value, which is approximately the number of nodes in one rack.
      Note, if this value is -1, the locality constraint in the container request
      will be ignored, which disables the delay scheduling.
    </description>
  </property>

  <property>
    <name>yarn.scheduler.capacity.rack-locality-additional-delay</name>
    <value>-1</value>
    <description>
      Number of additional missed scheduling opportunities over the node-locality-delay
      ones, after which the CapacityScheduler attempts to schedule off-switch containers,
      instead of rack-local ones.
      Example: with node-locality-delay=40 and rack-locality-delay=20, the scheduler will
      attempt rack-local assignments after 40 missed opportunities, and off-switch assignments
      after 40+20=60 missed opportunities.
      When setting this parameter, the size of the cluster should be taken into account.
      We use -1 as the default value, which disables this feature. In this case, the number
      of missed opportunities for assigning off-switch containers is calculated based on
      the number of containers and unique locations specified in the resource request,
      as well as the size of the cluster.
    </description>
  </property>

  <property>
    <name>yarn.scheduler.capacity.queue-mappings</name>
    <value></value>
    <description>
      A list of mappings that will be used to assign jobs to queues
      The syntax for this list is [u|g]:[name]:[queue_name][,next mapping]*
      Typically this list will be used to map users to queues,
      for example, u:%user:%user maps all users to queues with the same name
      as the user.
    </description>
  </property>

  <property>
    <name>yarn.scheduler.capacity.queue-mappings-override.enable</name>
    <value>false</value>
    <description>
      If a queue mapping is present, will it override the value specified
      by the user? This can be used by administrators to place jobs in queues
      that are different than the one specified by the user.
      The default is false.
    </description>
  </property>

  <property>
    <name>yarn.scheduler.capacity.per-node-heartbeat.maximum-offswitch-assignments</name>
    <value>1</value>
    <description>
      Controls the number of OFF_SWITCH assignments allowed
      during a node's heartbeat. Increasing this value can improve
      scheduling rate for OFF_SWITCH containers. Lower values reduce
      "clumping" of applications on particular nodes. The default is 1.
      Legal values are 1-MAX_INT. This config is refreshable.
    </description>
  </property>


  <property>
    <name>yarn.scheduler.capacity.application.fail-fast</name>
    <value>false</value>
    <description>
      Whether RM should fail during recovery if previous applications'
      queue is no longer valid.
    </description>
  </property>

</configuration>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值