MySQL Utilities工具包概述及安裝

mysql?Utilities 是一組基于Python語言編寫的python庫的命令行實用工具集,依賴于python 2.6。該工具提供了MySQL數據庫運維工程中常用的一些工具,諸如克隆、復制、比較、差異、導出、導入、安裝、配置、索引、磁盤查看等等。有了這個工具包,就好比那些個神醫大夫,不管大病小病,先去搞個化驗,搞個CT,你也可以當華佗。MySQL Utilities提供了各種平臺的軟件包,如果沒有找到對應自己平臺的包,可以通過源碼進行編譯安裝。本文主要描述MySQL Utilities安裝以及各個工作功能初步描述。

一、MySQL Utilities功能及組件

Binary?Log?Operations(二進制日志操作)?  ????????mysqlbinlogmove???二進制日志移動  ????????mysqlbinlogpurge??二進制日志清理  ????????mysqlbinlogrotate?二進制日志老化工具????  Database?Operations(數據庫操作)  ????????mysqldbexport?????數據導出  ????????mysqldbimport?????數據導入  ????????mysqldbcopy???????庫級別數據庫復制  ????????mysqldiff?????????數據庫對象級別比較工具  ????????mysqldbcompare????數據庫庫級別比較工具  General?Operations(通用用的操作)?????  ????????mysqldiskusage????磁盤空間查看  ????????mysqlfrm??????????恢復故障表.frm文件  ????????mysqluserclone????用戶克隆工具  ????????mysqluc???????????Utilities幫助工具?  ????????mysqlindexcheck???索引檢測工具  ????????mysqlmetagrep?????元數據過濾器  ????????mysqlprocgrep?????進程搜索及清理工具  High?Availability?Operations(高可用)  ????mysqlreplicate???主從復制工具  ????mysqlrpladmin????主從復制管理工具  ????mysqlrplcheck????主從復制檢測工具  ????mysqlrplms???????主從多元復制工具  ????mysqlrplshow?????主從復制拓撲圖工具  ????mysqlrplsync?????主從復制同步工具  ????mysqlfailover????主從failover工具  ????mysqlslavetrx????從庫事務跳過工具?  Server?Operations(服務器操作)  ????????mysqlserverinfo????服務器信息查看工具  ????????mysqlserverclone???服務器克隆工具????  Specialized?Operations(特殊操作)  ????????mysqlauditadmin????審計管理工具?  ????????mysqlauditgrep?????審計日志過濾工具

二、安裝需求及下載地址

    需求              Python 2.6              MySQL Connector/Python 連接器      下載地址:              http://www.php.cn/

三、安裝示例

###本次安裝使用1.6.4版本,安裝前,需要先安裝mysql到python連接器#?cat?/etc/redhat-release?CentOS?release?6.7?(Final)  #?rpm?-Uvh?mysql-connector-python-2.1.4-1.el6.x86_64.rpm?#?rpm?-Uvh?mysql-utilities-1.6.4-1.el6.noarch.rpm?###如果沒有安裝連接器,則收到如下錯誤提示  #?rpm?-Uvh?mysql-utilities-1.6.4-1.el6.noarch.rpm?warning:?mysql-utilities-1.6.4-1.el6.noarch.rpm:?Header?V3?DSA/SHA1?Signature,?key?ID?5072e1f5:?NOKEY  error:?Failed?dependencies:  ????????mysql-connector-python?>=?2.0.0?is?needed?by?mysql-utilities-1.6.4-1.el6.noarch###查看安裝后生成的文件????????  ????????#?rpm?-ql?mysql-utilities-1.6.4-1.el6|grep?"/usr/bin"/usr/bin/mysqlauditadmin  /usr/bin/mysqlauditgrep  /usr/bin/mysqlbinlogmove  /usr/bin/mysqlbinlogpurge  /usr/bin/mysqlbinlogrotate  /usr/bin/mysqldbcompare  /usr/bin/mysqldbcopy  /usr/bin/mysqldbexport  /usr/bin/mysqldbimport  /usr/bin/mysqldiff  /usr/bin/mysqldiskusage  /usr/bin/mysqlfailover  /usr/bin/mysqlfrm  /usr/bin/mysqlgrants  /usr/bin/mysqlindexcheck  /usr/bin/mysqlmetagrep  /usr/bin/mysqlprocgrep  /usr/bin/mysqlreplicate  /usr/bin/mysqlrpladmin  /usr/bin/mysqlrplcheck  /usr/bin/mysqlrplms  /usr/bin/mysqlrplshow  /usr/bin/mysqlrplsync  /usr/bin/mysqlserverclone  /usr/bin/mysqlserverinfo  /usr/bin/mysqlslavetrx  /usr/bin/mysqluc  /usr/bin/mysqluserclone

四、獲取幫助

1、通過mysqluc獲取幫助###可以通過調用mysqluc命令行工具來獲取這些工具的幫助信息###?mysqluc提供一個自帶的命令行提示符窗口,
在這個窗口下也可以完成相應的命令操作[root@node1?~]#?mysqluclaunching?console?…

Welcome?to?the?MySQL?Utilities?Client?(mysqluc)?version?1.6.4Copyright?(c)?2010,?2016?Oracle?and/or?its?affiliates.?All?rights?reserved.  This?is?a?release?of?dual?licensed?MySQL?Utilities.?For?the?avoidance?ofdoubt,?this?particular?copy?of?the?software?is?released  under?the?version?2?of?the?GNU?General?Public?License.  MySQL?Utilities?is?brought?to?you?by?Oracle.  Type?'help'?for?a?list?of?commands?or?press?TAB?twice?for?list?of?utilities.  mysqluc&gt;?help  Command?????????????????Description????????????????????????????????????????  ----------------------??---------------------------------------------------help?utilities??????????  Display?list?of?all?utilities?supported.???????????  help?<utility>??????????Display?help?for?a?specific?utility.???????????????  show?errors?????????????Display?errors?captured?during?the?execution?of?the  ????????????????????????utilities.?????????????????????????????????????????  clear?errors????????????clear?captured?errors.?????????????????????????????  show?last?error?????????Display?the?last?error?captured?during?the?????????  ????????????????????????execution?of?the?utilities?????????????????????????  help?|?help?commands????Show?this?list.????????????????????????????????????  exit?|?quit?????????????Exit?the?console.??????????????????????????????????  set?<variable>=<value>??Store?a?variable?for?recall?in?commands.???????????  show?options????????????Display?list?of?options?specified?by?the?user?on???  ????????????????????????launch.????????????????????????????????????????????  show?variables??????????Display?list?of?variables.?????????????????????????  <enter>?????????????????Press?ENTER?to?execute?command.????????????????????  <escape>????????????????Press?ESCAPE?to?clear?the?command?entry.???????????  <down>??????????????????Press?DOWN?to?retrieve?the?previous?command.???????  <up>????????????????????Press?UP?to?retrieve?the?next?command?in?history.??  <tab>???????????????????Press?TAB?for?type?completion?of?utility,?option,??  ????????????????????????or?variable?names.?????????????????????????????????  <tab><tab>??????????????Press?TAB?twice?for?list?of?matching?type??????????  ????????????????????????completion?(context?sensitive).????????????????????  ###查看utilities包中所有的命令行工具mysqluc&gt;?help?utilities?  Utility????????????Description?????????????????????????????????????????????  -----------------??--------------------------------------------------------mysqlauditadmin????  audit?log?maintenance?utility???????????????????????????  mysqlauditgrep?????audit?log?search?utility????????????????????????????????  mysqlbinlogmove????binary?log?relocate?utility?????????????????????????????  mysqlbinlogpurge???purges?unnecessary?binary?log?files?????????????????????  mysqlbinlogrotate??rotates?the?active?binary?log?file??????????????????????  mysqldbcompare?????compare?databases?for?consistency???????????????????????  mysqldbcopy????????copy?databases?from?one?server?to?another???????????????  mysqldbexport??????export?metadata?and?data?from?databases?????????????????  mysqldbimport??????import?metadata?and?data?from?files?????????????????????  mysqldiff??????????compare?object?definitions?among?objects?where?the??????  ???????????????????difference?is?how?db1.obj1?differs?from?db2.obj2????????  mysqldiskusage?????show?disk?usage?for?databases???????????????????????????  mysqlfailover??????automatic?replication?health?monitoring?and?failover????  mysqlfrm???????????show?CREATE?TABLE?from?.frm?files???????????????????????  mysqlgrants????????display?grants?per?object???????????????????????????????  mysqlindexcheck????check?for?duplicate?or?redundant?indexes????????????????  mysqlmetagrep??????search?metadata?????????????????????????????????????????  mysqlprocgrep??????search?process?information??????????????????????????????  mysqlreplicate?????establish?replication?with?a?master?????????????????????  mysqlrpladmin??????administration?utility?for?MySQL?replication????????????  mysqlrplcheck??????check?replication???????????????????????????????????????  mysqlrplms?????????establish?multi-source?replication??????????????????????  mysqlrplshow???????show?slaves?attached?to?a?master????????????????????????  mysqlrplsync???????replication?synchronization?checker?utility?????????????  mysqlserverclone???start?another?instance?of?a?running?server??????????????  mysqlserverinfo????show?server?information?????????????????????????????????  mysqlslavetrx??????skip?transactions?on?slaves?????????????????????????????  mysqluserclone?????clone?a?MySQL?user?account?to?one?or?more?new?users?????  ###也可直接在mysqluc提示符下輸入?help?command?來獲取對應命令的幫助信息,如下mysqluc&gt;?help?mysqlauditadmin?  Usage:?mysqlauditadmin?--server=user:pass@host:port?--show-options?#?Author?:?Leshami  #?Blog???:?http://www.php.cn/mysqlauditadmin?-?audit?log?maintenance?utility?  Options:  Option?????????????????????Description?????????????????????????????????????  -------------------------??--------------------------------------------------version??????????????????  show?program's?version?number?and?exit??????????--help?????????????????????  display?this?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->[].???????????????????????????????  --audit-log-name=LOG_NAME??full?path?and?file?name?for?the?audit?log?file.?  ???????????????????????????Used?for?stats?and?copy?options.????????????????  --show-options?????????????display?the?audit?log?system?variables.?????????  --remote-login=RLOGIN??????user?name?and?host?to?be?used?for?remote?login??  ???????????????????????????for?copying?log?files.?Format:??????????????????  ???????????????????????????<user>:<host_or_ip>?Password?will?be?prompted.??  --file-stats???????????????display?the?audit?log?file?statistics.??????????  --copy-to=COPY_LOCATION????the?location?to?copy?the?audit?log?file?????????  ???????????????????????????specified.?The?path?must?be?locally?accessible??  ???????????????????????????for?the?current?user.???????????????????????????  --value=VALUE??????????????value?used?to?set?variables?based?on?the?command  ???????????????????????????specified.?See?--help?for?list?per?command.?????  ???????????????????????????--ssl-ca=SSL_CA????????????path?to?a?file?that?contains?a?list?of?trusted??  ???????????????????????????SSL?CAs.????????????????????????????????????????  --ssl-cert=SSL_CERT????????name?of?the?SSL?certificate?file?to?use?for?????  ???????????????????????????establishing?a?secure?connection.???????????????  --ssl-key=SSL_KEY??????????name?of?the?SSL?key?file?to?use?for?establishing  ???????????????????????????a?secure?connection.????????????????????????????  --ssl=SSL??????????????????specifies?if?the?server?connection?requires?use?  ???????????????????????????of?SSL.?If?an?encrypted?connection?cannot?be????  ???????????????????????????established,?the?connection?attempt?fails.?By???  ???????????????????????????default?0?(SSL?not?required).???????????????????  -v,?--verbose??????????????control?how?much?information?is?displayed.?e.g.,  ???????????????????????????-v?=?verbose,?-vv?=?more?verbose,?-vvv?=?debug??  ???????????????????????????Available?Commands:?copy?-?copy?the?audit?log?to  ???????????????????????????a?locally?accessible?path?policy?-?set?the?audit??????????????????????????  ????????????????????????????log?policy?Values?=?ALL,?NONE,?LOGINS,?QUERIES,?  ???????????????????????????DEFAULT?rotate?-?perform?audit?log?rotation?????  ???????????????????????????rotate_on_size?-?set?the?rotate?log?size?limit??  ???????????????????????????for?auto?rotation?Values?=?0,?4294967295????  ???????????????????????????2、直接在shell提示符下獲取命令幫助###如下示例[root@node1?~]  ???????????????????????????#?mysqlfailover?--help|headMySQL?Utilities?mysqlfailover?version?1.6.4?License?type:?GPLv2  Usage:?mysqlfailover?--master=root@localhost?--discover-slaves-login=root?  ????????????????--candidates=root@host123:3306,root@host456:3306?mysqlfailover?-?automatic?replication?health?monitoring?and?failover  Options:??--version?????????????show?program's?version?number?and?exit  ??--help????????????????display?this?help?message?and?exit  ??--license?????????????display?program's?license?and?exit?3、基于Linux?man獲取命令幫助###如下示例root@node1?~]  ??#?man?mysqlfailoverMYSQLFAILOVER(1)????????????????MySQL?Utilities???????????????MYSQLFAILOVER(1)  NAME  ???????mysqlfailover?-?Automatic?replication?master?failover  SYNOPSIS  ???????mysqlfailover?[options]</host_or_ip></user></config-></socket></port></login-path></socket></port></host></password></user></tab></tab></tab></up></down></escape></enter></value></variable></utility>
? 版權聲明
THE END
喜歡就支持一下吧
點贊13 分享