参考
https://github.com/cloudera/cm_ext
https://github.com/cloudera/cm_csds
生成parcel
1 | # 需要在目标文件夹内新建meta文件,并在meta中新建文件parcel.json,文件内容需要自己参考资料填写 |
对外提供http的parcel服务
1 | # 生成manifest.json |
配置cm的parcel
添加上述http地址,即可分发parcel
生成CSD
1 | # 新建目录,内部结构为 |
HELLO-1.0/meta/hello_env.sh1
2HELLO_DIRNAME=${PARCEL_DIRNAME}
export CDH_HELLO_HOME=$PARCELS_ROOT/$HELLO_DIRNAME
cat descriptor/service.sdl1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53{
"name":"HELLO",
"label":"Hello",
"description":"The hello service",
"version":"1.1",
"runAs":{
"user":"root",
"group":"root"
},
"compatibility":{
"generation":1
},
"icon":"images/icon.png",
"parcel" : {
"requiredTags" : [ "hello" ],
"optionalTags" : [ "hello-plugin" ]
},
"parameters":[
{
"name":"service_var1",
"label":"Service Var1 Label",
"description":"Service Var1 Description",
"configName":"service.var1.config",
"type":"string",
"default":"this is a default"
}
],
"roles":[
{
"name":"HELLO_SERVICE",
"label":"hello service",
"pluralLabel":"hello services",
"parameters":[
{
"name":"init_content",
"label":"conf1",
"description":"conf",
"type":"string",
"default": "defaultiii"
}
],
"startRunner":{
"program":"scripts/control.sh",
"args":[
"start"
],
"environmentVariables":{
"PORT": "10002"
}
}
}
]
}
scripts/control.sh1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
CMD=$1
export HELLO_HOME=${HELLO_HOME:-$CDH_HELLO_HOME}
case $CMD in
(start)
echo "Starting Hello123"
exec python $HELLO_HOME/src/hello.py
;;
(*)
echo "Don't understand [$CMD]"
;;
esac