Linux系统必须安装有Go语言:
下载最新的包:https://github.com/datacharmer/dbdeployer/releases  
   解压:  tar -xzf dbdeployer-1.5.0.linux.tar.gz
   赋予执行权限: chmod +x dbdeployer-1.5.0.linux
   拷贝到bin目录: sudo mv dbdeployer-1.5.0.linux /usr/local/bin/dbdeployer dbdeployer可以快速搭建多个MySQL测试环境(主从复制,主主复制,GTID复制,组复制(单主或多主),多源复制等) 部署MySQL环境都是秒级别(10-30秒,根据实例多少有关),使用起来很方便,还有各种管理命令。 dbdeployer unpack mysql-8.0.-linux-glibc2.-x86_64.tar.gz --sandbox-binary=/usr/local dbdeployer deploy single 8.0. --bind-address=0.0.0.0 --port= --sandbox-home=/home/data --sandbox-binary=/usr/local
--sandbox-home 数据文件的安装目录
--sandbox-binary 是安装MySQL的二进制文件程序目录
--bind-address 4个0代表全部
--port 代表MySQL的端口 -- cd 到/home/data下 --mysql 8.0.11 创建用户  ./use 进去 修改密码和权限,否则不能修改Authentication plugin 'caching_sha2_password' cannot be loaded:
ALTER user'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'cc.123';
create USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'cc.123'; FLUSH PRIVILEGES; --再授权
mysql -u root -p -S /tmp/mysql_sandbox3308.sock -- 进入
grant all on *.* to 'root'@'%' WITH GRANT OPTION; FLUSH PRIVILEGES;
如果想在安装的时候就赋予权限,直接使用参数:
--post-grants-sql="grant all on *.* to 'root'@'%' WITH GRANT OPTION " --删除已经部署的mysql

dbdeployer delete rsandbox_8_0_11 --sandbox-home=/home/data -- sandbox-binary=/usr/local;

   --这里的:rsandbox_8_0_11  是文件夹名称

--部署1主多从(1拖4) (using ports 18601, 18602, 18603,18604)
   dbdeployer deploy replication 8.0.11 --bind-address=0.0.0.0 --base-port=18600 --sandbox-home=/home/data --sandbox-binary=/usr/local --nodes=4;

--部署4个mysql,(using ports 18601, 18602, 18603,18604)
   dbdeployer deploy multiple 8.0.11 --bind-address=0.0.0.0 --base-port=18600 --sandbox-home=/home/data --sandbox-binary=/usr/local --nodes=4;

   安装3主2从(多主多从):

dbdeployer deploy replication --topology=fan-in   --nodes=5 --master-list="1,2,3"  --bind-address=0.0.0.0  --native-auth-plugin  --slave-list="4,5"  8.0.11 --sandbox-home=/home/data  --remote-access="%" --sandbox-binary=/usr/local  --db-password="cc.123" --db-user="sa"  --post-grants-sql="grant all on *.* to 'sa'@'%' WITH GRANT OPTION "

--remote-access="%"  账户远程访问的IP,% 为全部

--db-user 新数据库账户

--db-password 数据库密码

--post-grants-sql  后面执行的数据库授权Sql

--native-auth-plugin  客户端如SQLLog可以访问MySQL,是在MySQL 8.0.4+ 有效

   安装组复制:

dbdeployer deploy replication --topology=group     --bind-address=0.0.0.0      8.0.11 --sandbox-home=/home/data --remote-access="%" --sandbox-binary=/usr/local --native-auth-plugin  --db-password="cc.123" --db-user="sa"  --post-grants-sql="grant all on *.* to 'sa'@'%' WITH GRANT OPTION ";

加上:--single-primary  明确是单主

dbdeployer deploy --topology=all-masters replication  --bind-address=0.0.0.0   8.0.11 --sandbox-home=/home/td  --remote-access="%" --sandbox-binary=/usr/local --native-auth-plugin --db-password="cc.123" --db-user="sa"  --post-grants-sql="grant all on *.* to 'sa'@'%' WITH GRANT OPTION " --concurrent;

详细说明:
      --base-port int                 Overrides default base-port (for multiple sandboxes)
      --binary-version string         Specifies the version when the basedir directory name does not contain it (i.e. it is not x.x.xx)
      --bind-address string           defines the database bind-address  (default "127.0.0.1")
      --concurrent                    Runs multiple sandbox deployments concurrently
      --custom-mysqld string          Uses an alternative mysqld (must be in the same directory as regular mysqld)
  -p, --db-password string            database password (default "msandbox")
  -u, --db-user string                database user (default "msandbox")
      --defaults strings              Change defaults on-the-fly (--defaults=label:value)
      --disable-mysqlx                Disable MySQLX plugin (8.0.11+)
      --enable-general-log            Enables general log for the sandbox (MySQL 5.1+)
      --enable-mysqlx                 Enables MySQLX plugin (5.7.12+)
      --expose-dd-tables              In MySQL 8.0+ shows data dictionary tables
      --force                         If a destination sandbox already exists, it will be overwritten
      --gtid                          enables GTID
  -h, --help                          help for deploy
      --init-general-log              uses general log during initialization (MySQL 5.1+)
  -i, --init-options strings          mysqld options to run during initialization
      --keep-server-uuid              Does not change the server UUID
      --my-cnf-file string            Alternative source file for my.sandbox.cnf
  -c, --my-cnf-options strings        mysqld options to add to my.sandbox.cnf
      --native-auth-plugin            in 8.0.4+, uses the native password auth plugin
      --port int                      Overrides default port
      --post-grants-sql strings       SQL queries to run after loading grants
      --post-grants-sql-file string   SQL file to run after loading grants
      --pre-grants-sql strings        SQL queries to run before loading grants
      --pre-grants-sql-file string    SQL file to run before loading grants
      --remote-access string          defines the database access  (default "127.%")
      --rpl-password string           replication password (default "rsandbox")
      --rpl-user string               replication user (default "rsandbox")
      --sandbox-directory string      Changes the default sandbox directory
      --skip-load-grants              Does not load the grants
      --skip-report-host              Does not include report host in my.sandbox.cnf
      --skip-report-port              Does not include report port in my.sandbox.cnf
      --skip-start                    Does not start the database server
      --use-template strings          [template_name:file_name] Replace existing template with one from file

说明:

$ dbdeployer deploy replication 5.7.21
        # (implies topology = master-slave) 默认主从

$ dbdeployer deploy --topology=master-slave replication 5.7.21
        # (explicitly setting topology) 明确主从

$ dbdeployer deploy --topology=group replication 5.7.21  组复制多主
        $ dbdeployer deploy --topology=group replication 8.0.4 --single-primary 组复制单主
        $ dbdeployer deploy --topology=all-masters replication 5.7.21   多主复制
        $ dbdeployer deploy --topology=fan-in replication 5.7.21  多主单(多)从复制

   注意: 安装的过程中当前目录一定有,不然报错。比如在删除的rsandbox_8_0_11文件夹下执行dbdeployer命令

   配置后的备份:cd到MySQL的bin下执行   

./mysqldump -h 192.168.60.167  -u sa -p -P8011 --socket=/tmp/mysql_sandbox8011.sock  test > test_db.sql;

 

dbdeployer 快速安装MySQL8.0各测试环境的更多相关文章

  1. centos7.0利用yum快速安装mysql8.0

    我这里直接使用MySQL Yum存储库的方式快速安装: 抽象 MySQL Yum存储库提供用于在Linux平台上安装MySQL服务器,客户端和其他组件的RPM包.这些软件包还可以升级和替换从Linux ...

  2. centos 7下安装mysql-8.0

    本篇文章主要介绍在centos7 环境下安装mysql8.0并设置为开机自启. 安装步骤 1.配置yum源 首先在 https://dev.mysql.com/downloads/repo/yum/  ...

  3. 源码编译安装MySQL8.0

    源码编译安装MySQL8.0 0.前期准备条件 查看linux的版本 [root@mysql etc]# cat /etc/redhat-release CentOS Linux release 7. ...

  4. 【转】mysql8.0 在window环境下的部署与配置

    [转]mysql8.0 在window环境下的部署与配置 今天在阿里云window服务器上配置mysql环境,踩了一些坑,分享出来.需要的朋友可以看看.额,或许有人要吐槽我为什么不在linux上去配置 ...

  5. CentOS7安装MySQL8.0小计

    之前讲配置文件和权限的时候有很多MySQL8的知识,有同志说安装不太一样,希望发个文,我这边简单演示一下 1.环境安装 下载MySQL提供的CentOS7的yum源 官方文档:<https:// ...

  6. 【Linux系列】Centos 7安装 Mysql8.0(五)

    目的 本文主要介绍以下两点: 一. 如何安装Mysql8.0 二. Navicat连接Mysql 一. 如何安装Mysql8.0 安装Mysql有两种方式: 直接下载官方的源(比较慢) https:/ ...

  7. CentOS8.1操作系下使用通用二进制包安装MySQL8.0(实践整理自MySQL官方)

    写在前的的话: 在IT技术日新月异的今天,老司机也可能在看似熟悉的道路上翻车,甚至是大型翻车现场!自己一个人开车过去翻个车不可怕,可怕的是带着整个团队甚至是整个公司一起翻车山崖下,解决办法就是:新出现 ...

  8. Linux(CentOS-8)安装MySQL8.0.11

    CentOS安装MySQL8.0.11 总的思路就是:安装MySQL,编写配置文件,配置环境变量,成功开启服务,登陆并修改ROOT密码 开启远程访问的思路就是:授权用户所有IP都可以访问,系统的数据库 ...

  9. Linux安装Mysql8.0及SQL分类的补充

    Linux安装Mysql8.0 参考文章:https://blog.csdn.net/qq_38570633/article/details/109257430 参考文献:https://blog.c ...

随机推荐

  1. java注解中的元注解

    一:java注解中的元注解 四个元注解分别是:@Target,@Retention,@Documented,@Inherited , 再次强调下元注解是java API提供,是专门用来定义注解的注解, ...

  2. [Unity3D] 05 - Access to DB or AWS

    可以选择连接本地服务器,或者云服务器. 参考源代码 : https://www.cnblogs.com/wuzhang/p/wuzhang20141202.html (1) 功能:点击一下按键,然后访 ...

  3. Http Referer的一些总结

    以前对Http中Referer的认识不够透彻.最近理了理,记录一下. 1 Referer可以记录访问的来源,统计访问量,可以用来防盗链. 2 客户端用js不能篡改Referer,用一些插件什么的可以达 ...

  4. vue封装第三方插件并发布到npm

    前言 写此文前特意google了一下,因为有较详细的开发教程我再写意义不大,有把插件封装成组件的教程,有把自己的组件封住成插件的教程,本文主要说明如何把第三方的插件封装成vue插件,简化配置,一键安装 ...

  5. 安卓手机优化 ROOT自启动管理 + 电量管理

    一.KingRoot + 净化大师 KingRoot 主要完成ROOT 和 自启动软件的管理 这里禁止的自启动管理 对于有些软件是不太管用 比如美团 手机百度等 净化大师 主要完成 高电量的软件优化 ...

  6. Phoenix系列:二级索引(2)

    上一篇介绍了Phoenix基于HBase的二级索引的基本知识,这一篇介绍一下和索引相关的一致性和优化相关内容. 一致性的保证 Phoenix客户端在成功提交一个操作并且得到成功响应后,就代表你所做的操 ...

  7. Office Web Apps安装部署(二)

    SharePoint 2013调用Office Web Apps 注意:调用OfficeWebApps的sharepoint应用的身份认证必须是基于声明的身份认证(claims-based authe ...

  8. thinkphp 点击某个class提交post值,返回回来用一个弹窗插件,提示返回来要说的话

    下一篇文章有讲到弹窗插件的怎么使用,自写教程 如果能帮到你,给点个赞鼓励一下 <=============  控制器  =================> public function ...

  9. 专访姚冬:All-in-One,智能时代下企业需要更快速的变革

    2017年,msup将咨询服务列入公司发展战略目标,并邀请前IBM大中华区技术总监姚冬成为咨询合伙人.近一年来,msup在咨询服务方面持续发力,与包括百度.平安科技.用友等在内的大型公司形成企业合作联 ...

  10. [No000014F]计算机编程语言家族史

    https://www.levenez.com/lang/