Online deployment
The number of dtm replicas
dtm itself behaves similarly to an ordinary stateless application, where the data is stored in the database. Therefore, dtm can be deployed with multiple replicas just like an ordinary application. The recommended number of replicas is 2 or 3, which is sufficient for high availability. As the load rises, the number of replicas of dtm can be increased to improve the processing capacity of dtm.
K8S Deployment
Currently, since dtm supports http protocol, you can achieve the K8S deployment by adding the deployment configuration of K8S to the previous docker deployment. A reference of deployment.yml is given below:
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: dtm
name: dtm
namespace: default
spec:
progressDeadlineSeconds: 600
replicas: 4
revisionHistoryLimit: 5
selector:
matchLabels:
app: dtm
minReadySeconds: 3
strategy:
rollingUpdate:
maxSurge: 10%
maxUnavailable: 0
type: RollingUpdate
template:
metadata:
labels:
app: dtm
spec:
containers:
- env:
- name: DB_HOST
value: your-host
- name: DB_PORT
value: 3306
- name: DB_USER
value: root
- name: DB_PASSWORD
value: ''
- name: TRANS_CRON_INTERVAL
value: 10
- name: IS_DOCKER
value: '1'
image: yedf/dtm:latest
imagePullPolicy: Always
livenessProbe:
failureThreshold: 30
httpGet:
path: /api/ping
port: 8080
scheme: HTTP
initialDelaySeconds: 150
periodSeconds: 2
successThreshold: 1
timeoutSeconds: 3
readinessProbe:
failureThreshold: 5
httpGet:
path: /api/ping
port: 8080
scheme: HTTP
initialDelaySeconds: 150
periodSeconds: 3
successThreshold: 1
timeoutSeconds: 2
name: dtm
ports:
- containerPort: 8080
resources:
requests:
cpu: 200m
memory: 200Mi
stdin: true
tty: true
---
apiVersion: v1
kind: Service
metadata:
name: dtm-svc
namespace: default
spec:
ports:
- port: 80
targetPort: 8080
name: dtm-svc-port
selector:
app: dtm
type: ClusterIP
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: dtm-ingress
namespace: default
spec:
rules:
- host: 'your-domain'
http:
paths:
- backend:
serviceName: dtm-svc
servicePort: 80
path: /api/dtmsvr/