增加使用Ceph做持久化存储创建MySQL集群
parent
f2ee780919
commit
1b69cba8b8
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,2 @@
|
|||
[client.admin]
|
||||
key = AQCX06hZ9LnSBxAAYuoIT/ewbTRhKpTHOZLoRQ==
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
34
index.html
34
index.html
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,13 @@
|
|||
apiVersion: storage.k8s.io/v1
|
||||
kind: StorageClass
|
||||
metadata:
|
||||
name: ceph-web
|
||||
provisioner: kubernetes.io/rbd
|
||||
parameters:
|
||||
monitors: 172.28.7.98,172.28.7.99,172.28.7.100
|
||||
adminId: admin
|
||||
adminSecretName: ceph-secret
|
||||
adminSecretNamespace: galera
|
||||
pool: rbd #此处默认是rbd池,生产上建议自己创建存储池隔离
|
||||
userId: admin
|
||||
userSecretName: ceph-secret
|
|
@ -0,0 +1,8 @@
|
|||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: ceph-secret
|
||||
namespace: galera
|
||||
type: "kubernetes.io/rbd"
|
||||
data:
|
||||
key: AQCX06hZ9LnSBxAAYuoIT/ewbTRhKpTHOZLoRQ==
|
|
@ -0,0 +1,122 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
annotations:
|
||||
service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
|
||||
name: mysql
|
||||
namespace: galera
|
||||
labels:
|
||||
app: mysql
|
||||
tier: data
|
||||
spec:
|
||||
ports:
|
||||
- port: 3306
|
||||
name: mysql
|
||||
clusterIP: None
|
||||
selector:
|
||||
app: mysql
|
||||
---
|
||||
apiVersion: apps/v1beta1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: mysql
|
||||
namespace: galera
|
||||
spec:
|
||||
serviceName: "mysql"
|
||||
replicas: 3
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: mysql
|
||||
tier: data
|
||||
annotations:
|
||||
pod.beta.kubernetes.io/init-containers: '[
|
||||
{
|
||||
"name": "galera-init",
|
||||
"image": "bj-xg-oam-docker-hub-001.tendcloud.com/library/k8s-galera-init:latest",
|
||||
"args": ["-service=mysql"],
|
||||
"env": [
|
||||
{
|
||||
"name": "POD_NAMESPACE",
|
||||
"valueFrom": {
|
||||
"fieldRef": { "apiVersion": "v1", "fieldPath": "metadata.namespace" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "SAFE_TO_BOOTSTRAP",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "DEBUG",
|
||||
"value": "1"
|
||||
}
|
||||
],
|
||||
"volumeMounts": [
|
||||
{
|
||||
"name": "config",
|
||||
"mountPath": "/etc/mysql/conf.d"
|
||||
},
|
||||
{
|
||||
"name": "data",
|
||||
"mountPath": "/var/lib/mysql"
|
||||
}
|
||||
]
|
||||
}
|
||||
]'
|
||||
spec:
|
||||
terminationGracePeriodSeconds: 10
|
||||
containers:
|
||||
- name: mysql
|
||||
image: bj-xg-oam-docker-hub-001.tendcloud.com/library/mariadb:10.1
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- containerPort: 3306
|
||||
name: mysql
|
||||
- containerPort: 4444
|
||||
name: sst
|
||||
- containerPort: 4567
|
||||
name: replication
|
||||
- containerPort: 4568
|
||||
name: ist
|
||||
env:
|
||||
- name: MYSQL_ROOT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: mysql-secrets
|
||||
key: root-password
|
||||
- name: MYSQL_ROOT_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: mysql-secrets
|
||||
key: root-user
|
||||
- name: MYSQL_INITDB_SKIP_TZINFO
|
||||
value: "yes"
|
||||
livenessProbe:
|
||||
exec:
|
||||
command: ["sh", "-c", "mysql -u\"root\" -p\"\" -e 'show databases;'"]
|
||||
initialDelaySeconds: 60
|
||||
timeoutSeconds: 5
|
||||
readinessProbe:
|
||||
exec:
|
||||
command: ["sh", "-c", "mysql -u\"root\" -p\"\" -e 'show databases;'"]
|
||||
initialDelaySeconds: 20
|
||||
timeoutSeconds: 5
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /etc/mysql/conf.d
|
||||
- name: data
|
||||
mountPath: /var/lib/mysql
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: mysql-config-vol
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: data
|
||||
annotations:
|
||||
volume.beta.kubernetes.io/storage-class: "ceph-web" #引用ceph class 的类
|
||||
spec:
|
||||
accessModes: [ "ReadWriteOnce" ]
|
||||
resources:
|
||||
requests:
|
||||
storage: 3Gi
|
|
@ -0,0 +1,4 @@
|
|||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: galera
|
|
@ -0,0 +1,39 @@
|
|||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: mysql-config-vol
|
||||
namespace: galera
|
||||
labels:
|
||||
app: mysql
|
||||
data:
|
||||
mariadb.cnf: |
|
||||
[client]
|
||||
default-character-set = utf8
|
||||
[mysqld]
|
||||
character-set-server = utf8
|
||||
collation-server = utf8_general_ci
|
||||
# InnoDB optimizations
|
||||
innodb_log_file_size = 64M
|
||||
galera.cnf: |
|
||||
[galera]
|
||||
user = mysql
|
||||
bind-address = 0.0.0.0
|
||||
# Optimizations
|
||||
innodb_flush_log_at_trx_commit = 0
|
||||
sync_binlog = 0
|
||||
expire_logs_days = 7
|
||||
# Required settings
|
||||
default_storage_engine = InnoDB
|
||||
binlog_format = ROW
|
||||
innodb_autoinc_lock_mode = 2
|
||||
query_cache_size = 0
|
||||
query_cache_type = 0
|
||||
# MariaDB Galera settings
|
||||
#wsrep_debug=ON
|
||||
wsrep_on=ON
|
||||
wsrep_provider=/usr/lib/galera/libgalera_smm.so
|
||||
wsrep_sst_method=rsync
|
||||
# Cluster settings (automatically updated)
|
||||
wsrep_cluster_address=gcomm://
|
||||
wsrep_cluster_name=galera
|
||||
wsrep_node_address=127.0.0.1
|
|
@ -0,0 +1,12 @@
|
|||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: mysql-secrets
|
||||
namespace: galera
|
||||
labels:
|
||||
app: mysql
|
||||
data:
|
||||
# Root password: changeit run echo -n jimmysong|base64
|
||||
root-password: amltbXlzb25n
|
||||
# Root user: root
|
||||
root-user: cm9vdA==
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue