标签:efi none RKE scom 清单 启动文件 uil hive ref
dubbo-monitor官方源码地址:https://github.com/Jeromefromcn/dubbo-monitor
[root@hdss7-200 src]# wget https://github.com/Jeromefromcn/dubbo-monitor/archive/master.zip [root@hdss7-200 src]# mkdir -p /data/dockerfile/dubbo-monitor [root@hdss7-200 src]# unzip /opt/src/dubbo-monitor-master.zip [root@hdss7-200 src]# cp -R /opt/src/dubbo-monitor-master/* /data/dockerfile/dubbo-monitor/
2.修改dubbo-monitor配置文件
[root@hdss7-200 src]# vim /data/dockerfile/dubbo-monitor/dubbo-monitor-simple/conf/dubbo_origin.properties dubbo.container=log4j,spring,registry,jetty dubbo.application.name=dubbo-monitor dubbo.application.owner=Maple dubbo.registry.address=zookeeper://zk1.fx.com:2181?backup=zk2.fx.com:2181,zk3.fx.com:2181 dubbo.protocol.port=20880 dubbo.jetty.port=8080 dubbo.jetty.directory=/dubbo-monitor-simple/monitor dubbo.charts.directory=/dubbo-monitor-simple/charts dubbo.statistics.directory=/dubbo-monitor-simple/statistics dubbo.log4j.file=logs/dubbo-monitor-simple.log dubbo.log4j.level=WARN
3.修改dubbo-monitor启动文件
[root@hdss7-200 src]# vim /data/dockerfile/dubbo-monitor/dubbo-monitor-simple/bin/start.sh #!/bin/bash sed -e "s/{ZOOKEEPER_ADDRESS}/$ZOOKEEPER_ADDRESS/g" /dubbo-monitor-simple/conf/dubbo_origin.properties > /dubbo-monitor-simple/conf/dubbo.properties cd `dirname $0` BIN_DIR=`pwd` cd .. DEPLOY_DIR=`pwd` CONF_DIR=$DEPLOY_DIR/conf SERVER_NAME=`sed ‘/dubbo.application.name/!d;s/.*=//‘ conf/dubbo.properties | tr -d ‘\r‘` SERVER_PROTOCOL=`sed ‘/dubbo.protocol.name/!d;s/.*=//‘ conf/dubbo.properties | tr -d ‘\r‘` SERVER_PORT=`sed ‘/dubbo.protocol.port/!d;s/.*=//‘ conf/dubbo.properties | tr -d ‘\r‘` LOGS_FILE=`sed ‘/dubbo.log4j.file/!d;s/.*=//‘ conf/dubbo.properties | tr -d ‘\r‘` if [ -z "$SERVER_NAME" ]; then SERVER_NAME=`hostname` fi PIDS=`ps -f | grep java | grep "$CONF_DIR" |awk ‘{print $2}‘` if [ -n "$PIDS" ]; then echo "ERROR: The $SERVER_NAME already started!" echo "PID: $PIDS" exit 1 fi if [ -n "$SERVER_PORT" ]; then SERVER_PORT_COUNT=`netstat -tln | grep $SERVER_PORT | wc -l` if [ $SERVER_PORT_COUNT -gt 0 ]; then echo "ERROR: The $SERVER_NAME port $SERVER_PORT already used!" exit 1 fi fi LOGS_DIR="" if [ -n "$LOGS_FILE" ]; then LOGS_DIR=`dirname $LOGS_FILE` else LOGS_DIR=$DEPLOY_DIR/logs fi if [ ! -d $LOGS_DIR ]; then mkdir $LOGS_DIR fi STDOUT_FILE=$LOGS_DIR/stdout.log LIB_DIR=$DEPLOY_DIR/lib LIB_JARS=`ls $LIB_DIR|grep .jar|awk ‘{print "‘$LIB_DIR‘/"$0}‘|tr "\n" ":"` JAVA_OPTS=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true " JAVA_DEBUG_OPTS="" if [ "$1" = "debug" ]; then JAVA_DEBUG_OPTS=" -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n " fi JAVA_JMX_OPTS="" if [ "$1" = "jmx" ]; then JAVA_JMX_OPTS=" -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false " fi JAVA_MEM_OPTS="" BITS=`java -version 2>&1 | grep -i 64-bit` if [ -n "$BITS" ]; then JAVA_MEM_OPTS=" -server -Xmx128m -Xms128m -Xmn32m -XX:PermSize=16m -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 " else JAVA_MEM_OPTS=" -server -Xms128m -Xmx128m -XX:PermSize=16m -XX:SurvivorRatio=2 -XX:+UseParallelGC " fi echo -e "Starting the $SERVER_NAME ...\c" exec java $JAVA_OPTS $JAVA_MEM_OPTS $JAVA_DEBUG_OPTS $JAVA_JMX_OPTS -classpath $CONF_DIR:$LIB_JARS com.alibaba.dubbo.container.Main > $STDOUT_FILE 2>&1
4.构建dubbo-monitor镜像并上传至私有仓库
[root@hdss7-200 src]# cd /data/dockerfile/dubbo-monitor [root@hdss7-200 dubbo-monitor]# docker build . -t harbor.fx.com/infra/dubbo-monitor:latest
[root@hdss7-200 dubbo-monitor]# docker push harbor.fx.com/infra/dubbo-monitor:latest
5.准备dubbo-monitor的资源配置清单
[root@hdss7-200 ~]# mkdir -p /data/k8s-yaml/dubbo-monitor
Deployment.yaml文件
[root@hdss7-200 dubbo-monitor]# vim Deployment.yaml kind: Deployment apiVersion: extensions/v1beta1 metadata: name: dubbo-monitor namespace: infra labels: name: dubbo-monitor spec: replicas: 1 selector: matchLabels: name: dubbo-monitor template: metadata: labels: app: dubbo-monitor name: dubbo-monitor spec: containers: - name: dubbo-monitor image: harbor.fx.com/infra/dubbo-monitor:latest imagePullSecrets: - name: harbor terminationGracePeriodSeconds: 30 strategy: type: RollingUpdate rollingUpdate: maxUnavailable: 1 maxSurge: 1 revisionHistoryLimit: 7 progressDeadlineSeconds: 600
svc.yaml
[root@hdss7-200 dubbo-monitor]# vim svc.yaml kind: Service apiVersion: v1 metadata: name: dubbo-monitor namespace: infra spec: ports: - protocol: TCP port: 80 targetPort: 8080 selector: app: dubbo-monitor
Ingress.yaml
[root@hdss7-200 dubbo-monitor]# vim Ingress.yaml kind: Ingress apiVersion: extensions/v1beta1 metadata: name: dubbo-monitor namespace: infra spec: rules: - host: dubbo-monitor.fx.com http: paths: - path: / backend: serviceName: dubbo-monitor servicePort: 80
6.应用dubbo-monitor资源配置清单文件
[root@hdss7-21 ~]# kubectl apply -f http://k8s-yaml.fx.com/dubbo-monitor/Deployment.yaml [root@hdss7-21 ~]# kubectl apply -f http://k8s-yaml.fx.com/dubbo-monitor/svc.yaml [root@hdss7-21 ~]# kubectl apply -f http://k8s-yaml.fx.com/dubbo-monitor/Ingress.yaml
7.DNS解析域名dubbo-monitor
[root@hdss7-11 ~]# vim /var/named/fx.com.zone $ORIGIN fx.com. $TTL 600 ; 10 minutes @ IN SOA dns.fx.com. dnsadmin.fx.com. ( 2020061011 ; serial 10800 ; refresh (3 hours) 900 ; retry (15 minutes) 604800 ; expire (1 week) 86400 ; minimum (1 day) ) NS dns.fx.com. $TTL 60 ; 1 minute dns A 10.4.7.11 harbor A 10.4.7.200 k8s-yaml A 10.4.7.200 traefik A 10.4.7.10 dashboard A 10.4.7.10 zk1 A 10.4.7.11 zk2 A 10.4.7.12 zk3 A 10.4.7.21 jenkins A 10.4.7.10 dubbo-monitor A 10.4.7.10
[root@hdss7-11 ~]# systemctl restart named
[root@hdss7-11 ~]# dig -t A dubbo-monitor.fx.com @10.4.7.11 +short
8.浏览器访问
12.实战交付一套dubbo微服务到k8s集群(5)之交付dubbo-monitor到K8S集群
标签:efi none RKE scom 清单 启动文件 uil hive ref
原文地址:https://www.cnblogs.com/fxxy/p/13159073.html