您的位置:金沙手机版下载 > 澳门官网 > MySQL:Fabric 安装

MySQL:Fabric 安装

2019-10-10 16:48

MySQL Fabric安装

 

MySQL 法布里c是Oracle提供的用于支援举办hasharding的工具,它的主干框架结构:

 图片 1

 

 

从地方看出,借助于法布里c, 能够搭建 HA 集群、Sharing 、HA+Sharding。

选用从fabric中摸清种种数据库、表、分区等的照耀关系,然后访谈相应的mysql 实例。

 

法布里c由四个零部件组成:

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

 

里头法布里c 数据库的权位:

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客商,是法布里c 的客户端(满含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

有关其他命令,能够参考官方文档。 

 

本文由金沙手机版下载发布于澳门官网,转载请注明出处:MySQL:Fabric 安装

关键词: