Skip to content

Instantly share code, notes, and snippets.

@waynedovey
Created November 5, 2021 02:07
Show Gist options
  • Save waynedovey/945e7d2134c4b6e0fa566c91f3a0a0fd to your computer and use it in GitHub Desktop.
Save waynedovey/945e7d2134c4b6e0fa566c91f3a0a0fd to your computer and use it in GitHub Desktop.
MongoDB Cross-Cluster
<-- cr-main.yaml --->
apiVersion: psmdb.percona.com/v1-10-0
kind: PerconaServerMongoDB
metadata:
name: sydney-cluster
spec:
unmanaged: false
crVersion: 1.10.0
image: percona/percona-server-mongodb:4.4.6-8
imagePullPolicy: Always
allowUnsafeConfigurations: true
updateStrategy: SmartUpdate
upgradeOptions:
versionServiceEndpoint: https://check.percona.com
apply: 4.4-recommended
schedule: "0 2 * * *"
setFCV: false
secrets:
users: sydney-cluster-secrets
pmm:
enabled: false
image: percona/pmm-client:2.18.0
serverHost: monitoring-service
replsets:
- name: rs0
size: 3
# externalNodes:
# - host: 172.132.136.104
# priority: 1
# votes: 1
# - host: 172.132.34.27
# priority: 1
# votes: 1
# - host: 172.132.179.64
# priority: 0
# votes: 0
affinity:
antiAffinityTopologyKey: "kubernetes.io/hostname"
podDisruptionBudget:
maxUnavailable: 1
expose:
enabled: true
exposeType: LoadBalancer
nonvoting:
enabled: false
size: 3
affinity:
antiAffinityTopologyKey: "kubernetes.io/hostname"
resources:
limits:
cpu: "300m"
memory: "0.5G"
requests:
cpu: "300m"
memory: "0.5G"
volumeSpec:
persistentVolumeClaim:
resources:
requests:
storage: 1Gi
arbiter:
enabled: false
size: 1
affinity:
antiAffinityTopologyKey: "kubernetes.io/hostname"
resources:
limits:
cpu: "300m"
memory: "0.5G"
requests:
cpu: "300m"
memory: "0.5G"
volumeSpec:
persistentVolumeClaim:
resources:
requests:
storage: 3Gi
sharding:
enabled: true
configsvrReplSet:
# externalNodes:
# - host: 172.132.21.39
# priority: 1
# votes: 1
# - host: 172.132.144.76
# priority: 1
# votes: 1
# - host: 172.132.0.27
# priority: 0
# votes: 0
size: 3
expose:
enabled: true
exposeType: LoadBalancer
affinity:
antiAffinityTopologyKey: "kubernetes.io/hostname"
podDisruptionBudget:
maxUnavailable: 1
resources:
limits:
cpu: "300m"
memory: "0.5G"
requests:
cpu: "300m"
memory: "0.5G"
volumeSpec:
persistentVolumeClaim:
resources:
requests:
storage: 3Gi
mongos:
size: 3
affinity:
antiAffinityTopologyKey: "kubernetes.io/hostname"
podDisruptionBudget:
maxUnavailable: 1
resources:
limits:
cpu: "300m"
memory: "0.5G"
requests:
cpu: "300m"
memory: "0.5G"
expose:
exposeType: ClusterIP
mongod:
net:
port: 27017
hostPort: 0
security:
redactClientLogData: false
enableEncryption: true
encryptionKeySecret: sydney-cluster-mongodb-encryption-key
encryptionCipherMode: AES256-CBC
setParameter:
ttlMonitorSleepSecs: 60
wiredTigerConcurrentReadTransactions: 128
wiredTigerConcurrentWriteTransactions: 128
storage:
engine: wiredTiger
inMemory:
engineConfig:
inMemorySizeRatio: 0.9
wiredTiger:
engineConfig:
cacheSizeRatio: 0.5
directoryForIndexes: false
journalCompressor: snappy
collectionConfig:
blockCompressor: snappy
indexConfig:
prefixCompression: true
operationProfiling:
mode: slowOp
slowOpThresholdMs: 10000
rateLimit: 100
backup:
enabled: false
<-- cr-replica.yaml -->
apiVersion: psmdb.percona.com/v1-10-0
kind: PerconaServerMongoDB
metadata:
name: melbourne-cluster
spec:
unmanaged: true
# platform: openshift
# clusterServiceDNSSuffix: svc.cluster.local
# pause: true
crVersion: 1.10.0
image: percona/percona-server-mongodb:4.4.6-8
imagePullPolicy: Always
allowUnsafeConfigurations: true
#updateStrategy: SmartUpdate
upgradeOptions:
versionServiceEndpoint: https://check.percona.com
apply: 4.4-recommended
schedule: "0 2 * * *"
setFCV: false
secrets:
users: melbourne-cluster-secrets
# ssl: mebourne-cluster-ssl
# sslInternal: mebourne-cluster-ssl-internal
pmm:
enabled: false
image: percona/pmm-client:2.18.0
serverHost: monitoring-service
replsets:
- name: rs0
size: 3
affinity:
antiAffinityTopologyKey: "kubernetes.io/hostname"
podDisruptionBudget:
maxUnavailable: 1
expose:
enabled: true
exposeType: LoadBalancer
nonvoting:
enabled: false
size: 3
affinity:
antiAffinityTopologyKey: "kubernetes.io/hostname"
resources:
limits:
cpu: "300m"
memory: "0.5G"
requests:
cpu: "300m"
memory: "0.5G"
volumeSpec:
persistentVolumeClaim:
resources:
requests:
storage: 1Gi
arbiter:
enabled: false
size: 1
affinity:
antiAffinityTopologyKey: "kubernetes.io/hostname"
resources:
limits:
cpu: "300m"
memory: "0.5G"
requests:
cpu: "300m"
memory: "0.5G"
volumeSpec:
persistentVolumeClaim:
resources:
requests:
storage: 3Gi
sharding:
enabled: true
configsvrReplSet:
size: 3
expose:
enabled: true
exposeType: LoadBalancer
affinity:
antiAffinityTopologyKey: "kubernetes.io/hostname"
podDisruptionBudget:
maxUnavailable: 1
resources:
limits:
cpu: "300m"
memory: "0.5G"
requests:
cpu: "300m"
memory: "0.5G"
volumeSpec:
persistentVolumeClaim:
resources:
requests:
storage: 3Gi
mongos:
size: 3
affinity:
antiAffinityTopologyKey: "kubernetes.io/hostname"
podDisruptionBudget:
maxUnavailable: 1
resources:
limits:
cpu: "300m"
memory: "0.5G"
requests:
cpu: "300m"
memory: "0.5G"
expose:
exposeType: ClusterIP
mongod:
net:
port: 27017
hostPort: 0
security:
redactClientLogData: false
enableEncryption: true
encryptionKeySecret: mebourne-cluster-mongodb-encryption-key
encryptionCipherMode: AES256-CBC
setParameter:
ttlMonitorSleepSecs: 60
wiredTigerConcurrentReadTransactions: 128
wiredTigerConcurrentWriteTransactions: 128
storage:
engine: wiredTiger
inMemory:
engineConfig:
inMemorySizeRatio: 0.9
wiredTiger:
engineConfig:
cacheSizeRatio: 0.5
directoryForIndexes: false
journalCompressor: snappy
collectionConfig:
blockCompressor: snappy
indexConfig:
prefixCompression: true
operationProfiling:
mode: slowOp
slowOpThresholdMs: 10000
rateLimit: 100
backup:
enabled: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment