๐Ÿ“—
smiley book
  • Smiley Books
  • AI
    • Readme
    • openai-whisper
      • ์ƒ˜ํ”Œ ์‹คํ–‰ํ•ด๋ณด๊ธฐ
      • GPU ์„œ๋ฒ„ ์ค€๋น„ํ•˜๊ธฐ
      • API๋กœ whisper๋ฅผ ์™ธ๋ถ€์— ์˜คํ”ˆํ•˜๊ธฐ
      • ํ”„๋กฌํ”„ํŠธ ์ง€์›
      • ์‹ค์‹œ๊ฐ„ message chat
      • ํ™”๋ฉด ์ด์˜๊ฒŒ ๋งŒ๋“ค๊ธฐ์™€ ๋กœ๊ทธ์ธ
      • ํŒŒ์ด์ฌ ๊ฐ€์ƒํ™˜๊ฒฝ
      • ์‹ค์‹œ๊ฐ„ voice chat
      • fine tunning(๋ฏธ์„ธ ์กฐ์ •) ์œผ๋กœ ์„ฑ๋Šฅ ์˜ฌ๋ฆฌ๊ธฐ
      • app์—์„œ api๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ์‹ค์‹œ๊ฐ„์œผ๋กœ ํ…์ŠคํŠธ๋กœ ๋ฐ”๊ฟ”๋ณด๊ธฐ
    • ollama - llm์„ ์‰ฝ๊ฒŒ ๋‚ด์ปด์—์„œ ์‹คํ–‰
      • ollama webui
      • ollama docker
    • stable diffusion
      • SDXL - text to image
      • SD-webui
    • ChatGPT
      • ๋‹ต๋ณ€์ด ๋Š๊ธธ๋•Œ
      • ์—ญํ• ์„ ์ •ํ•˜์ž
      • ๊ตฌ์ฒด์ ์ธ ์งˆ๋ฌธ
      • ๊ฒฐ๊ณผํ˜•ํƒœ๋ฅผ ์ง€์ •
      • ํ”„๋กฌํ”„ํŠธ๋ฅผ ์—ฌ๋Ÿฌ์ค„๋กœ ์‚ฌ์šฉํ•˜์ž.
      • ๋งˆํ‹ด ํŒŒ์šธ๋Ÿฌ ๊ธ€ ๋ฒˆ์—ญ๋ณธ
    • Prompt Engineering
    • Auto-GPT
    • Gemini
      • google ai studio
      • gemini-api
      • embedding guide
    • Huggingface
      • huggingface ์‚ฌ์šฉ๋ฒ•
      • huggingface nlp ๊ณต๋ถ€์ค‘
    • kaggle
      • download dataset
    • langchain
      • langchain์„ ๊ณต๋ถ€ํ•˜๋ฉฐ ์ •๋ฆฌ
      • basic
      • slackbot
      • rag
      • document-loader
      • website-loader
      • confluence
      • memory
      • function-call
      • langsmith
      • agent-toolkit
  • Ansible
    • templates vs files and jinja2
    • dynamic inventory
    • limit ์˜ต์…˜ ๊ฐ•์ œํ•˜๊ธฐ
    • limit ์‚ฌ์šฉํ›„ gather_fact ๋ฌธ์ œ
  • AWS
    • AWS CLI
    • EKS
      • cluster manage
      • ALB Controller
      • external-dns
      • fargate
    • ECR
    • S3
    • Certificate Manager
  • Azure
    • Azure AD OAuth Client Flow
  • Container
    • Registry
    • ๋นŒ๋“œ์‹œ์— env๊ฐ’ ์„ค์ •ํ•˜๊ธฐ
  • DB
    • PXC
      • Operator
      • PMM
      • ์‚ญ์ œ
      • GTID
      • Cross Site Replication
    • Mssql
    • Mysql
  • dotnet
    • Thread Pool
    • Connection Pool
    • Thread Pool2
  • Devops
    • Recommendation
  • GIT
    • Basic
    • Submodule
  • GitHub
    • Repository
    • GitHub Action
    • GitHub PR
    • Self Hosted Runner
    • GitHub Webhook
  • GitLab
    • CI/CD
    • CI/CD Advance
    • Ssl renew
    • CI/CD Pass env to other job
  • Go Lang
    • ๊ฐœ๋ฐœ ํ™˜๊ฒฝ ๊ตฌ์ถ•
    • multi os binary build
    • kubectl๊ฐ™์€ cli๋งŒ๋“ค๊ธฐ
    • azure ad cli
    • embed static file
    • go study
      • pointer
      • module and package
      • string
      • struct
      • goroutine
  • Kubernetes
    • Kubernetes๋Š” ๋ฌด์—‡์ธ๊ฐ€
    • Tools
    • Install with kubespray
    • Kubernetes hardening guidance
    • 11 ways not to get hacked
    • ArgoCD
      • Install
      • CLI
      • Repository
      • Apps
      • AWS ALB ์‚ฌ์šฉ
      • Notification slack
      • Backup / DR
      • Ingress
      • 2021-11-16 Github error
      • Server Config
      • auth0 ์ธ์ฆ ์ถ”๊ฐ€(oauth,OIDC)
    • Extension
      • Longhorn pvc
      • External dns
      • Ingress nginx
      • Cert Manager
      • Kube prometheus
    • Helm
      • Subchart
      • Tip
    • Loki
    • Persistent Volume
    • TIP
      • Job
      • Pod
      • Log
  • KAFKA
    • raft
  • KVM
    • kvm cpu model
  • Linux
    • DNS Bind9
      • Cert-Manager
      • Certbot
      • Dynamic Update
      • Log
    • Export and variable
    • Grep ์‚ฌ์šฉ๋ฒ•
  • Modeling
    • C4 model introduce
    • Mermaid
    • reference
  • Monitoring
    • Readme
    • 0. What is Monitoring
    • 1. install prometheus and grafana
    • 2. grafana provisioning
    • 3. grafana dashboard
    • 4. grafana portable dashboard
    • 5. prometheus ui
    • 6. prometheus oauth2
    • Prometheus
      • Metric type
      • basic
      • rate vs irate
      • k8s-prometheus
    • Grafana
      • Expolorer
    • Node Exporter
      • advance
      • textfile collector
  • Motivation
    • 3 Simple Rule
  • OPENNEBULA
    • Install(ansible)
    • Install
    • Tip
    • Windows vm
  • Reading
    • comfort zone
    • ๋ฐฐ๋ ค
    • elon musk 6 rule for insane productivity
    • Feynman Technique
    • how to interview - elon musk
    • ๊ฒฝ์ฒญ
    • Readme
  • Redis
    • Install
    • Master-slave Architecture
    • Sentinel
    • Redis Cluster
    • Client programming c#
  • SEO
    • Readme
  • Security
    • criminalip.io
      • criminalip.io
  • Stock
    • robinhood-python
  • Terraform
    • moved block
    • output
  • vault
    • Readme
  • VS Code
    • dev container
    • dev container on remote server
  • Old fashione trend
    • curity
    • MAAS
      • Install maas
      • Manage maas
      • Tip
Powered by GitBook
On this page
  • percona-xtradb-cluster-operator
  • password setting
  • ๋””๋น„ ๋””ํ”Œ๋กœ์ด
  • ๋ฐฑ์—…
  • ๋ณต๊ตฌ
  • DR
  • ๊ฒฐ๋ก 
  • ์•Œ๊ณ  ์žˆ๋Š” ๋ฌธ์ œ

Was this helpful?

  1. DB
  2. PXC

Operator

mysql์„ ์„ค์น˜ํ•ด์ฃผ๊ณ  ๋ณต์ œํ•ด์ฃผ๊ณ  ๋ชจ๋“ ๊ฑธ ์ž๋™์œผ๋กœ ํ•ด์ฃผ๋Š”๊ฒƒ์ด ๋ชฉํ‘œ

pv/pvc๊ฐ€ ์—†์ด tempdir ์ด๋‚˜ hostpath๋กœ๋„ ํ…Œ์ŠคํŠธ๋Š” ๊ฐ€๋Šฅํ•˜๋‚˜ ๋ฐฑ์—…/๋ณต๊ตฌ ๋“ฑ์— ๋ฌธ์ œ๊ฐ€ ์žˆ๋‹ค.

ํ˜„์žฌ๋Š” ๋ชจ๋“  ์Šคํฌ๋ฆฝํŠธ๊ฐ€ pv/pvc๊ฐ€ ์žˆ๋Š”๊ฒƒ์„ ๊ฐ€์ •ํ•˜๋Š”๊ฒƒ ๊ฐ™๋‹ค. ๊ทธ๋Ÿฌ๋ฏ€๋กœ ์•ž์— ์„ค์น˜ํ•œ longhorn์„ ์„ค์น˜๋ฅผ ํ•ด๋‘๊ณ  ์ž‘์—…ํ•˜๊ธฐ๋ฅผ ๋ฐ”๋ž€๋‹ค

percona-xtradb-cluster-operator

git clone -b v1.8.0 https://github.com/percona/percona-xtradb-cluster-operator

cd percona-xtradb-cluster-operator/deploy

k create namespace pxc-mysql

kcn pxc-mysql
k get pod
k apply -f crd.yaml
k apply -f rbac.yaml
k apply -f operator.yaml
# ๋˜๋Š” ํ•ฉ์ณ์ ธ์žˆ๋Š” k apply -f bundle.yaml

password setting

์ด์ œ ๊ด€๋ จ ๋น„๋ฐ€๋ฒˆํ˜ธ๋“ฑ์„ ์„ค์ •ํ•˜์ž. ๋น„๋ฒˆ์„ ์ „๋ถ€ ๋ฐ”๊พผ๋‹ค. ์ ์šฉํ•œ๋‹ค.

cat secrets.yaml

apiVersion: v1
kind: Secret
metadata:
  name: my-cluster-secrets # ์ด๋ฆ„ ์ค‘์š”
type: Opaque
stringData:
  root: your-password
  xtrabackup: your-password
  monitor: your-password
  clustercheck: your-password
  proxyadmin: your-password
  pmmserver: your-password
  operator: your-password
  replication: your-password

์ ์šฉํ•˜์ž.

k apply -f secrets.yaml

aws์— ๋ฐฑ์—…์„ ํ•˜๊ธฐ ์œ„ํ•œ ๋น„๋ฒˆ๋„ ํ•„์š”ํ•˜๋‹ค.

cat backup-s3.yaml

apiVersion: v1
kind: Secret
metadata:
  name: backup-s3 # ์ด๋ฆ„
  namespace: pxc-mysql
type: Opaque
data:
  AWS_ACCESS_KEY_ID: QUtJQVxxxjc=
  AWS_SECRET_ACCESS_KEY: VktqdzZWTjRDMjxxxY5MUQ5OQ==
k apply -f backup-s3.yaml

๋””๋น„ ๋””ํ”Œ๋กœ์ด

cr.yaml
secretsName: my-cluster-secrets # secret.yml์— ์žˆ๋Š” ์ด๋ฆ„์„ ๋„ฃ์–ด์ค˜์•ผํ•จ.
allowUnsafeConfigurations: true # tls ํ†ต์‹ ์•ˆ์“ฐ๋Š”๊ฒƒ์œผ๋กœ ์ฒ˜๋ฆฌ
haproxy:
  enabled: false # proxysql์„ ์‚ฌ์šฉํ•  ์˜ˆ์ •
proxysql:
  enabled: true
  serviceType: LoadBalancer
pmm:
  enabled: true
  image: percona/pmm-client:2.18.0
  serverHost: pxc-pmm-service # pmm-server์—์„œ์˜ ์„œ๋น„์Šค ๋ช…
  serverUser: admin # ํ™•์ธ
backup: # backup ์„ค์ •
  storage:
    s3:
      bucket: S3-BACKUP-BUCKET-NAME-HERE #s3 bucket name
      credentialsSecret: backup-s3 # backup-s3.yaml์— ์žˆ๋Š” ์ด๋ฆ„
      region: us-west-1 # s3 bucket ์œ„์น˜
    #fs-pvc: # ์‚ฌ์šฉํ•˜์ง€ ์•Š์Œ
    schedule: #์Šค์ผ€์ค„์„ ์ ์šฉ
      - name: 'sat-night-backup'
        schedule: '0 0 * * 6'
        keep: 52
        storageName: s3-us-west
      - name: 'daily-backup'
        schedule: '0 0 * * *'
        keep: 7
        storageName: s3-us-west
      - name: 'hourly-backup'
        schedule: '0 * * * *'
        keep: 24
        storageName: s3-us-west

proxysql์„ ์‚ฌ์šฉํ•˜๊ณ  haproxy๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š์Œ.

๋ฐฑ์—… ์„ค์ •

์ ์šฉ

k apply -f cr.yaml
k get svc # loadbalance ipํ™•์ธ

proxysql ๋กœ๋“œ ๋ฐœ๋ž€์Šค ์•„์ดํ”ผ๋กœ ๋””๋น„์— ์ ‘์†ํ•ด๋ณด๋ฉด ๋œ๋‹ค. ( 172.16.4.157 )

์•„๋‹ˆ๋ฉด ๋‹ค์Œ ์ปค๋งจ๋“œ๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.

kubectl run -i --tty --rm percona-client --image=percona --restart=Never \
  -- mysql -h cluster02-pxc.pxc-mysql.svc.cluster.local -uroot -p
#type your password

cluster02-pxc.pxc-mysql.svc.cluster.local - $service-name.$namespace.svc.cluster.local

๋””๋น„์— ํ…Œ์ŠคํŠธ ๋ฐ์ดํ„ฐ๋ฅผ ๋„ฃ์–ด๋ณด์ž.

create database test;
use test;
create table movies(id int auto_increment primary key, name varchar(20) not null);
show tables;
insert into movies(name) values('hello1');
select * from movies;

์ด์ œ ๊ฐ๊ฐ์˜ pod์—์„œ ์ž˜ ์ž‘๋™ํ•˜๋Š”์ง€ ํ™•์ธํ•ด๋ณด์ž.

k get pod์—์„œ ์•„์ดํ”ผ๋ฅผ ์ฐพ์•„์„œ ์•„์ดํ”ผ๋กœ ์ ‘์†ํ•ด๋ณธ๋‹ค.

  • 10.233.111.105

  • 10.233.118.212

  • 10.233.108.255

kubectl run -i --tty --rm percona-client0 --image=percona --restart=Never \
 -- mysql -h 10-233-111-105.pxc-mysql.pod.cluster.local -uroot -p
#type your password

kubectl run -i --tty --rm percona-client1 --image=percona --restart=Never \
 -- mysql -h 10-233-118-212.pxc-mysql.pod.cluster.local -uroot -p
#type your password

kubectl run -i --tty --rm percona-client2 --image=percona --restart=Never \
 -- mysql -h 10-233-108-255.pxc-mysql.pod.cluster.local -uroot -p
#type your password

๋ชจ๋‘ ์ ‘์†ํ•˜์—ฌ

select * from movies

๋ฅผ ์‹คํ–‰ํ•ด์„œ ๋„ฃ์€ ๋ฐ์ดํ„ฐ๊ฐ€ ๋“ค์–ด๊ฐ€ ์žˆ๋Š”์ง€ ํ™•์ธ ํ•œ๋‹ค.

์ž˜ ๋ณต์ œ๋˜๊ณ  ์žˆ๋Š”๊ฒƒ์„ ํ™•์ธํ•˜์˜€๋‹ค.

๋ฐฑ์—…

  • ์ž๋™ ๋ฐฑ์—… ๋ฐฑ์—… ์Šค์ผ€์ค„์„ ํ•ด๋‘์—ˆ์Œ๋กœ ํ•œ์‹œ๊ฐ„์— ํ•œ๋ฒˆ์”ฉ s3 bucket์œผ๋กœ ์—…๋กœ๋“œ ๋œ๋‹ค.

  • ์ˆ˜๋™ ๋ฐฑ์—… ์ˆ˜๋™์œผ๋กœ ๋ฐฑ์—…์„ ๋ฐ›๊ณ  ์‹ถ์œผ๋ฉด yml์„ ์ˆ˜์ •ํ•˜๊ณ  ์ ์šฉํ•˜๋ฉด๋œ๋‹ค.

cat > backup.yaml <<EOF
apiVersion: pxc.percona.com/v1
kind: PerconaXtraDBClusterBackup
metadata:
  #  finalizers:
  #    - delete-s3-backup #์ง€์šธ๋•Œ s3 backup๊นŒ์ง€ ๊ฐ™์ด์ง€์šฐ๊ณ  ์‹ถ์€๊ฒฝ์šฐ๋Š” ์‚ฌ์šฉํ•˜์ž.
  name: backup1 # ์ด๋ฆ„์„ ์ž˜ ์„ค์ •ํ•˜์ž.
spec:
  pxcCluster: cluster01
  storageName: s3-us-west
EOF
kubectl apply -f backup/backup.yaml

s3์— ์—…๋กœ๋“œ ๋œ๊ฒƒ์„ ํ™•์ธํ• ์ˆ˜ ์žˆ๋‹ค.

๋ณต๊ตฌ

cat > restore.yaml <<EOF
apiVersion: pxc.percona.com/v1
kind: PerconaXtraDBClusterRestore
metadata:
  name: restore1
spec:
  pxcCluster: cluster01
  backupName: backup1
EOF

kubectl apply -f backup/restore.yaml

ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ํ•˜๋‚˜์”ฉ ์—†์• ๊ณ  ๋ณต๊ตฌํ•˜๊ณ  ๋‹ค์‹œ ์˜ฌ๋ ค์ค€๋‹ค.

DR

์ผ๋‹จ ๋…ธ๋“œ 1๊ฐœ๊ฐ€ ๊ณ ์žฅ๋‚˜๋ฉด ์ž๋™์œผ๋กœ ๋‹ค๋ฅธ๋…ธ๋“œ์— ์˜ฌ๋ ค์ฃผ๊ณ  ์ด ๋…ธ๋“œ์—์„œ๋Š” ์ž๋™์œผ๋กœ master์—์„œ ํŒŒ์ผ์„ ๊ฐ€์ ธ์™€์„œ ๋ณต๊ตฌ๋ฅผ ์‹œ๊ฐ„ํ•œํ›„ ์ž๋™์œผ๋กœ ๋ถ™์—ฌ์ค€๋‹ค.

๋งŒ์•ฝ 3๊ฐœ ๋…ธ๋“œ๊ฐ€ ๋™์‹œ์— ๊บผ์ €๋ฒ„๋ฆฌ๋ฉด ๋ฌธ์ œ๊ฐ€ ๋ ๋“ฏ ๋ณด์ธ๋‹ค. ๊ทธ๋ž˜์„œ ์ฐพ์•„๋ดฃ๋”๋‹ˆ 3๊ฐœ ๋…ธ๋“œ์ค‘ ๋งˆ์ง€๋ง‰ ๋ฐ์ดํ„ฐ๊ฐ€ ์ž‡๋Š”๊ณณ์„ ์ฐพ์•„์„œ ๊ทธ๊ณณ์„ ๋งˆ์Šคํ„ฐ๋กœ ์ง€์ •ํ•˜๊ณ  ๋‚œํ›„ ๋‚˜๋จธ์ง€ 2๊ฐœ ๋…ธ๋“œ๋ฅผ ๋‹ค์‹œ ์ž๋™์œผ๋กœ ์˜ฌ๋ ค์ค€๋‹ค๊ณ ํ•˜๋‹ˆ ํฐ ๋ฌธ์ œ๋Š” ์—†์–ด ๋ณด์ธ๋‹ค.

longhorn์—์„œ ์Šคํ† ๋ฆฌ์ง€์— ๋ฆฌํ”Œ๋ฆฌ์นด๋ฅผ ์ง€์›์„ ํ•˜๋ฏ€๋กœ 3๊ฐœ ์ •๋„ ํ•ด๋‘๊ฑฐ๋‚˜ ์ „์ฒด ๋…ธ๋“œ ๋Œ“์ˆ˜์— ํ•ด๋‘๋ฉด ์ „์ฒด ๋…ธ๋“œ์— ๊ฐ™์€ ๋ฐ์ดํ„ฐ๊ฐ€ ์ž‡๋Š”๊ฒƒ์ด๋ฏ€๋กœ ์–ด๋А ๋…ธ๋“œ์—์„œ ์‹คํ–‰์ด ๋˜๋”๋ผ๋„ ์ž๋™์œผ๋กœ ๋ถ™์—ฌ์„œ ์˜ฌ๋ผ์˜ฌ๊ฒƒ์œผ๋กœ ๋ณด์ธ๋‹ค.

๊ฒฐ๋ก 

์ด 3๋Œ€์˜ mysql ํด๋Ÿฌ์Šคํ„ฐ๊ฐ€ ๊ตฌ์„ฑ์ด ๋˜์—ˆ๊ณ  longhorn์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ฐ์ดํ„ฐ๊ฐ€ ์ฟ ๋ฒ  ํด๋Ÿฌ์Šคํ„ฐ์— ์ €์žฅ์ด ๋œ๋‹ค. ๋ฐฑ์—…์€ s3๋กœ ์ž๋™์œผ๋กœ ์—…๋กœ๋“œ๊ฐ€ ๋œ๋‹ค. pmm์œผ๋กœ ๋ชจ๋‹ˆํ„ฐ๋ง์ด ๊ฐ€๋Šฅํ•˜๋‹ค.

์•Œ๊ณ  ์žˆ๋Š” ๋ฌธ์ œ

๊ฐ€๋” ํ…Œ์ŠคํŠธํ•œ๊ฒƒ๋“ค์„ ์ง€์šฐ๋ ค๊ณ  ํ• ๋•Œ ํ–‰๊ฑธ๋ฆฌ๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ๋‹ค. backup์ด ์•ˆ์ง€์›Œ์ ธ์„œ ๊ทธ๋Ÿฐ ๊ฒฝ์šฐ๊ฐ€ ์žˆ์Œ

pxc-backups๋กœ ๊ฒ€์ƒ‰ํ•ด์„œ edit ํ•ด์„œ finalize๋ฅผ ์ง€์›Œ์ค˜์•ผ ํ•œ๋‹ค.

์™ธ๋ถ€ ์Šคํ† ๋ฆฌ์ง€๋ฅผ ์ง€์šฐ์ง€ ๋ชปํ•ด์„œ ํ–‰์ด ๊ฑธ๋ฆฌ๋Š”๊ฑด๋ฐ ์ด ๋ถ€๋ถ„์„ ๋ฌด์‹œํ•˜๊ณ  ์ง€๋‚ ์ˆ˜ ์žˆ๋‹ค.

PreviousPXCNextPMM

Last updated 1 year ago

Was this helpful?

https://www.percona.com/doc/kubernetes-operator-for-pxc/backups.html#making-on-demand-backup
https://youtu.be/V3ko5NpTMPA?t=895