以自己写的一个java程序为例
1. 制作parcel包
1.1 我的程序结构如下:
[root@cdh3 nameaddress-1.0]# cd nameaddress/ [root@cdh3 nameaddress]# ll 总用量 9420 drwxr-xr-x 2 root root 4096 2月 1 16:54 bin drwxr-xr-x 2 root root 4096 2月 1 16:55 conf drwxr-xr-x 5 root root 4096 2月 1 16:55 data drwxr-xr-x 2 root root 4096 2月 1 16:55 lib drwxr-xr-x 2 root root 4096 2月 1 16:55 logs -rw-r--r-- 1 root root 9623369 2月 1 16:53 nohup.out1.2 在我程序的同级目录下,建立meta目录:
[root@cdh3 nameaddress-1.0]# ll 总用量 8 drwxr-xr-x 2 root root 4096 2月 1 16:18 meta drwxr-xr-x 7 root root 4096 2月 1 16:56 nameaddress1.3 meta目录的文件为:
[root@cdh3 nameaddress-1.0]# cd meta/ [root@cdh3 meta]# ll 总用量 8 -rw-r--r-- 1 root root 143 2月 1 16:07 env.sh -rw-r--r-- 1 root root 757 2月 1 16:06 parcel.json其中env.sh主要设置环境变量,parcel.json定义
env.sh:
#!/bin/bash NAMEADDRESS_DIRNAME=${PARCEL_DIRNAME:-"nameaddress-1.0"} export NAMEADDRESS_HOME=$PARCELS_ROOT/$NAMEADDRESS_DIRNAME/nameaddressparcel.json:
{ "schema_version": 1, "name": "nameaddress", "version": "1.0", "depends": "CDH (>= 5.2), CDH (<< 6.0)", "setActiveSymlink": true, "scripts": { "defines": "env.sh" }, "packages": [ { "name": "nameaddress", "version": "1.0+nameaddress1.0" } ], "components": [ { "name": "nameaddress", "version": "1.0+nameaddress1.0", "pkg_version": "1.0+nameaddress1.0" } ], "provides": [ "nameaddress" ], "users": { "nameaddress": { "longname" : "root", "home" : "/root/", "shell" : "/bin/bash", "extra_groups" : [ ] } }, "groups": [ ] }1.4 nameaddress的上级目录为nameaddress-1.0,要和parcel.json对应
tar -czvf Bootservice-1.0-el7.parce nameaddress-1.0 生成parcel
1.5 去https://github.com/cloudera/cm_ext 下载工具,使用命令
$ python make_manifest/make_manifest.py其中目录为parcel文件的上级目录
2.制作csd文件