[root@controller3 ~]# mysql -uroot -p # fabric节点需要在backing store mysql server上创建一个fabric database,这里fabric节点和backing store mysql server在同一台机器上
mysql> create user 'fabric'@'localhost' identified by 'fabric' # 连接backing store mysql server认证的用户
mysql> grant all on fabric.* to 'fabric'@'localhost'
[root@controller3 ~]# mysqlfabric help commands # 显示所有的mysqlfabric命令
[root@controller3 ~]# cd /etc/mysql/ # 编辑fabric.cfg配置文件
[root@controller3 mysql]# cp fabric.cfg fabric.cfg.bak # 备份fabric.cfg配置文件
[root@controller3 mysql]# vim fabric.cfg
[DEFAULT]
prefix =
sysconfdir = /etc # 配置文件目录
logdir = /var/log #日志目录
[statistics] # How often the internal event log is pruned, in seconds and also the age of events in the event log that is used to present statistics.
prune_time = 3600
[logging]
url = file:///var/log/fabric.log
level = INFO # 日志级别
[storage]
auth_plugin = mysql_native_password
database = fabric #连接backing store mysql server的数据库名
user = fabric # 连接backing store mysql server fabric数据库的用户名
address = localhost:3306 # backing store mysql server的地址和端口,localhost说明backing store mysql server和fabric节点在同一个机器上
connection_delay = 1
connection_timeout = 6
password = fabric # 连接backing store mysql server fabric数据库的密码
connection_attempts = 6
[failure_tracking]
notification_interval = 60
notification_clients = 50
detection_timeout = 1
detection_interval = 6
notifications = 300
detections = 3
failover_interval = 0
prune_time = 3600
[servers]
password = oracle # fabric节点连接mysql HAgroup中的server认证的密码
user = oracle # fabric节点连接mysql HAgroup中的server认证的用户名
unreachable_timeout = 5
[connector]
ttl = 1
[client] # This section is used by the mysql client when called from MySQL Fabric and is not used MySQL Fabric.
password = oracle
[protocol.xmlrpc] # This section contains information about how the client connects to a MySQL Fabric node and configuration parameters for the XML-RPC protocol on the server
disable_authentication = no
ssl_cert =
realm = MySQL Fabric
ssl_key =
ssl_ca =
threads = 5
user = admin
address = controller3:32274
password = admin
[executor] # The executor executes procedures in a serial order, which guarantees that requests do not conflict.
executors = 5
[sharding] # To perform operations such as moving and splitting shards, MySQL Fabric relies on the mysqldump and mysqlclient programs.
prune_limit = 10000
mysqldump_program = /usr/bin/mysqldump
mysqlclient_program = /usr/bin/mysql
[protocol.mysql] # 官方文档上我没找到这个的解释,我想跟protocol.xmlrpc应该是一样是类似的吧
disable_authentication = no
ssl_cert =
ssl_key =
ssl_ca =
user = admin
address = localhost:32275
password = admin
# fabric节点的my.cnf配置文件
[root@controller3 mysql]# cat /etc/my.cnf
[mysqld]
bind_address = localhost
datadir=/var/lib/mysql
collation-server = utf8_general_ci
init-connect = 'SET NAMES utf8'
character-set-server = utf8
default-storage-engine = innodb
innodb_file_per_table = 1
innodb_buffer_pool_size = 512M
log_bin
gtid_mode=on
enforce_gtid_consistency=on
log_slave_updates=1
# 初始化fabric数据库
[root@controller3 mysql]# mysqlfabric manage setup --param=storage.user=fabric --param=storage.password=fabric #如果报错见下面的Trouble Shooting
# 成功执行,会让你输入admin用户的密码
[root@controller3] mysqlfabric manage start --daemonize # 启动fabric管理系统
[root@controller3] mysqlfabric group create mysql_group # 创建管理组mysql_group
[root@controller3] mysqlfabric group lookup_groups # 查看管理组信息
# 在每个mysql server添加到管理组mysql_group之前,需要在每个mysql server上创建授权用户
[root@controller1 ~]# mysql -uroot -e "grant all on *.* to oracle@'%' identified by 'oracle';"
[root@controller2 ~]# mysql -uroot -e "grant all on *.* to oracle@'%' identified by 'oracle';"
[root@controller3] mysqlfabric group add mysql_group controller1:3306
[root@controller3] mysqlfabric group add mysql_group controller2:3306 # 添加完节点后,查看组信息,两个都为secondary,记得在/etc/hosts文件写controller1、从controller2的ip映射
[root@controller3] mysqlfabric group lookup_servers mysql_group
[root@controller3] mysqlfabric group health mysql_group # 这两种方式都可以查看节点状态信息
[root@controller3] mysqlfabric group promote mysql_group # promote之后,fabric会选举出一台作为primary , demote是取消primary选举
[root@controller3] mysqlfabric group activate mysql_group # 激活失败检测
[root@controller3 ~]# mysqlfabric group lookup_servers mysql_group
Fabric UUID: 5ca1ab1e-a007-feed-f00d-cab3fe13249e
Time-To-Live: 1
server_uuid address status mode weight
------------------------------------ ---------------- --------- ---------- ------
086193ff-4f7f-11e4-8e93-525400788967 controller2:3306 SECONDARY READ_ONLY 1.0
0c826bd0-4f8c-11e4-8ee8-5254003d38c9 controller1:3306 PRIMARY READ_WRITE 2.0
运维网声明
1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网 享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com