• MySQL备份还原之一mydumper


    1)源码编译安装

    1.下载 mydumper源码
    2.解压
    [mysql@localhost ~]$ tar -xvf mydumper-0.9.1.tar
    mydumper-0.9.1/CMakeLists.txt
    mydumper-0.9.1/README
    mydumper-0.9.1/binlog.c
    mydumper-0.9.1/binlog.h
    mydumper-0.9.1/cmake/
    mydumper-0.9.1/common.h
    mydumper-0.9.1/config.h.in
    mydumper-0.9.1/docs/
    mydumper-0.9.1/g_unix_signal.c
    mydumper-0.9.1/g_unix_signal.h
    mydumper-0.9.1/mydumper.c
    mydumper-0.9.1/mydumper.h
    mydumper-0.9.1/myloader.c
    mydumper-0.9.1/myloader.h
    mydumper-0.9.1/server_detect.c
    mydumper-0.9.1/server_detect.h
    mydumper-0.9.1/cmake/modules/
    mydumper-0.9.1/cmake/modules/CppcheckTargets.cmake
    mydumper-0.9.1/cmake/modules/FindGLIB2.cmake
    mydumper-0.9.1/cmake/modules/FindMySQL.cmake
    mydumper-0.9.1/cmake/modules/FindPCRE.cmake
    mydumper-0.9.1/cmake/modules/FindSphinx.cmake
    mydumper-0.9.1/cmake/modules/Findcppcheck.cmake
    mydumper-0.9.1/cmake/modules/Findcppcheck.cpp
    mydumper-0.9.1/docs/CMakeLists.txt
    mydumper-0.9.1/docs/_build/
    mydumper-0.9.1/docs/_static/
    mydumper-0.9.1/docs/authors.rst
    mydumper-0.9.1/docs/compiling.rst
    mydumper-0.9.1/docs/examples.rst
    mydumper-0.9.1/docs/files.rst
    mydumper-0.9.1/docs/index.rst
    mydumper-0.9.1/docs/mydumper_usage.rst
    mydumper-0.9.1/docs/myloader_usage.rst
    mydumper-0.9.1/docs/_build/conf.py.in
    mydumper-0.9.1/docs/_build/sources.cmake.in
    
    3.cmake 编译
    [mysql@localhost ~]$ cd /u01/mydumper-0.9.1/
    [mysql@localhost mydumper-0.9.1]$ cmake .
    -- The C compiler identification is GNU 4.8.5
    -- The CXX compiler identification is GNU 4.8.5
    -- Check for working C compiler: /bin/cc
    -- Check for working C compiler: /bin/cc -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working CXX compiler: /bin/c++
    -- Check for working CXX compiler: /bin/c++ -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Using mysql-config: /u01/my3306/bin/mysql_config
    -- Found MySQL: /u01/my3306/include, /u01/my3306/lib/libmysqlclient.so;/usr/lib64/libpthread.so;/usr/lib64/libm.so;/usr/lib64/libssl.so;/usr/lib64/libcrypto.so;/usr/lib64/libdl.so
    -- Found ZLIB: /usr/lib64/libz.so (found version "1.2.7") 
    -- Found PkgConfig: /bin/pkg-config (found version "0.27.1") 
    -- checking for one of the modules 'glib-2.0'
    -- checking for one of the modules 'gthread-2.0'
    -- checking for module 'libpcre'
    --   found libpcre, version 8.32
    -- Found PCRE: /usr/include  
    
    CMake Warning at docs/CMakeLists.txt:9 (message):
      Unable to find Sphinx documentation generator
    
    
    -- ------------------------------------------------
    -- MYSQL_CONFIG = /u01/my3306/bin/mysql_config
    -- CMAKE_INSTALL_PREFIX = /usr/local
    -- BUILD_DOCS = ON
    -- WITH_BINLOG = OFF
    -- RUN_CPPCHECK = OFF
    -- Change a values with: cmake -D<Variable>=<Value>
    -- ------------------------------------------------
    -- 
    -- Configuring done
    -- Generating done
    -- Build files have been written to:
      /u01/mydumper-0.9.1
    
    4.make &&make install
    [mysql@localhost mydumper-0.9.1]$ make
    Scanning dependencies of target mydumper
    [ 25%] Building C object CMakeFiles/mydumper.dir/mydumper.c.o
    [ 50%] Building C object CMakeFiles/mydumper.dir/server_detect.c.o
    [ 75%] Building C object CMakeFiles/mydumper.dir/g_unix_signal.c.o
    Linking C executable mydumper
    [ 75%] Built target mydumper
    Scanning dependencies of target myloader
    [100%] Building C object CMakeFiles/myloader.dir/myloader.c.o
    Linking C executable myloader
    [100%] Built target myloader
    [mysql@localhost mydumper-0.9.1]$ make install
    [ 75%] Built target mydumper
    [100%] Built target myloader
    Install the project...
    -- Install configuration: ""
    -- Installing: /usr/local/bin/mydumper
    -- Removed runtime path from "/usr/local/bin/mydumper"
    -- Installing: /usr/local/bin/myloader
    -- Removed runtime path from "/usr/local/bin/myloader"
    

    2)全库备份

    mydumper 
      --user=root 
      --password= 
      --socket=/u01/mysql/my3306/run/mysql.sock 
      --regex '^(?!(mysql))' 
      --outputdir=/u01/mysql/my3306/backup/ 
      --compress 
      --verbose=3 
      --logfile=/u01/mysql/my3306/backup/mydumper.log
    

  • 相关阅读:
    mysql全文索引
    oracle窗口函数的实战
    数据库的三大范式
    Oracle12cR1 Data Guard 实施文档
    Oracle 11gR2 RAC 删除节点
    Jboss部署文档
    Hexo搭建静态博客踩坑日记(一)
    一行代码引入博客园樱花飘落特效
    Hexo搭建静态博客踩坑日记(二)
    学习axios必知必会(2)~axios基本使用、使用axios前必知细节、axios和实例对象区别、拦截器、取消请求
  • 原文地址:https://www.cnblogs.com/chinesern/p/7245897.html
Copyright © 2020-2023  润新知