mirror of https://github.com/easzlab/kubeasz.git
修改ectd 备份命令和备份路径均在 ansible 节点
parent
1f29e94ef8
commit
90a5755908
|
@ -34,20 +34,17 @@
|
|||
shell: "date +'%Y%m%d%H%M'"
|
||||
register: timestamp
|
||||
|
||||
# step2: backup data on the healthy member
|
||||
# step2: backup data to the ansible node
|
||||
- name: make a backup on the etcd node
|
||||
shell: "mkdir -p /etcd_backup && cd /etcd_backup && \
|
||||
ETCDCTL_API=3 {{ bin_dir }}/etcdctl snapshot save snapshot_{{ timestamp.stdout }}.db"
|
||||
shell: "mkdir -p {{ cluster_dir }}/backup && cd {{ cluster_dir }}/backup && \
|
||||
ETCDCTL_API=3 {{ base_dir }}/bin/etcdctl \
|
||||
--endpoints=https://{{ RUNNING_NODE.stdout }}:2379 \
|
||||
--cacert={{ cluster_dir }}/ssl/ca.pem \
|
||||
--cert={{ cluster_dir }}/ssl/etcd.pem \
|
||||
--key={{ cluster_dir }}/ssl/etcd-key.pem \
|
||||
snapshot save snapshot_{{ timestamp.stdout }}.db"
|
||||
args:
|
||||
warn: false
|
||||
delegate_to: "{{ RUNNING_NODE.stdout }}"
|
||||
|
||||
- name: fetch the backup data
|
||||
fetch:
|
||||
src: /etcd_backup/snapshot_{{ timestamp.stdout }}.db
|
||||
dest: "{{ cluster_dir }}/backup/"
|
||||
flat: yes
|
||||
delegate_to: "{{ RUNNING_NODE.stdout }}"
|
||||
|
||||
- name: update the latest backup
|
||||
shell: 'cd {{ cluster_dir }}/backup/ && /bin/cp -f snapshot_{{ timestamp.stdout }}.db snapshot.db'
|
||||
|
|
Loading…
Reference in New Issue