apache / shardingsphere-elasticjob-ui

Administrator console of ElasticJob
https://shardingsphere.apache.org/
Apache License 2.0
162 stars 96 forks source link

The registry configuration will be lost when pod restarts #183

Closed dunhanson closed 6 months ago

dunhanson commented 1 year ago

The registry configuration will be lost when Pod restarts

1、kubernetes deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: elasticjob-ui
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: elasticjob-ui
  template:
    metadata:
      labels:
        app: elasticjob-ui
    spec:
      containers:
      - image: apache/shardingsphere-elasticjob-lite-ui:3.0.2
        name: elasticjob-ui
        ports:
        - containerPort: 8088
          protocol: TCP
        volumeMounts:
        - name: elasticjob-ui
          subPath: data
          mountPath: /data
        - name: elasticjob-ui
          subPath: ext-lib
          mountPath: /opt/shardingsphere-elasticjob-lite-ui/ext-lib
        - name: elasticjob-ui-conf
          subPath: application.properties
          mountPath: /opt/shardingsphere-elasticjob-lite-ui/conf/application.properties                
      volumes:
      - name: elasticjob-ui
        persistentVolumeClaim:
          claimName: elasticjob-ui
      - name: elasticjob-ui-conf
        configMap:
          name: elasticjob-ui-conf    

2、application.properties

#
# 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
#
#     http://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.
#

server.port=8088

auth.username=root
auth.password=******
auth.token_expires_after_seconds=3600

spring.datasource.default.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.default.url=jdbc:mysql://mysql.default.svc.cluster.local:3306/elastic_job_ui
spring.datasource.default.username=develop
spring.datasource.default.password=******
spring.jpa.show-sql=true

## Uncomment the following property to allow adding DataSource dynamically.
# dynamic.datasource.allowed-driver-classes={'org.h2.Driver','org.postgresql.Driver'}

3、registry center

Before restarting Pod

After Pod restarts

4、MySQL

All database tables are empty