MySQL Utilities or Proxy or fabric or shared or failover or manage

Author:牛班图

Date:2016/05/17

Address:suzhou

本文部分知识来自于mysql官网:http://dev.mysql.com

---

在开始之前,先向大家推荐一下mysql的MySQL Fabric是oracle官方原生的MySQL HA及分片的中间件,已经被移到mysql Utilities工具中。

What are the MySQL Utilities?

It is a package of utilities that are used for maintenance and administration of MySQL servers. These utilities encapsulate a set of primitive commands, and bundles them so they can be used to perform macro operations with a single command.

The utilities are written in Python, available under the GPLv2 license, and are extendable using the supplied library. They are designed to work with Python versions 2.6 or later and there is no support (yet) for Python v3.1.

workbench

在使用MySQL Utilities之前希望大家下载一个MySQL的官方管理工具workbench:

MySQL Workbench provides DBAs and developers an integrated tools environment for:

MySQl5.6.6之后的版本会有一些性能监控,功能很强大,作为运维管理使用不错的!

  • Database Design & Modeling

  • SQL Development
  • Database Administration
  • Database Migration

download url:http://dev.mysql.com/downloads/workbench/

doc:http://dev.mysql.com/doc/workbench/en/wb-intro.html

Utilities

好了还是讲主要的Utilities吧!
1.1安装及条件:

requires Python 2.6. All of the Python code is written to conform to this version of Python.

MySQL Connector/Python General Availability (GA) release (version 2.0.4/2.1.2 or later)下载地址:http://dev.mysql.com/downloads/connector/python/

安装:

shell> sudo rpm -i mysql-connector-python-2.1.3-1.el6.x86_64.rpm
shell> sudo rpm -i mysql-utilities-1.6.3-el6.noarch.rpm

1.2Connecting to MySQL Servers

3种方式:

i:login-paths(.mylogin.cnf)首选,文件加密

使用mysql_config_editor工具 (http://dev.mysql.com/doc/en/mysql-config-editor.html)来添加 如下的连接信息。

 

shell> mysql_config_editor set --login-path=instance_13001 --host=localhost --user=root --port=13001 --password
Enter password: <Password is prompted to be inserted in a more secure way>

接下来,使用下面的命令来确认登录路径 数据被正确地添加到 .mylogin.cnf (加密的文件):

 
shell> mysql_config_editor print --login-path=instance_13001
[instance_13001]
user = root
password = *****
host = localhost
port = 13001

shell> mysqlserverinfo --server=instance_13001 --format=vertical

ii:Use a Configuration File

创建一个配置文件 /dev/env/test1/my.cnf

 

[server1]
port=3308
user=root
password=other-pass
host=localhost
下面显示了一个实用程序使用的执行 配置文件。

shell> mysqlserverinfo.py --server=/dev/env/test1/my.cnf[server1] --format=vertical

iii:命令行

shell> mysqlserverinfo.py --server=root:other-pass@localhost:3308 --format=vertical

python连接示例:

# Set connection values
dest_values = {
    "user" : "root",
    "passwd" : "secret",
    "host" : "localhost",
    "port" : 3308,
    "unix_socket" : None,
}

 Utilities安装及连接mysql服务器都搞定了,下面就是使用Utilities工具来管理mysql服务器。

http://www.ttlsa.com/mysql/mysql-manager-tools-mysql-utilities-tutorial/这篇文章总结的很棒,根据官方原文翻译的。

 

 fabric是mysql分库分表的一个管理节点,他没有proxy层,是通过应用的connect连接fabric来查询后端服务器场的库和表信息,然后连接具体的库,重点是对跨服务器的分表有了支持,后端服务器场有多个服务器组,每个组有多台数据库组成一主多从,并且自动实现主宕机后从提升为主,并且其它从库,自动从提升的主复制。

posted @ 2016-05-18 17:34  nbuntu牛班图  阅读(225)  评论(0编辑  收藏  举报