5.6.10 or later) •Backing store database server •Application databaseservers •Python 2.6 or 2.7 •No support for 3.x yet •MySQL Utilities 1.4 •Available at https://dev.mysql.com/downloads/tools/utilities •mysql-connect-python-1.2.2-1.e16.noarch $mysql --socket=/data/mysql3334/data/mysql.sock Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 57 Server version: 5.6.16-log MySQL Community Server (GPL) Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
server : 10.0.128.116-117:3334 10.0.128.254:3334 mysql5.6.16 先创建 Fabric 用户注意 这个用户所在的 DB 为 localhost 即 fabric manage 所在主机的 DB: mysql> show grants for 'fabric'@'127.0.0.1'; +---------------------------------------------------------------------------------------------------------------+ | Grants for [email protected] | +---------------------------------------------------------------------------------------------------------------+ | GRANT USAGE ON *.* TO 'fabric'@'127.0.0.1' IDENTIFIED BY PASSWORD '*14E65567ABDB5135D0CFD9A70B3032C179A49EE7' | | GRANT ALL PRIVILEGES ON `fabric`.* TO 'fabric'@'127.0.0.1' | +---------------------------------------------------------------------------------------------------------------+ 2 rows in set (0.00 sec) mysql> show grants for 'fabric'@'localhost'; +---------------------------------------------------------------------------------------------------------------+ | Grants for fabric@localhost | +---------------------------------------------------------------------------------------------------------------+ | GRANT USAGE ON *.* TO 'fabric'@'localhost' IDENTIFIED BY PASSWORD '*14E65567ABDB5135D0CFD9A70B3032C179A49EE7' | | GRANT ALL PRIVILEGES ON `fabric`.* TO 'fabric'@'localhost' | +---------------------------------------------------------------------------------------------------------------+ 2 rows in set (0.00 sec)
password = admin [executor] executors = 5 [sharding] mysqldump_program = /usr/bin/mysqldump mysqlclient_program = /usr/bin/mysql 直接初始化 Fabric 注意 执行命令会后将在 fabric 节点 mysql database 建立相关的 table: mysqlfabric manage setup --param=storage.user=fabric --param=storage.password=secret mysql> use fabric; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A
help commands statistics node Retrieve statistics on the Fabric node. statistics group Retrieve statistics on Procedures. statistics procedure Retrieve statistics on Procedures. group activate Activate failure detector for server(s) in a group. group description Update group's description. group deactivate Deactivate failure detector for server(s) in a group. group create Create a group. group remove Remove a server from a group. group add Add a server into group. group health Check if any server within a group has failed and report health information. group lookup_servers Return information on existing server(s) in a group. group destroy Remove a group. group demote Demote the current master if there is one. group promote Promote a server into master. group lookup_groups Return information on existing group(s). dump fabric_nodes Return a list of Fabric servers. dump shard_index Return information about the index for all mappings matching any of the patterns provided. dump sharding_information Return all the sharding information about the tables passed as patterns. dump servers Return information about servers.
mappings matching any of the provided patterns. dump shard_maps Return information about all shard mappings matching any of the provided patterns. manage teardown Teardown Fabric Storage System. manage stop Stop the Fabric server. manage setup Setup Fabric Storage System. manage ping Check whether Fabric server is running or not. manage start Start the Fabric server. manage logging_level Set logging level. server set_weight Set a server's weight. server clone Clone the objects of a given server into a destination server. server lookup_uuid Return server's uuid. server set_mode Set a server's mode. server set_status Set a server's status. role list List roles and associated permissions user roles Change roles for a Fabric user * protocol: Protocol of the user (for example 'xmlrpc') * roles: Comma separated list of roles, IDs or names (see `role list`) user usercommand Base class for all user commands user list List users and their roles user add Add a new Fabric user. user password Change password of a Fabric user. user delete Delete a Fabric user. threat report_error Report a server error.
failed or is unreachable. sharding list_definitions Lists all the shard mapping definitions. sharding remove_definition Remove the shard mapping definition represented by the Shard Mapping ID. sharding move_shard Move the shard represented by the shard_id to the destination group. sharding disable_shard Disable a shard. sharding remove_table Remove the shard mapping represented by the Shard Mapping object. sharding split_shard Split the shard represented by the shard_id into the destination group. sharding create_definition Define a shard mapping. sharding add_shard Add a shard. sharding add_table Add a table to a shard mapping. sharding lookup_table Fetch the shard specification mapping for the given table sharding enable_shard Enable a shard. sharding remove_shard Remove a Shard. sharding list_tables Returns all the shard mappings of a particular sharding_type. sharding prune_shard Given the table name prune the tables according to the defined sharding specification for the table. sharding lookup_servers Lookup a shard based on the give sharding key. event trigger Trigger an event. event wait_for_procedures Wait until procedures, which are identified through their uuid in a list and separated by comma, finish their execution.
在 mysql server 中 (data node) 加入 fabric 用户: Grant all privileges on *.* to ‘fabric’@’%’ identified by ‘fabric’; 在 group 中添加 node: mysqlfabric group add pajk_group 10.0.128.254:3334 mysqlfabric group add pajk_group 10.0.128.116:3334 mysqlfabric group add pajk_group 10.0.128.117:3334 激活 GROUP 选举出 PRIMARY 节点 mysqlfabric group promote pajk_group --slave_id=10.0.128.116:3334 mysqlfabric group activate pajk_group