update mysql

main
ycz008 2023-11-06 11:33:27 +08:00
parent c5c418b328
commit 5765f19311
4 changed files with 58 additions and 137 deletions

View File

@ -1,4 +1,3 @@
---
apiVersion: apps/v1 apiVersion: apps/v1
kind: StatefulSet kind: StatefulSet
metadata: metadata:
@ -14,6 +13,19 @@ spec:
labels: labels:
app: mongo app: mongo
spec: spec:
initContainers:
- name: init
image: busybox
imagePullPolicy: IfNotPresent
command:
- sh
- -c
- |
sysctl -w net.ipv4.tcp_keepalive_time=300
sysctl -w net.ipv4.tcp_keepalive_intvl=10
sysctl -w net.ipv4.tcp_keepalive_probes=3
securityContext:
privileged: true
containers: containers:
- name: mongo - name: mongo
image: mongo:6.0.6 image: mongo:6.0.6
@ -22,21 +34,25 @@ spec:
- name: MONGO_INITDB_ROOT_USERNAME - name: MONGO_INITDB_ROOT_USERNAME
value: root value: root
- name: MONGO_INITDB_ROOT_PASSWORD - name: MONGO_INITDB_ROOT_PASSWORD
value: 'beaconfire123' value: 'beaconfireinc123'
ports: ports:
- containerPort: 27017 - containerPort: 27017
volumeMounts: volumeMounts:
- name: mongo-data - name: mongo-data
mountPath: /data/db mountPath: /data/db
volumeClaimTemplates: volumes:
- metadata: - name: mongo-data
name: mongo-data hostPath:
spec: path: /data/tcs/mongo
accessModes: ['ReadWriteOnce'] affinity:
storageClassName: "local-mongo" nodeAffinity:
resources: requiredDuringSchedulingIgnoredDuringExecution:
requests: nodeSelectorTerms:
storage: 5Gi - matchExpressions:
- key: "kubernetes.io/hostname"
operator: In
values:
- bfs-k8snode-10-2-1-6.hetzner.base.beaconfireinc.com
--- ---
apiVersion: v1 apiVersion: v1
@ -53,3 +69,4 @@ spec:
targetPort: 27017 targetPort: 27017
nodePort: 30018 nodePort: 30018
type: NodePort type: NodePort

View File

@ -1,32 +0,0 @@
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: local-mongo
provisioner: kubernetes.io/no-provisioner
allowVolumeExpansion: true
volumeBindingMode: WaitForFirstConsumer
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: local-mongo-0
labels:
type: local
spec:
storageClassName: local-mongo
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
local:
path: /data/mongo
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- bfs-k8snode-10-2-1-7.hetzner.base.beaconfireinc.com

View File

@ -1,63 +0,0 @@
---
# configMap
# set global max_connections = 5000
# set global wait_timeout = 600
---
apiVersion: v1
kind: ReplicationController
metadata:
name: mysql-drill
namespace: basic
labels:
name: mysql-drill
spec:
replicas: 1
selector:
name: mysql-drill
template:
metadata:
labels:
name: mysql-drill
spec:
containers:
- name: mysql-drill
image: mysql:8.0.33
args: ["--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci", "--max_connections=2000", "--binlog_expire_logs_seconds=432000","--sql_mode=STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION"]
ports:
- containerPort: 3306
volumeMounts:
- name: data-drill
mountPath: /var/lib/mysql
env:
- name: MYSQL_ROOT_PASSWORD
value: "Beaconfire@2099"
volumes:
- name: data-drill
hostPath:
path: /data/staff-axon/mysql
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: "kubernetes.io/hostname"
operator: In
values:
- bfs-k8snode-10-2-1-8.hetzner.base.beaconfireinc.com
---
apiVersion: v1
kind: Service
metadata:
name: mysql-drill
namespace: basic
labels:
name: mysql-drill
spec:
ports:
- protocol: TCP
port: 3306
targetPort: 3306
nodePort: 30017
selector:
name: mysql-drill
type: NodePort

View File

@ -1,61 +1,60 @@
---
# configMap
# set global max_connections = 5000
# set global wait_timeout = 600
---
apiVersion: v1 apiVersion: v1
kind: ReplicationController kind: ReplicationController
metadata: metadata:
name: mysql-axons name: mysql
namespace: basic
labels: labels:
name: mysql-axons name: mysql
spec: spec:
replicas: 1 replicas: 1
selector: selector:
name: mysql-axons name: mysql
template: template:
metadata: metadata:
labels: labels:
name: mysql-axons name: mysql
spec: spec:
initContainers:
- name: init
image: busybox
imagePullPolicy: IfNotPresent
command:
- sh
- -c
- |
sysctl -w net.ipv4.tcp_keepalive_time=300
sysctl -w net.ipv4.tcp_keepalive_intvl=10
sysctl -w net.ipv4.tcp_keepalive_probes=3
securityContext:
privileged: true
containers: containers:
- name: mysql-axons - name: mysql
image: mysql:8.0.33 image: mysql:8.0.33
args: ["--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci", "--max_connections=2000", "--binlog_expire_logs_seconds=432000","--sql_mode=STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION"] args: ["--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci", "--max_connections=2000", "--binlog_expire_logs_seconds=432000","--sql_mode=STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION"]
ports: ports:
- containerPort: 3306 - containerPort: 3306
volumeMounts: volumeMounts:
- name: data-axons - name: tcs-mysql
mountPath: /var/lib/mysql mountPath: /var/lib/mysql
env: env:
- name: MYSQL_ROOT_PASSWORD - name: MYSQL_ROOT_PASSWORD
value: "Beaconfire@2099" value: "Beaconfire@2099"
- name: MYSQL_DATABASE - name: MYSQL_DATABASE
value: "event_store" value: "test"
- name: MYSQL_USER
value: "app"
- name: MYSQL_PASSWORD
value: "beaconfire@123"
volumes: volumes:
- name: data-axons - name: tcs-mysql
hostPath: hostPath:
path: /data/staff-axon/mysql path: /data/tcs/mysql
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: "kubernetes.io/hostname"
operator: In
values:
- bfs-k8snode-10-2-1-6.hetzner.base.beaconfireinc.com
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: mysql-axons name: mysql
namespace: basic
labels: labels:
name: mysql-axons name: mysql
spec: spec:
ports: ports:
- protocol: TCP - protocol: TCP
@ -63,5 +62,5 @@ spec:
targetPort: 3306 targetPort: 3306
nodePort: 30016 nodePort: 30016
selector: selector:
name: mysql-axons name: mysql
type: NodePort type: NodePort