标签:mydumper
ansible脚本 ansible -i /etc/ansible/db/scdb 主 -m shell -a '/home/mysqlbak/mydumper/backup.sh' ansible -i /etc/ansible/db/scdb 主 -m synchronize -a 'mode=pull src=/home/mydumper.tar.gz dest=/home/mydumper.tar.gz' ansible -i /etc/ansible/db/db db -m synchronize -a 'src=/home/mydumper.tar.gz dest=/home/mydumper.tar.gz' ansible-playbook -i /etc/ansible/db/db myloader.yml --extra-vars "hosts=all"
主 cat /home/mysqlbak/mydumper/backup.sh #!/bin/bash rm -rf /home/mydumper /home/mydumper.tar.gz mkdir -p /home/mydumper array=(a b c d) #库名 for num in "${array[@]}" do mydumper -u root -S /home/3306/mysql.sock -p 'password' -B $num -o /home/mydumper done cd /home && tar cvzf mydumper.tar.gz mydumper ansible机器 cat myloader.yml - hosts: "{{hosts}}" remote_user: root gather_facts: no tasks: - name: mysql shell: rm -rf /home/mydumper && cd /home && tar xvzf mydumper.tar.gz - name: myloader shell: myloader -u root -S /opt/{{ mport }}/mysql.sock -p password -t 4 -o -d /home/mydumper 对各个环境mydumper的安装 cat installmydumper.sh #!/bin/bash [ -f /usr/local/bin/mydumper ] && exit 0 yum install gcc-c++ cmake glib2-devel pcre-devel.x86_64 -y yum -y install zlib-devel yum -y install zlib cd /opt/soft tar -zxvf mydumper-0.9.1.tar.gz -C /usr/local/ cd /usr/local/mydumper-0.9.1 cmake . make && make install
4个环境,同步4个库,用时10分钟。jenkins上配置。
标签:mydumper
原文地址:http://blog.51cto.com/szgb17/2047776