MySQLMySQL:Fabric 安装

MySQL Fabric安装

 

MySQL Fabric是Oracle提供的用来助进行ha\sharding的家伙,它的主导架构:

 

 

 

打点看出,借助于Fabric, 可以搭建 HA 集群、Sharing 、HA+Sharding。

行使由fabric中查获各个数据库、表、分区等之投关系,然后访问相应的mysql
实例。

 

Fabric由三单零部件组成:

1)fabric 的管理工具(也即是 mysqlfabric)。

2)fabric
nodes,可以启动1暨差不多个node。每个node也是一个经过。用于拍卖fabric的管制要、应用的mapping请求。

3)backstore,它吧是一个mysql server,维护了HA Group、Sharding Group。

 

 

 

下载

 

每当mysql
5.6以后的版,可以以fabric的应和版本是1.5,在mysql官网上可以一直下载。由于fabric是出于python语言编写的,并且其中通信用会为此到
mysql-connector- python,所以也只要下载对应的python驱动。

         我下载的本是:

mysql-utiltities-1.5.6-1.el6.noarch.rpm
mysql-connector-ptyhon-2.0.4-1.el6.noarch.rpm

 

  

安装

1、安装介质

动操作系统root用户来安。

先安装mysql-connector-ptyhon,再安装mysql-utilities:

rpm –i mysql-connector-ptyhon-2.0.4-1.el6.noarch.rpm
rpm –i mysql-utiltities-1.5.6-1.el6.noarch.rpm

 安装收尾后,会起一个mysqlfabric命令可以应用。所以可以经该令来判断是否安装成功。

2、配置文件

以装好fabric之后,就会见有一个默认的布置文件:fabric.cfg。

默认的布文件的职:

Platform

Package

Location

Microsoft Windows

mysql-utilities-1.5.6-win32.msi

UTILITIES_INSTALLDIR/etc/mysql/fabric.cfg

Ubuntu Linux 14.04

mysql-utilities_1.5.6-1ubuntu14.04_all.deb

/etc/mysql/fabric.cfg

Debian Linux 6.0

mysql-utilities_1.5.6-1debian6.0_all.deb

/etc/mysql/fabric.cfg

Red Hat Enterprise Linux 6 / Oracle Linux 6

mysql-utilities-1.5.6-1.el6.noarch.rpm

/etc/mysql/fabric.cfg

OS X

mysql-utilities-1.5.6-osx10.9.dmg

/etc/mysql/fabric.cfg

 

默认的布置文件预览:

[DEFAULT]
prefix = /usr/local
sysconfdir = /usr/local/etc
logdir = /var/log

[storage]
address = localhost:3306
user = fabric_store
password = secret
database = mysql_fabric
auth_plugin = mysql_native_password
connection_timeout = 6
connection_attempts = 6
connection_delay = 1

[servers]
user = fabric_server
password = secret
backup_user = fabric_backup
backup_password = secret
restore_user = fabric_restore
restore_password = secret
unreachable_timeout = 5

[protocol.xmlrpc]
address = localhost:32274
threads = 5
user = admin
password = secret
disable_authentication = no
realm = MySQL Fabric
ssl_ca =
ssl_cert =
ssl_key =

[protocol.mysql]
address = localhost:32275
user = admin
password = secret
disable_authentication = no
ssl_ca =
ssl_cert =
ssl_key =

[executor]
executors = 5

[logging]
level = INFO
url = file:///var/log/fabric.log

[sharding]
mysqldump_program = /usr/bin/mysqldump
mysqlclient_program = /usr/bin/mysql

[statistics]
prune_time = 3600

[failure_tracking]
notifications = 300
notification_clients = 50
notification_interval = 60
failover_interval = 0
detections = 3
detection_interval = 6
detection_timeout = 1
prune_time = 3600

[connector]
ttl = 1

 

于这布局文件被,会涉嫌到非常多种帐户:
·backstore

在[storage]区域,用来部署backstore mysql
server的音。所以这边配置的就是是backstore mysql server的操作帐户。

拖欠用户必需的权限:

ALTER              - alter some database objects
CREATE             - create most database objects
CREATE VIEW        - create views
DELETE             - delete rows
DROP               - drop most database objects
EVENT              - manage events
REFERENCES         - foreign keys
INDEX              - create indexes
INSERT             - insert rows
SELECT             - select rows
UPDATE             - update rows

  

·server

在[servers]区域布局的,是独具的受管mysql server的帐户。

欠用户必需的权杖:

内部全局满围的权柄:

DELETE             - prune_shard
PROCESS            - list sessions to kill
RELOAD             - RESET SLAVE
REPLICATION CLIENT - SHOW SLAVE STATUS
REPLICATION SLAVE  - SHOW SLAVE HOSTS

 

中Fabric 数据库的权位:

ALTER              - alter some database objects
CREATE             - create most database objects
DELETE             - delete rows
DROP               - drop most database objects
INSERT             - insert rows
SELECT             - select rows
UPDATE             - update rows

 

·backup

在[servers]区域布局的,它是富有的受管mysql
server上用来backup的帐户。例如执行mysqldump。

该用户之权力:

EVENT              - show event information
EXECUTE            - show routine information inside views
REFERENCES         - foreign keys
SELECT             - read data
SHOW VIEW          - SHOW CREATE VIEW
TRIGGER            - show trigger information

 

·restore

在[servers]区域布局的,它是颇具的受管mysql
server上用于restore的帐户。Restore 用户可以以mysql
client执行restore操作。

拖欠用户之权杖:

ALTER              - ALTER DATABASE
ALTER ROUTINE      - ALTER {PROCEDURE|FUNCTION}
CREATE             - CREATE TABLE
CREATE ROUTINE     - CREATE {PROCEDURE|FUNCTION}
CREATE TABLESPACE  - CREATE TABLESPACE
CREATE VIEW        - CREATE VIEW
DROP               - DROP TABLE (used before CREATE TABLE)
EVENT              - DROP/CREATE EVENT
INSERT             - write data
LOCK TABLES        - LOCK TABLES (--single-transaction)
REFERENCES         - Create tables with foreign keys
SELECT             - LOCK TABLES (--single-transaction)
SUPER              - SET @@SESSION.SQL_LOG_BIN = 0
TRIGGER            - CREATE TRIGGER

 

·admin 

在[protocol.mysql]、[protocol.xmlrpc]着布局的admin用户,是Fabric
的客户端(包括mysqlfabric、使用jdbc驱动的使用等) 与fabric
node交互使用的用户、密码。

 在动用mysqlfabric时,可以行使默认的配备文件,也足以以自定义的部署文件。不管采取谁配置文件,相关的配备起都是使配的。

 

 

3、创建backstore 帐户

创一个mysql 实例作为fabric 的backstore。然后创建一个fabric
backstore帐户。

CREATE USER 'fabric_store'@'localhost'
   IDENTIFIED BY 'secret';

GRANT ALTER, CREATE, CREATE VIEW, DELETE, DROP, EVENT,
   INDEX, INSERT, REFERENCES, SELECT, UPDATE ON mysql_fabric.*
   TO 'fabric_store'@'localhost';

创造的这用户称、密码要跟配置文件fabric.cfg中[storeage]区域受到之user、password相同。 

此时fabric数据库尚从来不创造,但是呢不用自己去创造。

 

4、初始化fabric数据库、表

使用mysqlfabric初始化:

mysqlfabric manage setup

如一旦动用自定义的fabric.cfg配置文件:

 

mysqlfabric --config=/your/fabric/cfg/path manage setup

 

5、mysqlfabric命令

1)启动fabric节点

mysqlfabric --config=/your/fabric/cfg/path manage start

2)停止fabric节点 

mysqlfabric --config=/your/fabric/cfg/path manage stop

至于其他命令,可以参照官方文档。 

 

网站地图xml地图