zimmem
  • Introduction
  • 大数据运维
    • cdh
      • Create Cloudera Manager extensions
      • Create Custom Cloudera Add-on Service
      • Create Custom Repository
      • extjs-dependency-by-oozie.md
      • install-cdh-on-ubuntu-16.md
      • Install Cloudera Manager on CentOS 6
      • Install Cloudera Manager on Ubuntu 16
      • Read/Write hive table when running spark2 by oozie
    • hadoop
      • hdfs.md
      • Resource Configuration
    • hbase
      • README.md
    • hive
      • README.md
    • impala
      • Impala Maintenance Instructions
    • spark
      • cvc.md
      • Spark DataFrame Join
      • Spark Shell
      • Spark Submit
    • Apache Ambari Installation
    • big-data-platform-ops.md
    • hdp.md
  • 区块链
    • hyperledger-fabric
      • img
      • Block Struct
      • 概念
      • 在 kubernetes 上搭建 hyperledger-fabric
  • 数据处理
    • datasets
      • 人脸数据集
    • 降维
      • LDA.md
      • PCA 主成份分析
    • face
      • 人脸关键点检测方法
    • machine-learning
      • gan
        • GAN 学习资料
      • nlp
        • word2vec
      • 机器学习资源
    • 数学知识
      • 统计学
        • 基础知识
        • 交叉熵
        • # 方差与标准差
      • Mathjax Demo
      • 矩阵知识 {matrix}
    • recomand-system
      • 推荐系统相关文章与开源方案
    • tensorflow
      • images
      • dataset
      • 分布式训练
      • Optimizer Compare
      • saved_model
    • 十大数据挖掘数法
      • math
        • 最小二乘法
      • AdaBoost.md
      • Apriori.md
      • 数据挖掘十大经典算法之 C4.5
      • CART.md
      • EM.md
      • k-means.md
      • kNN.md
      • Naive-Baye.md
      • PageRank.md
      • Svm.md
      • top-10-data-mining-algorithm.md
    • 机器学习模型评估
    • Tensorflow Model Serving
  • 数据仓库
    • user-portrait.md
    • Articles
  • 运维开发
    • docker
      • 安装后免 sudo
    • gong-ju
      • install-latest-git-version-on-centos.md
    • linux
      • images
      • iptables
      • network
      • performance-diagnosis.md
      • Shell Syntax
      • SSH with Kerbors5 on Ubuntu
      • wget
    • network
      • install-merlin-on-asus-router.md
    • docker.md
    • Performance diagnosis
    • RabbitMQ
  • 开发语言与框架
    • dubbo
      • README.md
    • java
      • mybatis
      • spring
        • spring-mvc
          • 扩展点
        • 常用扩展
        • Srping MVC
      • How to use G1 garbage collector
      • How to Print GC log
      • spring.md
    • nodejs
      • npm 配置 registry 镜像或代理
    • spring
      • Hive Maintenance Instructions
      • 配置项
      • xxx.md
  • 存储系统
    • mongodb
      • README.md
    • mysql
      • operation
        • 数据导入导出
      • Install Mysql Server by Yum
      • mysql-diff.md
      • Mysql Settings
      • User Management
  • tools
    • Intellij IDEA
  • _book
    • .vscode
    • 大数据运维
      • cdh
      • hadoop
      • hbase
      • hive
      • impala
      • spark
    • 区块链
      • hyperledger-fabric
        • img
    • 数据处理
      • dimension-reduction
      • machine-learning
      • math
        • statistics
      • recomand-system
      • tensorflow
        • images
      • top-10-data-mining-algorithm
        • math
    • 数据仓库
    • 运维开发
      • docker
      • gong-ju
      • linux
        • images
      • network
    • gitbook
      • fonts
        • fontawesome
      • gitbook-plugin-alerts
      • gitbook-plugin-expandable-chapters-interactive
      • gitbook-plugin-fontsettings
      • gitbook-plugin-highlight
      • gitbook-plugin-livereload
      • gitbook-plugin-mathjax
      • gitbook-plugin-search-plus-mod
      • gitbook-plugin-sharing
      • images
    • 开发语言与框架
      • dubbo
      • java
        • spring
          • spring-mvc
      • nodejs
      • spring
    • 存储系统
      • mongodb
      • mysql
        • operation
    • styles
      • README.md
    • Configuration
    • Sandbox
Powered by GitBook
On this page
  • 构建 parcel 包
  • parcel 描述文件 meta/parcel.json
  • 文件列表 meta/filelist.json
  • Defind Script meta/cos_env.json
  • 软链接描述 meta/alternatives.json
  • 构建 parcel 文件
  • 安装 parcel (略)
  • 修改 hdfs配置
  1. 大数据运维
  2. cdh

Create Cloudera Manager extensions

PreviouscdhNextCreate Custom Cloudera Add-on Service

Last updated 6 years ago

success 以支持腾讯云 COS 为例

构建 parcel 包

通过 parcel 机制给 cdh 中的 yarn 添加 cos 支持, 使 yarn 应用能直接访问 cos 上的文件

腾讯云 cos 支持通过 hdfs 访问(), 但公司大数据集群使用 CDH 管理, 直接修改配置虽然可行, 但每台机器都登录上去部署非常繁琐, 且万一下次通过 Clouder Manager 更新配置, 又会把配置覆盖掉, 所以要找出一种方式看能否通过 clouder manager 来做这种增强, 查了CDH 官方资料后发现应该可以通过 pracel 以插件的方式来把 cos-hadoop 部署到集群中。

parcel 文件格式参考, 主要有以下几个文件组成

  • meta/parcel.json

  • meta/filelist.json

  • meta/cos_env.json

  • meta/alternatives.json

  • 其它 lib 文件

parcel 描述文件 meta/parcel.json

格式参考

{
  "schema_version":     1,
  "name":               "HADOOP_COS",
  "version":            "2.7.2.2",
  "extraVersionInfo": {
    "fullVersion":        "2.7.2.2",
    "baseVersion":        "2.7.2.2",
    "patchCount":         ""
  },

  "conflicts":          "CDH (<< 5.13.1), CDH (>> 5.13.1.)",

  "setActiveSymlink":   true,

  "scripts": {
    "defines": "cos_env.sh"
  },

  "packages": [
    { "name":    "cos-hadoop",
      "version": "2.7.2.2"
    }
  ],

  "components": [
    { "name":    "cos-hadoop",
      "version": "2.7.2.2",
      "pkg_version": "2.7.2.2"
    }
  ],

  "provides": [
    "yarn-plugin",
    "mapreduce-plugin",
    "mapreduce2-plugin",
    "spark-plugin",
    "hive-plugin"
  ],

  "users": { },

  "groups": [ ]
}

文件列表 meta/filelist.json

描述插件中每个组件的文件列表

{
   "cos-hadoop" : {
    "name": "cos-hadoop",
    "version": "2.7.2",
    "files" : {
      "jars" : {},
      "jars/cos_api-4.2.jar" : {},
      "jars/hadoop-cos-2.7.2.jar" : {},
      "jars/httpmime-4.2.5.jar" : {},
      "json-20140107.jar" : {}
    }
  }
}

Defind Script meta/cos_env.json

#!/bin/bash
HADOOP_COS_DIRNAME=${PARCEL_DIRNAME:-"HADOOP_COS"}

# if [ -n "${HADOOP_CLASSPATH}" ]; then
#   export HADOOP_CLASSPATH="${HADOOP_CLASSPATH}:$PARCELS_ROOT/$HADOOP_COS_DIRNAME/jars/*"
# else
#   export HADOOP_CLASSPATH="$PARCELS_ROOT/$HADOOP_COS_DIRNAME/jars/*"
# fi

if [ -n "${MR2_CLASSPATH}" ]; then
  export MR2_CLASSPATH="${MR2_CLASSPATH}:$PARCELS_ROOT/$HADOOP_COS_DIRNAME/jars/*"
else
  export MR2_CLASSPATH="$PARCELS_ROOT/$HADOOP_COS_DIRNAME/jars/*"
fi

软链接描述 meta/alternatives.json

构建 parcel 文件

tar zcvf GPLEXTRAS-5.0.0-gplextras5b2.p0.32-el6.parcel GPLEXTRAS-5.0.0-gplextras5b2.p0.32/ --owner=root --group=root

安装 parcel (略)

修改 hdfs配置

路径 Cloudera Manager -> HDFS -> Configuration -> Scope(Gateway) 配置项 HDFS Client Advanced Configuration Snippet (Safety Valve) for hdfs-site.xml 内容

    <property>
        <name>fs.cos.userinfo.appid</name>
        <value>your cos app id </value>
    </property>
    <property>
        <name>fs.cos.userinfo.secretId</name>
        <value>your cos secret id </value>
    </property>
    <property>
        <name>fs.cos.userinfo.secretKey</name>
        <value>your cos secret key</value>
    </property>
    <property>
        <name>fs.cosn.impl</name>
        <value>org.apache.hadoop.fs.cosnative.NativeCosFileSystem</value>
    </property>
    <property>
        <name>fs.cos.buffer.dir</name>
        <value>/data/cos/buffer</value>
    </property>
    <property>
        <name>fs.cos.userinfo.region</name>
        <value>gz</value>
    </property>

Defind Script 用于在插件影响到的组件启动时执行, 一般是把插件的 jar 包加入到组件的 classpath 中。 组件启动时以 source defind.script 方式调用。 插件影响到哪些组件在 meta/parcel.json 中的 provides 定义, 组件名称参考 , 脚本中用到的 classpath 变量名参考

用于建立软链接, hadoop_cos 中没有用到, 参考

参考 , parcel 文件实际是一个 .tar.gz 文件

parcel 文件名必须符合格式 ${parcel_name}-${version}-${distro_suffixes}.pracel, 其中 ${distro_suffixes} 参考

使用 检验文件合法性 使用 [make_manifest.py][12] 创建 parcel 描述 文件

[12]:

Hadoop 工具
The parcel format
The parcel.json file
Service parcel tags recognised by cloudera manager
Plugin parcel environment variables
The alternatives.json file
Building a parcel
Parcel distro suffixes
validator
https://github.com/cloudera/cm_ext/tree/master/make_manifest