首页域名资讯 正文

MySQL管理工具MySQL Utilities — mysqlserverclone

2024-12-04 2 0条评论

mysqlserverclone 工具是在同一个主机上创建一个新的服务实例。该工具创建一个新的datadir目录和socket文件,并启动该实例。

如果新目录没有读写权限将报错。如果新目录非空,该工具不会删除并报错。因此在克隆前先要删除该目录下的内容或指定–delete-data选项。

选项

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 Usage : mysqlserverclone server = user : pass @ host : port : socket \                          new data = / tmp / data2 new port = 3310 \                          new id = 12 root password = root mysqlserverclone start another instance of a running server Options :    version             show program ‘s version number and exit   –help                display a help message and exit   –license             display program’ s license and exit    server = SERVER       connection information for the server in the form :                          < user > [ : < password > ] @ < host > [ : < port > ] [ : < socket > ] or                          < login path > [ : < port > ] [ : < socket > ] or < config                          path > [ < [ group ] > ] .    ssl ca = SSL_CA       The path to a file that contains a list of trusted SSL                          CAs .    ssl cert = SSL_CERT   The name of the SSL certificate file to use for                          establishing a secure connection .    ssl key = SSL_KEY     The name of the SSL key file to use for establishing a                          secure connection .    new data = NEW _DATA    新实例数据目录的完整路径。路径大小必需等于或少于 200个字符。                         至少需要 120M的可用空间。    new port = NEW_PORT   the new port for the new instance default = 3307    new id = NEW_ID       the server_id for the new instance default = 2    root password = ROOT_PASS                          password for the root user    mysqld = MYSQLD       mysqld附加选项。指定多个,用空格分割。如 mysqld = “–log-bin=binlog                          –general-log-file=’my log file'”    w CMD_FILE , write command = CMD_FILE                          path to file for writing startup command . For example :                          start_server1 . sh    v , verbose         control how much information is displayed . e . g . , v =                          verbose , vv = more verbose , vvv = debug    q , quiet           turn off all messages for quiet execution .    basedir = BASEDIR     the base directory for the server    delete data         delete the folder specified by new data if it exists                          and is not empty .    user = USER           user account to launch cloned server . Default is                          current user .    start timeout = START_TIMEOUT                          Number of seconds to wait for server to start . Default                          = 10.    force               Ignore the maximum path length and the low space                          checks for the new data option .

实例

创建一个新实例,设置root密码和启用二进制日志

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 # mysqlserverclone –server=instance_3306 –new-data=/data/tmp/ \    new port = 3310 root password = 3310 mysqld = log bin = mysql bin 3310 \    new id = 3310 user = mysql vvv # Cloning the MySQL server running on trustauth.cn. # Configuring new instance… # Locating mysql tools… # Location of files: #                       mysqld: /usr/sbin/mysqld #                   mysqladmin: /usr/bin/mysqladmin #      mysql_system_tables.sql: /usr/share/mysql/mysql_system_tables.sql # mysql_system_tables_data.sql: /usr/share/mysql/mysql_system_tables_data.sql # mysql_test_data_timezone.sql: /usr/share/mysql/mysql_test_data_timezone.sql #         fill_help_tables.sql: /usr/share/mysql/fill_help_tables.sql # Setting up empty database and mysql tables… 2015 01 06 16 : 31 : 32 0 [ Warning ] TIMESTAMP with implicit DEFAULT value is deprecated . Please use explicit_defaults_for_timestamp server option ( see documentation for more details ) . 2015 01 06 16 : 31 : 32 19770 [ Note ] Plugin ‘FEDERATED’ is disabled . 2015 01 06 16 : 31 : 32 19770 [ Note ] InnoDB : Using atomics to ref count buffer pool pages 2015 01 06 16 : 31 : 32 19770 [ Note ] InnoDB : The InnoDB memory heap is disabled 2015 01 06 16 : 31 : 32 19770 [ Note ] InnoDB : Mutexes and rw_locks use GCC atomic builtins 2015 01 06 16 : 31 : 32 19770 [ Note ] InnoDB : Memory barrier is not used 2015 01 06 16 : 31 : 32 19770 [ Note ] InnoDB : Compressed tables use zlib 1.2.3 2015 01 06 16 : 31 : 32 19770 [ Note ] InnoDB : Using Linux native AIO 2015 01 06 16 : 31 : 32 19770 [ Note ] InnoDB : Using CPU crc32 instructions 2015 01 06 16 : 31 : 32 19770 [ Note ] InnoDB : Initializing buffer pool , size = 128.0M 2015 01 06 16 : 31 : 32 19770 [ Note ] InnoDB : Completed initialization of buffer pool 2015 01 06 16 : 31 : 32 19770 [ Note ] InnoDB : The first specified data file . / ibdata1 did not exist : a new database to be created ! 2015 01 06 16 : 31 : 32 19770 [ Note ] InnoDB : Setting file . / ibdata1 size to 12 MB 2015 01 06 16 : 31 : 32 19770 [ Note ] InnoDB : Database physically writes the file full : wait . . . 2015 01 06 16 : 31 : 32 19770 [ Note ] InnoDB : Setting log file . / ib_logfile101 size to 48 MB 2015 01 06 16 : 31 : 33 19770 [ Note ] InnoDB : Setting log file . / ib_logfile1 size to 48 MB 2015 01 06 16 : 31 : 34 19770 [ Note ] InnoDB : Renaming log file . / ib_logfile101 to . / ib _logfile0 2015 01 06 16 : 31 : 34 19770 [ Warning ] InnoDB : New log files created , LSN = 45781 2015 01 06 16 : 31 : 34 19770 [ Note ] InnoDB : Doublewrite buffer not found : creating new 2015 01 06 16 : 31 : 34 19770 [ Note ] InnoDB : Doublewrite buffer created 2015 01 06 16 : 31 : 34 19770 [ Note ] InnoDB : 128 rollback segment ( s ) are active . 2015 01 06 16 : 31 : 34 19770 [ Warning ] InnoDB : Creating foreign key constraint system tables . 2015 01 06 16 : 31 : 34 19770 [ Note ] InnoDB : Foreign key constraint system tables created 2015 01 06 16 : 31 : 34 19770 [ Note ] InnoDB : Creating tablespace and datafile system tables . 2015 01 06 16 : 31 : 34 19770 [ Note ] InnoDB : Tablespace and datafile system tables created . 2015 01 06 16 : 31 : 34 19770 [ Note ] InnoDB : Waiting for purge to start 2015 01 06 16 : 31 : 34 19770 [ Note ] InnoDB : 5.6.22 started ; log sequence number 0 2015 01 06 16 : 31 : 35 19770 [ Note ] Binlog end 2015 01 06 16 : 31 : 35 19770 [ Note ] InnoDB : FTS optimize thread exiting . 2015 01 06 16 : 31 : 35 19770 [ Note ] InnoDB : Starting shutdown . . . 2015 01 06 16 : 31 : 37 19770 [ Note ] InnoDB : Shutdown completed ; log sequence number 1625977 # Starting new instance of the server… # Startup command for new server: / usr / sbin / mysqld no defaults datadir = / data / tmp tmpdir = / data / tmp pid file = / data / tmp / clone . pid port = 3310 server id = 3310 basedir = / usr socket = / data / tmp / mysql . sock user = mysql log bin = mysql bin 3310 # Testing connection to new instance… 2015 01 06 16 : 31 : 37 0 [ Warning ] TIMESTAMP with implicit DEFAULT value is deprecated . Please use explicit_defaults_for_timestamp server option ( see documentation for more details ) . 2015 01 06 16 : 31 : 37 19796 [ Note ] Plugin ‘FEDERATED’ is disabled . 2015 01 06 16 : 31 : 37 19796 [ Note ] InnoDB : Using atomics to ref count buffer pool pages 2015 01 06 16 : 31 : 37 19796 [ Note ] InnoDB : The InnoDB memory heap is disabled 2015 01 06 16 : 31 : 37 19796 [ Note ] InnoDB : Mutexes and rw_locks use GCC atomic builtins 2015 01 06 16 : 31 : 37 19796 [ Note ] InnoDB : Memory barrier is not used 2015 01 06 16 : 31 : 37 19796 [ Note ] InnoDB : Compressed tables use zlib 1.2.3 2015 01 06 16 : 31 : 37 19796 [ Note ] InnoDB : Using Linux native AIO 2015 01 06 16 : 31 : 37 19796 [ Note ] InnoDB : Using CPU crc32 instructions 2015 01 06 16 : 31 : 37 19796 [ Note ] InnoDB : Initializing buffer pool , size = 128.0M 2015 01 06 16 : 31 : 37 19796 [ Note ] InnoDB : Completed initialization of buffer pool 2015 01 06 16 : 31 : 37 19796 [ Note ] InnoDB : Highest supported file format is Barracuda . 2015 01 06 16 : 31 : 37 19796 [ Note ] InnoDB : 128 rollback segment ( s ) are active . 2015 01 06 16 : 31 : 37 19796 [ Note ] InnoDB : Waiting for purge to start 2015 01 06 16 : 31 : 37 19796 [ Note ] InnoDB : 5.6.22 started ; log sequence number 1625977 2015 01 06 16 : 31 : 37 19796 [ Warning ] No existing UUID has been found , so we assume that this is the first time that this server has been started . Generating a new UUID : 6e512b45 957e 11e4 9704 0050569f3bb8. 2015 01 06 16 : 31 : 37 19796 [ Note ] Server hostname ( bind address ) : ‘*’ ; port : 3310 2015 01 06 16 : 31 : 37 19796 [ Note ] IPv6 is available . 2015 01 06 16 : 31 : 37 19796 [ Note ]    ‘::’ resolves to ‘::’ ; 2015 01 06 16 : 31 : 37 19796 [ Note ] Server socket created on IP : ‘::’ . 2015 01 06 16 : 31 : 37 19796 [ Note ] Event Scheduler : Loaded 0 events 2015 01 06 16 : 31 : 37 19796 [ Note ] / usr / sbin / mysqld : ready for connections . Version : ‘5.6.22-log’    socket : ‘/data/tmp/mysql.sock’    port : 3310    MySQL Community Server ( GPL ) # trying again… # Success! # Setting the root password… Warning : Using a password on the command line interface can be insecure . # Connection Information: #  -uroot -p3310 –socket=/data/tmp/mysql.sock #…done.

数据目录下内容:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 # ps -ef | grep 3310 mysql      19796      1    1 16 : 31 pts / 0      00 : 00 : 00 / usr / sbin / mysqld no defaults datadir = / data / tmp tmpdir = / data / tmp pid file = / data / tmp / clone . pid port = 3310 server id = 3310 basedir = / usr socket = / data / tmp / mysql . sock user = mysql log bin = mysql bin 3310 root      19842 19315    0 16 : 32 pts / 0      00 : 00 : 00 grep 3310 # ll 总用量 110616 rw rw . 1 mysql mysql        56 1   6 16 : 31 auto . cnf rw rw . 1 mysql mysql          6 1   6 16 : 31 clone . pid rw rw . 1 mysql mysql 12582912 1   6 16 : 31 ibdata1 rw rw . 1 mysql mysql 50331648 1   6 16 : 31 ib_logfile0 rw rw . 1 mysql mysql 50331648 1   6 16 : 31 ib_logfile1 drwx . 2 mysql mysql      4096 1   6 16 : 31 mysql rw rw . 1 mysql mysql        262 1   6 16 : 31 mysql bin 3310.000001 rw rw . 1 mysql mysql        24 1   6 16 : 31 mysql bin 3310.index srwxrwxrwx . 1 mysql mysql          0 1   6 16 : 31 mysql . sock drwx . 2 mysql mysql      4096 1   6 16 : 31 performance_schema

权限

读取所有数据库的权限。

对新数据目录的读写权限。

文章转载来自:trustauth.cn

文章版权及转载声明

本文作者:亿网 网址:https://edns.com/ask/post/163061.html 发布于 2024-12-04
文章转载或复制请以超链接形式并注明出处。