In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces how to install Sandbox in MySQL. It is very detailed and has a certain reference value. Friends who are interested must finish it!
What is a sandbox?
MySQL Sandbox is a very simple and quick tool to install and build MySQL instances, it can quickly meet our various needs of MySQL environment: stand-alone instance, master-slave, one-master-multi-slave and so on (different from installing MySQL software by yourself). For example, after the release of the new database version, if you want to try it as soon as possible without spending too much resources to install it, you can use sandbox to help us create an instance of a single or master-slave structure. For those developers and testers who do not understand MySQL installation, you can use sandbox to quickly build a database that meets the requirements. MySQL Sandbox speed is measured in seconds, who knows who uses it.
How to install and use
2.1 install sandbox
The case in this paper is based on Centos virtual machine testing.
Yum install cpan-y
Yum install perl-Test-Simple-y
Cpan MySQL::Sandbox
Echo 'export SANDBOX_AS_ROOT=1' > > / root/.bash_profile & & source / root/.bash_profile
Get Percona server version 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.ssl101.tar.gz"
2.2 Common commands
Files starting with make_ are generated by default in the / usr/local/bin/ directory after the installation is complete.
Make_sandbox creates MySQL instance based on binary package
Make_sandbox_from_source creates a MySQL instance based on source code, and executes. / configure & & make successful source code storage directory if the parameter is.
Make_sandbox_from_installed installs the MySQL instance based on the directory of mysql executable files that have been installed
Make_sandbox_from_url downloads the docker image from the Internet to install. For more information, please refer to the help command.
Make_multiple_sandbox creates multiple MySQL instances of the same version
Make_multiple_custom_sandbox creates different versions of MySQL instances
Make_replication_sandbox builds a master-slave replication structure, which can be one master, one slave or one master and multiple slaves.
Sbtool: sandbox management tool
To get an in-depth understanding of the specific usage of each command, please refer to the README documentation in the source directory, and then do it yourself. You can understand it more deeply. After all, it is shallow on paper, so you must practice it yourself. The following is mainly through
Make_sandbox and make_replication_sandbox to describe how to use.
2.3 use sandbox
Install a single instance
Root@rac4:/data/mysql# > make_sandbox / data/mysql/Percona-Server-5.7.17-11-Linux.x86_64.ssl101.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.7%
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
. Omit part of the content
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
Type Y and sandbox will start an instance and wait about 20 seconds.
# Starting server
. Sandbox server started
# Loading grants
Your sandbox server was installed in $HOME/sandboxes/msb_5_7_17
Because this case uses the root user installation test, the newly generated database directory is in / root/sandboxes/msb_5_7_17, where the files are as follows
You can study the specific contents of each executable file. Commonly used are use,stop,start,restart and so on, for example
Root@rac4:~/sandboxes/msb_5_7_17# >. / use-- log in to the database
Welcome to the MySQL monitor. Commands end with; or\ g.
Your MySQL connection id is 9
Server version: 5.7.17-11 Percona Server (GPL), Release 11, Revision f60191c
Copyright (c) 2009-2016 Percona LLC and/or its affiliates
Mysql [localhost] {msandbox} ((none)) > show databases
+-+
| | Database |
+-+
| | information_schema |
| | mysql |
| | performance_schema |
| | sys |
| | test |
+-+
5 rows in set (0.00 sec)
Set up the master and slave, in this example, enable gtid and set up to create 1 slave. Because the above example has created a 5.7.17 source program directory, we can create a master and slave based on this directory, or a compressed package based on the source code.
Root@rac4:/data/mysql# > make_replication_sandbox-- gtid-- how_many_slaves=1 5.7.17
Installing and starting master
Installing slave 1
Starting slave 1
.. Sandbox server started
Initializing slave 1
Replication directory installed in $HOME/sandboxes/rsandbox_5_7_17
According to the result, it is suggested that the master and slave created by sandbox is in the directory $HOME/sandboxes/rsandbox_5_7_17. Enter this directory to view the following files
Among them, master and node1 are the database directories of the main database and standby database respectively, m and N1 are commands to log in to the main library, S1 and N2 are commands to log in to slave, and others can be used for specific purposes from the file name. Here are two commands: test_replication and check_slaves. The two commands have similar functions, both of which check the status information of slave. Check_slaves will output the information related to the main library.
Root@rac4:~/sandboxes/rsandbox_5_7_17# > sh test_replication check the relationship between master and slave
# Master log: mysql-bin.000001-Position: 10732-Rows: 20
# Testing slave # 1
Ok-Slave # 1 acknowledged reception of transactions from master
Ok-Slave # 1 IO thread is running
Ok-Slave # 1 SQL thread is running
Ok-Table T1 found on slave # 1
Ok-Table T1 has 20 rows on # 1
# TESTS: 5
# FAILED: 0 (0.0%)
# PASSED: 5 (100.0%)
# exit code: 0
Root@rac4:~/sandboxes/rsandbox_5_7_17# >. / check_slaves #
Master
Port: 20192
File: mysql-bin.000001
Position: 10732
Executed_Gtid_Set: 00020192-1111-1111-1111-1111111111111111
Slave # 1
Port: 20193
Master_Log_File: mysql-bin.000001
Read_Master_Log_Pos: 10732
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Exec_Master_Log_Pos: 10732
Retrieved_Gtid_Set: 00020192-1111-1111-1111-1111111111111111
Executed_Gtid_Set: 00020192-1111-1111-1111-1111111111111111
The above is all the contents of the article "how to install Sandbox in MySQL". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.