MySQL中Sandbox怎么安装

技术MySQL中Sandbox怎么安装这篇文章主要介绍MySQL中Sandbox怎么安装,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完! 一 sandbox是什么?MyS

本文主要介绍如何在MySQL中安装沙盒,非常详细,有一定的参考价值。感兴趣的朋友一定要看!

一 sandbox是什么?是一个非常简单快捷的安装和构建MySQL实例的工具,可以快速满足我们对MySQL环境的各种需求。它有:个单实例、主从、一主多从等。(不同于自行安装MySQL软件)。比如新的数据库版本发布后,如果你想尽快采用,又不想花太多资源去安装,可以用沙盒来帮助我们创建一个单一的或者主从结构的实例。对于那些不知道怎么安装MySQL的同学,可以用沙盒快速搭建一个符合要求的数据库。MySQL Sandbox速度很快,用秒来衡量,谁用谁知道。MySQL Sandbox二 如何安装和使用

本文的案例是基于Centos虚拟机测试。

yum安装cpan -y

yum安装perl-测试-简单-y

cpan MySQL:Sandbox

echo ' export SANDBOX _ AS _ ROOT=1 '/ROOT/。bash_profile源/根/。bash_profile

获取percona服务器版本5.7.17。

wget ' https://www . Percona.com/downloads/Percona-Server-5.7/Percona-Server-5 . 7 . 17-11/binary/tarball/Percona-Server-5 . 7 . 17-11-Linux . x86 _ 64 . SSL 101 . tar . gz '

2.1 安装sandbox

安装后,默认情况下会在目录/usr/local/bin/中生成一个以make_开头的文件。

Make_sandbox基于二进制压缩包创建MySQL实例。

Make_sandbox_from_source基于源代码创建MySQL实例,参数是执行。/配置make成功的源代码存储目录。

Make_sandbox_from_installed基于已安装的mysql可执行目录安装MySQL实例。

Make_sandbox_from_url从互联网下载docker映像进行安装。有关详细信息,请参考- help命令。

Make _ multiple _ sandbox创建多个相同版本的MySQL实例。

Make _ multiple _ custom _ sandbox来创建不同版本的MySQL实例。

Make_replication_sandbox构建一个主从复制结构,可以是一个主和一个从,也可以是一个主和多个从。

Sbtool :沙盒管理工具。

要深入了解每个命令的具体用法,请参考源目录中的README文档,然后自己练习,这样可以让你理解得更深刻。毕竟论文来的只是轻描淡写,所以你永远不知道这件事该不该做。主要通过以下几点。

Make_sandbox和make_replication_sandbox介绍如何使用。2.2 常用命令2.3 使用sandbox

root @ RAC 4:/data/MySQL # make _ sandbox/data/MySQL/Percona-Server-5 . 7 . 17-11-Linux . x86 _ 64 . SSL 101 . tar . gz

>

unpacking /data/mysql/Percona-Server-5.7.17-11-Linux.x86_64.ssl101.tar.gz

  • Executing low_level_make_sandbox --basedir=/data/mysql/5.7.17 \

  • --sandbox_directory=msb_5_7_17 \

  • --install_version=5.7 \

  • --sandbox_port=5717 \

  • --no_ver_after_name \

  • --my_clause=log-error=msandbox.err

  •     The MySQL Sandbox, version 3.2.05

  •     (C) 2006-2016 Giuseppe Maxia

  • Installing with the following parameters:

  • upper_directory = /root/sandboxes

  • sandbox_directory = msb_5_7_17

  • sandbox_port = 5717

  • check_port =

  • no_check_port =

  • datadir_from = script

  • install_version = 5.7

  • basedir = /data/mysql/5.7.17

  • tmpdir =

  • my_file =

  • operating_system_user = root

  • db_user = msandbox

  • remote_access = 127.%

  • bind_address = 127.0.0.1

  • ro_user = msandbox_ro

  • rw_user = msandbox_rw

  • repl_user = rsandbox

  • db_password = msandbox

  • repl_password = rsandbox

  • my_clause = log-error=msandbox.err

  • ...... 省略部分内容

  • prompt_prefix = mysql

  • prompt_body = [\h] {\u} (\d) >

  • force =

  • no_ver_after_name = 1

  • verbose =

  • load_grants = 1

  • no_load_grants =

  • no_run =

  • no_show =

  • keep_uuid =

  • history_dir =

  • do you agree? ([Y],n) Y

  • 输入Y 然后sandbox就会启动一个实例,需要等待20s 左右。

    1. # Starting server

    2. . sandbox server started

    3. # Loading grants

    4. Your sandbox server was installed in $HOME/sandboxes/msb_5_7_17

    因为本案例采用root用户安装测试,新生成的数据库目录在 /root/sandboxes/msb_5_7_17,其中的文件如下 
    MySQL中Sandbox怎么安装
    大家可以研究各个可执行文件的具体内容。常用的有use,stop,start,restart 等等,例如

    1. root@rac4:~/sandboxes/msb_5_7_17# >./use --登陆数据库

    2. Welcome to the MySQL monitor. Commands end with ; or \g.

    3. Your MySQL connection id is 9

    4. Server version: 5.7.17-11 Percona Server (GPL), Release 11, Revision f60191c

    5. Copyright (c) 2009-2016 Percona LLC and/or its affiliates

    6. mysql [localhost] {msandbox} ((none)) > show databases;

    7. +--------------------+

    8. | Database           |

    9. +--------------------+

    10. | information_schema |

    11. | mysql              |

    12. | performance_schema |

    13. | sys                |

    14. | test               |

    15. +--------------------+

    16. 5 rows in set (0.00 sec)

    搭建主从,本例中启用gtid 并且设置创建1个slave. 因为上例已经创建了一个5.7.17 源程序目录,我们可以基于该目录创建主从,当然也可以基于源码的压缩包。

    1. root@rac4:/data/mysql# >make_replication_sandbox --gtid --how_many_slaves=1  5.7.17

    2. installing and starting master

    3. installing slave 1

    4. starting slave 1

    5. .. sandbox server started

    6. initializing slave 1

    7. replication directory installed in $HOME/sandboxes/rsandbox_5_7_17

    根据结果提示sandbox创建的主从在目录$HOME/sandboxes/rsandbox_5_7_17,进入该目录查看有如下文件 
    MySQL中Sandbox怎么安装
    其中master 和node1 分别是主库和备库的数据库目录, m和n1 都是登陆主库的命令,s1 和n2 都是登陆slave 的命令,其他的可以从文件名知道具体用途。这里介绍两个命令test_replication和check_slaves 两个命令功能类似,都是检查slave 的状态信息。check_slaves会把主库相关信息输出。

    1. root@rac4:~/sandboxes/rsandbox_5_7_17# >sh test_replication   检查主备关系

    2. # Master log: mysql-bin.000001 - Position: 10732 - Rows: 20

    3. # Testing slave #1

    4. ok - Slave #1 acknowledged reception of transactions from master

    5. ok - Slave #1 IO thread is running

    6. ok - Slave #1 SQL thread is running

    7. ok - Table t1 found on slave #1

    8. ok - Table t1 has 20 rows on #1

    9. # TESTS : 5

    10. # FAILED: 0 ( 0.0%)

    11. # PASSED: 5 (100.0%)

    12. # exit code: 0

    13. root@rac4:~/sandboxes/rsandbox_5_7_17# >./check_slaves  #

    14. master

    15. port: 20192

    16.              File: mysql-bin.000001

    17.          Position: 10732

    18. Executed_Gtid_Set: 00020192-1111-1111-1111-111111111111:1-40

    19. slave # 1

    20. port: 20193

    21.               Master_Log_File: mysql-bin.000001

    22.           Read_Master_Log_Pos: 10732

    23.              Slave_IO_Running: Yes

    24.             Slave_SQL_Running: Yes

    25.           Exec_Master_Log_Pos: 10732

    26.            Retrieved_Gtid_Set: 00020192-1111-1111-1111-111111111111:1-40

    27.             Executed_Gtid_Set: 00020192-1111-1111-1111-111111111111:1-40

    以上是“MySQL中Sandbox怎么安装”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注行业资讯频道!

    内容来源网络,如有侵权,联系删除,本文地址:https://www.230890.com/zhan/62662.html

    (0)

    相关推荐

    • 至于颠覆,古汉语中“至于”有些什么意思

      技术至于颠覆,古汉语中“至于”有些什么意思古义:甚至至于颠覆。
      源自《战国策·触龙说赵太后》:
      左师公曰:“今三世以前,至于赵之为赵,赵王之子孙侯者,其继有在者乎?”
      古义:造成
      源自《三国志·蜀志·诸葛亮传·隆中对》

      生活 2021年10月20日
    • 碳还原氧化铁的化学方程式,碳还原氧化铁的化学方程式

      技术碳还原氧化铁的化学方程式,碳还原氧化铁的化学方程式氧化铁与碳发生反应的化学方程式碳还原氧化铁的化学方程式:2Fe2O3+3C=高温=4Fe+3CO2(气体)氧化铁,别名三氧化二铁、烧褐铁矿、烧赭土、铁丹、铁红、红粉、

      生活 2021年10月25日
    • GO中range怎么用

      技术GO中range怎么用这篇文章给大家分享的是有关GO中range怎么用的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。GO 语言的 for…range 能做什么呢?golang 的 for

      攻略 2021年10月31日
    • 基于scopedsession实现线程安全

      技术基于scopedsession实现线程安全 基于scoped_session实现线程安全一、基于scoped_session实现线程安全
      from sqlalchemy.orm import ses

      礼包 2021年11月7日
    • 怎么解决php.ini时区修改无效问题

      技术怎么解决php.ini时区修改无效问题本篇内容介绍了“怎么解决php.ini时区修改无效问题”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔

      攻略 2021年10月29日
    • 井川,日本有没有“常叶”这个姓

      技术井川,日本有没有“常叶”这个姓鹤田 香取 野泽 麻生 小田切 草翦 稻垣 木村 中居 濑户 山下 酒井 松本 石田 柴崎 藤原 福山 江口 唐泽 长泽 椎名 松岛 白石 铃木

      生活 2021年10月28日