本次集成基于DDP1.2.1 集成CMAK-3.0.0.6
设计的json和tar包我放网盘了.
通过网盘分享的文件:DDP集成CMAK
链接: https://pan.baidu.com/s/1BR70Ajj9FxvjBlsOX4Ivhw?pwd=cpmc 提取码: cpmc
CMAK github上提供了zip压缩包.将压缩包解压之后
在根目录下加入启动脚本executor.sh和jdk11环境
#!bin/sh
service_name="ProdServerStart"
export JAVA_HOME=jdk
get_pid() {
# 查找正在运行的服务的进程ID
pid=$(ps -ef | grep -v grep | grep $service_name | awk '{print $2}')
echo "$pid"
}
# 检查服务是否在运行
check_status() {
pid=$(get_pid "$service_name")
if [ -z "$pid" ]; then
echo "$service_name is NOT running."
exit 1
else
echo "$service_name is running with PID $pid."
exit 0
fi
}
start() {
nohup bin/cmak -Dconfig.file=conf/application.conf >/dev/null 2>&1 &
sleep 5
check_status
}
stop() {
pid=$(get_pid "$service_name")
if [ -z "$pid" ]; then
echo "$service_name is already stoped."
exit 0
else
echo "$service_name PID $pid"
kill -9 $pid
echo "kill $service_name $pid done"
rm -rf RUNNING_PID
exit 0
fi
}
status() {
check_status
}
restart() {
stop
start
}
case "$1" in
(start)
start
;;
(stop)
stop
;;
(status)
status
;;
(restart)
restart
;;
(*)
echo "Only Support start|stop|status|restart"
exit 1
esac
tar -zcvf cmak-3.0.0.6.tar.gz cmak-3.0.0.6
mv cmak-3.0.0.6.tar.gz /opt/datasophon/DDP/packages
cd /opt/datasophon/DDP/packages
java -jar file-md5-1.0-SNAPSHOT-jar-with-dependencies.jar cmak-3.0.0.6.tar.gz
得到md5文件.
在/opt/datasophon/datasophon-worker/conf/templates新建模板文件
vi cmak-application.conf.ftl
http.port=${httpPort}
play.crypto.secret="^<csmm5Fx4d=r2HEX8pelM3iBkFVv?k[mc;IZE<_Qoq8EkX_/7@Zt6dP05Pzea3U"
play.http.session.maxAge="1h"
play.i18n.langs=["en"]
play.http.requestHandler = "play.http.DefaultHttpRequestHandler"
play.http.context = "/"
play.application.loader=loader.KafkaManagerLoader
kafka-manager.zkhosts="${zkhosts}"
cmak.zkhosts="${zkhosts}"
pinned-dispatcher.type="PinnedDispatcher"
pinned-dispatcher.executor="thread-pool-executor"
application.features=["KMClusterManagerFeature","KMTopicManagerFeature","KMPreferredReplicaElectionFeature","KMReassignPartitionsFeature", "KMScheduleLeaderElectionFeature"]
akka {
loggers = ["akka.event.slf4j.Slf4jLogger"]
loglevel = "INFO"
}
akka.logger-startup-timeout = 60s
basicAuthentication.ldap.enabled=false
basicAuthentication.ldap.server=""
basicAuthentication.ldap.port=389
basicAuthentication.ldap.username=""
basicAuthentication.ldap.password=""
basicAuthentication.ldap.search-base-dn=""
basicAuthentication.ldap.search-filter="(uid=$capturedLogin$)"
basicAuthentication.ldap.group-filter=""
basicAuthentication.ldap.connection-pool-size=10
basicAuthentication.ldap.ssl=false
basicAuthentication.ldap.ssl-trust-all=false
basicAuthentication.enabled=${useLogin}
basicAuthentication.username="${username}"
basicAuthentication.password="${password}"
basicAuthentication.realm="Kafka-Manager"
basicAuthentication.excluded=["/api/health"] # ping the health of your instance without authentification
在/opt/datasophon/datasophon-manager-1.2.1/conf/meta/DDP-1.2.1目录下新建文件夹
mkdir CMAK
vi CMAK/service_ddl.json
{
"name": "CMAK",
"label": "KafkaManager",
"description": "KafkaManager",
"version": "3.0.0.6",
"sortNum": 22,
"dependencies": [],
"packageName": "cmak-3.0.0.6.tar.gz",
"decompressPackageName": "cmak-3.0.0.6",
"roles": [{
"name": "KafkaManager",
"label": "KafkaManager",
"roleType": "master",
"runAs": {
"user": "root",
"group": "root"
},
"cardinality": "1+",
"sortNum": 1,
"logFile": "/opt/datasophon/cmak/logs/application.log",
"startRunner": {
"timeout": "10",
"program": "executor.sh",
"args": ["start"]
},
"stopRunner": {
"timeout": "10",
"program": "executor.sh",
"args": ["stop"]
},
"statusRunner": {
"timeout": "10",
"program": "executor.sh",
"args": ["status"]
},
"restartRunner": {
"timeout": "10",
"program": "executor.sh",
"args": ["restart"]
},
"externalLink": {
"name": "KafkaManagerUi",
"label": "KafkaManagerUi",
"url": "http://${host}:8888"
}
}],
"configWriter": {
"generators": [{
"filename": "application.conf",
"configFormat": "custom",
"outputDirectory": "conf",
"templateName": "cmak-application.conf.ftl",
"includeParams": ["httpPort", "zkhosts", "useLogin", "username", "password"]
}]
},
"parameters": [{
"name": "httpPort",
"label": "Web启动端口",
"description": "Web启动端口",
"configType": "map",
"required": true,
"type": "input",
"value": "8888",
"configurableInWizard": true,
"hidden": false,
"defaultValue": "9000"
}, {
"name": "zkhosts",
"label": "zk服务地址",
"description": "zk服务地址",
"configType": "map",
"required": true,
"type": "input",
"value": "node01:2181",
"configurableInWizard": true,
"hidden": false,
"defaultValue": "zkHost01:2181"
}, {
"name": "useLogin",
"label": "是否需要登录",
"description": "是否需要登录",
"configType": "map",
"required": true,
"type": "switch",
"value": false,
"configurableInWizard": true,
"hidden": false,
"defaultValue": false
}, {
"name": "username",
"label": "Web登录账号",
"description": "Web登录账号",
"configType": "map",
"required": true,
"type": "input",
"value": "admin",
"configurableInWizard": true,
"hidden": false,
"defaultValue": "admin"
}, {
"name": "password",
"label": "Web登录密码",
"description": "Web登录密码",
"configType": "map",
"required": true,
"type": "input",
"value": "123456",
"configurableInWizard": true,
"hidden": false,
"defaultValue": "123456"
}]
}
重启api manager
添加服务