1 Star 1 Fork 0

安家/tidb-ansible

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
unsafe_cleanup_data.yml 4.11 KB
一键复制 编辑 原始数据 按行查看 历史
---
# Copyright 2016 PingCAP, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# See the License for the specific language governing permissions and
# limitations under the License.
# The playbook of TiDB
- name: check config locally
hosts: localhost
tags:
- always
roles:
- check_config_static
- name: gather all facts, and check dest
hosts: all
tags:
- always
roles:
- check_config_dynamic
- name: TiDB cluster
hosts: tidb_servers
tags:
- tidb
tasks:
- name: stop TiDB by supervise
shell: cd {{ deploy_dir }}/scripts && ./stop_{{ item }}.sh
when: process_supervision == 'supervise'
with_items:
- tidb
- name: stop TiDB by systemd
systemd: name=tidb-{{ tidb_port }}.service state=stopped
become: true
when: process_supervision == 'systemd'
- name: wait until the TiDB port is down
wait_for:
host: "{{ ansible_host }}"
port: "{{ tidb_port }}"
state: stopped
msg: "the TiDB port {{ tidb_port }} is not down"
- name: pump cluster
hosts: pump_servers
tags:
- pump
tasks:
- name: stop pump by supervise
shell: cd {{ deploy_dir }}/scripts && ./stop_{{ item }}.sh
with_items:
- pump
when:
- enable_binlog|default(false)
- process_supervision == 'supervise'
- name: stop pump by systemd
systemd: name=pump-{{ pump_port }}.service state=stopped
become: true
when:
- enable_binlog|default(false)
- process_supervision == 'systemd'
- name: wait until the pump port is down
wait_for:
host: "{{ ansible_host }}"
port: "{{ pump_port }}"
state: stopped
msg: "the pump port {{ pump_port }} is not down"
when: enable_binlog|default(false)
- name: clean pump data
file: path={{ pump_data_dir }} state=absent
when: enable_binlog|default(false)
- name: TiKV cluster
hosts: tikv_servers
tasks:
- name: stop TiKV by supervise
shell: cd {{ deploy_dir }}/scripts && ./stop_{{ item }}.sh
when: process_supervision == 'supervise'
with_items:
- tikv
- name: stop TiKV by systemd
systemd: name=tikv-{{ tikv_port }}.service state=stopped
become: true
when: process_supervision == 'systemd'
- name: wait until the TiKV port is down
wait_for:
host: "{{ ansible_host }}"
port: "{{ tikv_port }}"
state: stopped
msg: "the TiKV port {{ tikv_port }} is not down"
- name: clean TiKV data
file: path={{ tikv_data_dir }} state=absent
- name: create new TiKV data dir
file: path={{ tikv_data_dir }} state=directory mode=0755
- name: clean TiKV wal data
file: path={{ wal_dir }} state=absent
when: wal_dir is defined
- name: create new TiKV wal data dir
file: path={{ wal_dir }} state=directory mode=0755
when: wal_dir is defined
- name: clean TiKV raftdb data
file: path={{ raftdb_path }} state=absent
when: raftdb_path is defined
- name: create new TiKV raftdb data dir
file: path={{ raftdb_path }} state=directory mode=0755
when: raftdb_path is defined
- name: PD cluster
hosts: pd_servers
tasks:
- name: stop PD by supervise
shell: cd {{ deploy_dir }}/scripts && ./stop_{{ item }}.sh
when: process_supervision == 'supervise'
with_items:
- pd
- name: stop PD by systemd
systemd: name=pd-{{ pd_client_port }}.service state=stopped
become: true
when: process_supervision == 'systemd'
- name: wait until the PD port is down
wait_for:
host: "{{ ansible_host }}"
port: "{{ pd_client_port }}"
state: stopped
msg: "the PD port {{ pd_client_port }} is not down"
- name: clean PD data
file: path={{ pd_data_dir }} state=absent
- name: create new PD data dir
file: path={{ pd_data_dir }} state=directory mode=0755
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/anjia/tidb-ansible.git
git@gitee.com:anjia/tidb-ansible.git
anjia
tidb-ansible
tidb-ansible
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385