首页 > 其他分享 >k8s部署实时计算平台dinky1.0

k8s部署实时计算平台dinky1.0

时间:2024-05-13 18:09:01浏览次数:15  
标签:dinky name 实时 dinky1.0 application xx mysql k8s config

k8s部署实时计算平台dinky1.0.2

源码编译

IDEA 编译

推荐使用 IDEA 进行编译,因为 IDEA 在打开项目时会自动下载依赖,而且编译速度快,方便调试.

Clone 项目

注意: 本次直接 clone 的是 Dinky 主仓库,如果你想要二次开发/基于自己的仓库进行二次开发,请先 fork 项目,然后再 clone 你自己的仓库

Clone 完成后, 等待 IDEA 自动下载依赖(前提 IDEA 已经正确配置了 Maven) ,下载完成后, 请按照下一步中的步骤(Profile)进行编译

编译打包

修改配置文件到你使用的数据库类型,(mysql,h2)否则无法加载驱动

编译结果

编译完成后,请查看编译后的目录,如果编译成功,会在 dinky/build 目录下生成对应的版本的 tar.gz 包。

构建docker镜像

1、修改docker环境变量

将打好的包(/build)和dockerfile(/docker)上传至有docker环境的服务器上

修改dockerfile,这里为了方便,直接写死了版本号

Shell
FROM openjdk:8u342-oracle as build-stage

ARG DINKY_VERSION
ENV DINKY_VERSION=1.18-1.0.2

ADD ./dinky-release-1.18-1.0.2.tar.gz /opt/

USER root
RUN mv /opt/dinky-release-1.18-1.0.2 /opt/dinky/
RUN mkdir -p /opt/dinky/run && mkdir -p /opt/dinky/logs && touch /opt/dinky/logs/dinky.log
RUN chmod -R 777 /opt/dinky/

FROM openjdk:8u342-oracle as production-stage
COPY --from=build-stage /opt/dinky/ /opt/dinky/
WORKDIR /opt/dinky/

EXPOSE 8888

CMD ./auto.sh restart && tail -f /opt/dinky/logs/dinky.log

2、构建镜像推送到harbor

Shell
docker build -t dinky-server_flink18:1.0.0 -f ./docker/Dockerfile ./
docker images
docker login -u admin -p Harbor12345 http://172.xx.xx.xx
docker tag dinky-server_flink18:1.0.0 172.xx.xx.xx/bigdata/dinky-server_flink18:1.0.0
docker push 172.xx.xx.xx/bigdata/dinky-server_flink18:1.0.0

k8s部署镜像

1、创建secret (需要加-n工作空间,否则不生效)

Shell
kubectl create secret docker-registry bigdata --docker-server=172.xx.xx.xx --docker-username=admin --docker-password=xxxxx -n dinky

2、创建工作负载

Shell
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: flink-dinky
name: dinky
namespace: dinky
spec:
selector:
matchLabels:
app: flink-dinky
template:
metadata:
labels:
app: flink-dinky
spec:
imagePullSecrets:
- name: bigdata # 引用您创建的 ImagePullSecret
containers:
- image: 172.xx.xx.xx/bigdata/dinky-server_flink18@sha256:0d9d6018fad7574951c257e74fac212945e79f4a089d657bd8f90e9d049e07db # 包含您的 Harbor 仓库地址
imagePullPolicy: IfNotPresent
name: dinky
volumeMounts:
- mountPath: /opt/dinky/config/application.yml
name: admin-config
subPath: application.yml
- mountPath: /opt/dinky/config/application-mysql.yml
name: mysql-config
subPath: application-mysql.yml
volumes: # 注意这里volumes已经移动到了Pod模板的spec下
- name: admin-config
configMap:
name: dinky-config
- name: mysql-config
configMap:
name: mysql-config

---

apiVersion: v1
kind: ConfigMap
metadata:
name: dinky-config
namespace: dinky
data:
#配置项均为【conf】目录下的application.yaml文件内容,如果有更新,把下面整段替换即可
application.yml: |-
# Dinky application port
server:
port: 8888
shutdown: graceful

spring:
# Dinky application name
application:
name: Dinky
profiles:
# The h2 database is used by default. If you need to use other databases, please set the configuration active to: mysql, currently supports [mysql, pgsql, h2]
# If you use mysql database, please configure mysql database connection information in application-mysql.yml
# If you use pgsql database, please configure pgsql database connection information in application-pgsql.yml
# If you use the h2 database, please configure the h2 database connection information in application-h2.yml,
# note: the h2 database is only for experience use, and the related data that has been created cannot be migrated, please use it with caution
active: ${DB_ACTIVE:mysql} #[h2,mysql,pgsql]
include: jmx
lifecycle:
timeout-per-shutdown-phase: 30s

# mvc config
mvc:
pathmatch:
# Path matching strategy, default ant_path_matcher, support ant_path_matcher and path_pattern_parser
matching-strategy: ant_path_matcher
format:
date: yyyy-MM-dd HH:mm:ss # date format
time: HH:mm:ss # time format
date-time: yyyy-MM-dd HH:mm:ss # date-time format

# json format global configuration
jackson:
time-zone: GMT+8 # Time zone, default is GMT+8
date-format: yyyy-MM-dd HH:mm:ss # Date format, the default is yyyy-MM-dd HH:mm:ss

# circular references allowed
main:
allow-circular-references: true
# 默认使用内存缓存元数据信息,
# dinky支持redis缓存,如有需要请把simple改为redis,并打开下面的redis连接配置
# 子配置项可以按需要打开或自定义配置
cache:
type: simple
# # 如果type配置为redis,则该项可按需配置
# redis:
## 是否缓存空值,保存默认即可
# cache-null-values: false
## 缓存过期时间,24小时
# time-to-live: 86400
# redis:
# host: 172.xx.xx.xx
# port: 6379
# password: xxxxx
# database: 10
# jedis:
# pool:
# # 连接池最大连接数(使用负值表示没有限制)
# max-active: 50
# # 连接池最大阻塞等待时间(使用负值表示没有限制)
# max-wait: 3000
# # 连接池中的最大空闲连接数
# max-idle: 20
# # 连接池中的最小空闲连接数
# min-idle: 5
# # 连接超时时间(毫秒)
# timeout: 5000
# file upload config of servlet , the default is 500MB
servlet:
multipart:
enabled: true
max-file-size: 524288000
max-request-size: 524288000

########################################################## Redis配置 ##########################################################
# If sa-token needs to rely on redis, please open the redis configuration and depend on pom.xml and dinky-admin/pom.xml, and configure redis connection information in application.yml
# note: pay attention to the indentation of this configuration item
# redis:
# host: localhost
# port: 6379
# password:
# database: 10
# jedis:
# pool:
# # The maximum number of connections in the connection pool (use a negative value to indicate no limit)
# max-active: 50
# # The maximum blocking waiting time of the connection pool (use a negative value to indicate no limit)
# max-wait: 3000
# # The maximum number of idle connections in the connection pool
# max-idle: 20
# # The minimum number of idle connections in the connection pool
# min-idle: 5
# # Connection timeout (milliseconds)
# timeout: 5000

#################################################################################################################
################################################# Mybatis Config ################################################
######### Please note: that the following configurations are not recommended to be modified #####################
#################################################################################################################
mybatis-plus:
mapper-locations: classpath:/mapper/*Mapper.xml
# Entity scanning, multiple packages are separated by commas or semicolons
typeAliasesPackage: org.dinky.model
global-config:
db-config:
id-type: auto
# Logic delete configuration : 0: false(Not deleted), 1: true(deleted)
logic-delete-field: is_delete
logic-delete-value: 1
logic-not-delete-value: 0
banner: false
configuration:
##### mybatis-plus prints complete sql (only for development environment)
#log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
type-handlers-package: org.dinky.data.typehandler
#################################################################################################################
################################################# SMS Config ####################################################
#################################################################################################################
sms:
is-print: false



#################################################################################################################
################################################# Sa-Token Config ###############################################
#################################################################################################################
# Sa-Token basic configuration
sa-token:
# The validity period of the token, the unit is 10 hours by default, -1 means it will never expire
timeout: 36000
# The temporary validity period of the token (the token will be considered as expired if there is no operation within the specified time)
# unit: second , if you do not need to set a temporary token, you can set it to -1
active-timeout: -1
# Whether to allow the same account to log in concurrently (when true, allow login together, when false, new login squeezes out old login)
is-concurrent: false
# When multiple people log in to the same account, whether to share a token (if true, all logins share a token, and if false, create a new token for each login)
is-share: true
# token style
token-style: uuid
# Whether to output the operation log
is-log: false
# Whether to print banner
is-print: false
# The secret key
jwt-secret-key: 0DA4198858E84F1AADDF846340587A85
# is write header
is-write-header: true
# is read header
is-read-header: true
token-name: token
is-read-cookie: true

#################################################################################################################
################################################# knife4j Config ################################################
#################################################################################################################
knife4j:
enable: true
setting:
language: en



#################################################################################################################
################################################# Crypto Config #################################################
#################################################################################################################
crypto:
enabled: false
encryption-password:


---

apiVersion: v1
kind: ConfigMap
metadata:
name: mysql-config
namespace: dinky
data:
#配置项均为【conf】目录下的application.yaml文件内容,如果有更新,把下面整段替换即可
application-mysql.yml: |-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

spring:
datasource:
url: jdbc:mysql://${MYSQL_ADDR:172.xx.xx.xx:3306}/${MYSQL_DATABASE:dinky}?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
username: ${MYSQL_USERNAME:root}
password: ${MYSQL_PASSWORD:xxxxx}
driver-class-name: com.mysql.cj.jdbc.Driver

---

apiVersion: v1
kind: Service
metadata:
name: flink-dinky
namespace: dinky
spec:
ports:
- name: web-flink-dinky
port: 8888 #dinky pod 的端口号
protocol: TCP
nodePort: 32323 #【对外暴露端口号】,如果出现端口冲突,可自行更改
selector:
app: flink-dinky
type: NodePort

测试访问

访问http://172.xxxxxxx:32323/#/user/login

系统初始化默认用户名/密码: admin/dinky123!@#

admin 用户在 Dinky 是最高权限用户,无法删除

自 Dinky 1.0.0 版本开始,admin 用户的默认密码是 dinky123!@#

标签:dinky,name,实时,dinky1.0,application,xx,mysql,k8s,config
From: https://www.cnblogs.com/mnbvm6/p/18189726

相关文章

  • 【k8s】基于猪齿鱼部署相关概念辨析
    相关链接:https://golangguide.top/架构/云原生/核心知识点/k8s到底是什么.html集群命名空间NODEDeploymentpodcontainer......
  • 振弦采集仪在岩土工程中的实时监测和预警作用
    振弦采集仪在岩土工程中的实时监测和预警作用河北稳控科技振弦采集仪被广泛应用于岩土工程中的实时监测和预警。它通过对地下振弦信号的连续监测和分析,能够提供准确的地下结构变形和应力变化信息,为岩土工程的安全和稳定提供重要的支持。 振弦采集仪主要由振弦传感器和数据采......
  • 准实时数仓搭建指南:以仓储式会员商超为模拟场景
    在电商和新零售持续冲击传统零售商超的今天,仓储式会员店反而成功逃脱曾经的“水土不服”预测,业绩一路向好。与此同时,随着人工智能、大数据、智慧物流等技术的不断革新,零售批发的消费场景也进一步拓展,对数据分析的要求也越发迫切。本文将以巴基斯坦Metro的数仓项目为例,以操作指......
  • KubeKey 部署 K8s v1.28.8 实战
    在某些生产环境下,我们仅需要一个原生的K8s集群,无需部署KubeSphere这样的图形化管理控制台。在我们已有的技术栈里,已经习惯了利用KubeKey部署KubeSphere和K8s集群。今天,我将为大家实战演示如何在openEuler22.03LTSSP3上,利用KubeKey部署一套纯粹的K8s集群。实......
  • FlexibleButton - 一个小巧灵活的C语言按键处理库+SerialChart - 能将串口数据实时绘
    1、FlexibleButton-一个小巧灵活的C语言按键处理库FlexibleButton是一个基于标准C语言的小巧灵活的按键处理库,支持单击、连击、短按、长按、自动消抖,可以自由设置组合按键,可用于中断和低功耗场景。项目主页:https://github.com/murphyzhao/FlexibleButton该按键库解耦了......
  • [转帖]Java程序在K8S容器部署CPU和Memory资源限制相关设置
    https://developer.aliyun.com/article/700701  简介: 背景在k8sdocker环境中执行Java程序,因为我们设置了cpu,memory的limit,所以Java程序执行时JVM的参数没有跟我们设置的参数关联,导致JVM感知到的cpu和memory是我们k8s的worknode上的cpu和memory大小。背景在......
  • 实时行情API | 实时行情数据对接
    ​这个平台可对接产品包括:印股、台股、美股、港股、A股、外汇、贵金属、国际期货、国内期货、国际金银、数字货币、股指期货、等数据的对接产品代码获取地址:http://39.107.99.235:1008/market/market.php数据解析服务器实时推送的行情数据为以下格式:{"body":{......
  • 实时行情数据源接口websocket接入方法
    ​支持如下产品对接:外汇、国际期货、国内期货、国际金银、数字货币、股指期货、美股、印度股、港股、台股、A股产品代码获取地址:http://39.107.99.235:1008/market/market.php产品代码:比特币btcusdt以太坊ethusdt恒指期货HSI德指期货DAX英镑美元fx_sgbpusd欧......
  • 如何获取股票外汇期货的实时行情数据和历史行情数据?
    ​支持如下产品对接:外汇、国际期货、国内期货、国际金银、数字货币、股指期货、美股、印度股、港股、台股、A股产品代码获取地址:http://39.107.99.235:1008/market/market.php产品代码:比特币btcusdt以太坊ethusdt恒指期货HSI德指期货DAX英镑美元fx_sgbpusd欧......
  • 分享一个使用python调用websocket获取实时行情数据的方法
    这个站点可以获取:外汇、国际期货、国内期货、贵金属、能源、虚拟货币、股指期货、美股、台股、港股、印度股、A股、ETF等以下是Python的连接demo,可以参考下。同时也支持其他后端语言的连接,PHP、Java等。获取品种地址:http://39.107.99.235:1008/market/market.phpimportj......