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
kind: StatefulSet
metadata:
@ -14,6 +13,19 @@ spec:
labels:
app: mongo
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:
- name: mongo
image: mongo:6.0.6
@ -22,21 +34,25 @@ spec:
- name: MONGO_INITDB_ROOT_USERNAME
value: root
- name: MONGO_INITDB_ROOT_PASSWORD
value: 'beaconfire123'
value: 'beaconfireinc123'
ports:
- containerPort: 27017
volumeMounts:
- name: mongo-data
mountPath: /data/db
volumeClaimTemplates:
- metadata:
name: mongo-data
spec:
accessModes: ['ReadWriteOnce']
storageClassName: "local-mongo"
resources:
requests:
storage: 5Gi
volumes:
- name: mongo-data
hostPath:
path: /data/tcs/mongo
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: "kubernetes.io/hostname"
operator: In
values:
- bfs-k8snode-10-2-1-6.hetzner.base.beaconfireinc.com
---
apiVersion: v1
@ -53,3 +69,4 @@ spec:
targetPort: 27017
nodePort: 30018
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
kind: ReplicationController
metadata:
name: mysql-axons
namespace: basic
name: mysql
labels:
name: mysql-axons
name: mysql
spec:
replicas: 1
selector:
name: mysql-axons
name: mysql
template:
metadata:
labels:
name: mysql-axons
name: mysql
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:
- name: mysql-axons
- name: mysql
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-axons
- name: tcs-mysql
mountPath: /var/lib/mysql
env:
- name: MYSQL_ROOT_PASSWORD
value: "Beaconfire@2099"
- name: MYSQL_DATABASE
value: "event_store"
value: "test"
- name: MYSQL_USER
value: "app"
- name: MYSQL_PASSWORD
value: "beaconfire@123"
volumes:
- name: data-axons
- name: tcs-mysql
hostPath:
path: /data/staff-axon/mysql
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: "kubernetes.io/hostname"
operator: In
values:
- bfs-k8snode-10-2-1-6.hetzner.base.beaconfireinc.com
path: /data/tcs/mysql
---
apiVersion: v1
kind: Service
metadata:
name: mysql-axons
namespace: basic
name: mysql
labels:
name: mysql-axons
name: mysql
spec:
ports:
- protocol: TCP
@ -63,5 +62,5 @@ spec:
targetPort: 3306
nodePort: 30016
selector:
name: mysql-axons
name: mysql
type: NodePort