Skip to content
This repository has been archived by the owner on Jun 24, 2021. It is now read-only.

Commit

Permalink
Add create directory automatically (#1103) (#1104)
Browse files Browse the repository at this point in the history
  • Loading branch information
liubo0127 authored Jan 9, 2020
1 parent a4d37ca commit 40a4c3e
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 2 deletions.
1 change: 0 additions & 1 deletion conf/tidb-lightning.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ lightning:

# logging
level: "info"
file: "log/tidb_lightning.log"
max-size: 128 # MB
max-days: 28
max-backups: 14
Expand Down
1 change: 0 additions & 1 deletion conf/tikv-importer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

global:
# log file.
log-file: "log/tikv_importer.log"
# log level: trace, debug, info, warn, error, off.
log-level: "info"

Expand Down
3 changes: 3 additions & 0 deletions roles/tidb_lightning/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ tidb_port: "{{ hostvars[groups.tidb_servers[0]].tidb_port }}"
tidb_user: "root"
tidb_password: ""
tidb_status_port: "{{ hostvars[groups.tidb_servers[0]].tidb_status_port }}"
lightning_log_dir: "{{ deploy_dir }}/log"
lightning_conf_dir: "{{ deploy_dir }}/conf"
lightning_log_file: "tidb_lightning.log"
7 changes: 7 additions & 0 deletions roles/tidb_lightning/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
# tasks file for tidb-lightning

- name: create deploy directories
file: path="{{ item }}" state=directory mode=0755
with_items:
- "{{ lightning_log_dir }}"
- "{{ lightning_conf_dir }}"

- name: "load lightning customized config: tidb-ansible/conf/tidb-lightning.yml"
include_vars: file={{ playbook_dir }}/conf/tidb-lightning.yml name=tidb_lightning_conf_custom

Expand All @@ -12,6 +18,7 @@
tidb_lightning_conf_generated:
lightning:
pprof-port: "{{ tidb_lightning_pprof_port }}"
file: "{{ lightning_log_dir }}/{{ lightning_log_file }}"
tikv_importer:
addr: "{{ hostvars[groups.importer_server[0]].ansible_host | default(hostvars[groups.importer_server[0]].inventory_hostname) }}:{{ tikv_importer_port }}"
mydumper:
Expand Down
9 changes: 9 additions & 0 deletions roles/tikv_importer/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
---
dummy:

# the listening address of tikv-importer. tidb-lightning needs to connect to this address to write data. Set it to the actual IP address.
tikv_importer_port: 8287

# this directory is used to store the data written by `tidb-lightning`
import_dir: "{{ deploy_dir }}/data.import"

importer_log_dir: "{{ deploy_dir }}/log"
importer_log_file: "tikv_importer.log"
importer_conf_dir: "{{ deploy_dir }}/conf"
4 changes: 4 additions & 0 deletions roles/tikv_importer/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
file: path="{{ item }}" state=directory mode=0755
with_items:
- "{{ import_dir }}"
- "{{ importer_log_dir }}"
- "{{ importer_conf_dir }}"

- name: "load tikv-importer customized config: tidb-ansible/conf/tikv-importer.yml"
include_vars: file={{ playbook_dir }}/conf/tikv-importer.yml name=tikv_importer_conf_custom
Expand All @@ -15,6 +17,8 @@
- name: generate tikv-importer dynamic config
set_fact:
tikv_importer_conf_generated:
global:
log-file: "{{ importer_log_dir }}/{{ importer_log_file }}"
server:
addr: "{{ hostvars[groups.importer_server[0]].ansible_host | default(hostvars[groups.importer_server[0]].inventory_hostname) }}:{{ tikv_importer_port }}"
import:
Expand Down

0 comments on commit 40a4c3e

Please sign in to comment.