MyClusterManager 1.2 beta
本文内容遵从CC版权协议, 可以随意转载, 但必须以超链接形式标明文章原始出处和作者信息及版权声明网址: http://www.penglixun.com/tech/program/my_cluster_manager_12beta.html
主要功能:将SQL分发到集群的各个主机中。
所需Perl的模块:strict,DBI,DBD::mysql。
使用方法:perl ./MyClusterManager.pl
所需表结构为db.sql中的SQL。

根据提示输入指令,例如a是增加主机,目前m和d指令还不支持。


v number指令可以浏览当前层级ID为number的目标下面有多少下一级单位,例如在host使用v指令可以看某个主机下的instance。
按u指令可以回到上一层。

集群管理下,按a添加集群,默认是schema模式,只能添加schema为集群的目标,Target填写Schema_ID,用逗号分割。

集群管理下s指令可以选择一个集群进行操作,以cluster_name为选择条件。

选好集群后,输入指令r进入运行模式,之后输入的SQL都会被分发到集群的各个目标。
猛击链接下载:
MyClusterManager.pl (17.5 KiB, 206 hits)
Web版开发也已完成,PHP开发,即将部署测试。
所需的表结构
CREATE TABLE `hosts` ( id int unsigned not null primary key auto_increment comment '主键', host_name varchar(32) not null comment '主机名', host_ip varchar(16) not null comment '主机IP' ); ALTER TABLE `hosts` ADD UNIQUE uk_Hosts_HostName (host_name); CREATE TABLE `instances` ( id int unsigned not null primary key auto_increment comment '主键', instance_type enum('mysql','oracle','pgsql') not null comment '实例类型', instance_name varchar(32) not null comment '实例登录名', instance_password varchar(64) not null comment '实例登录密码', instance_port smallint unsigned not null comment '实例连接端口', host_id int unsigned not null comment '关联主机ID' ); CREATE TABLE `schemas` ( id int unsigned not null primary key auto_increment comment '主键', schema_name varchar(32) not null comment '数据库名', instance_id int unsigned not null comment '关联实例ID' ); CREATE TABLE `clusters` ( id int unsigned not null primary key auto_increment comment '主键', cluster_name varchar(32) not null comment '集群名', cluster_comment varchar(256) not null comment '集群注释' ); CREATE TABLE `cluster_relations` ( id int unsigned not null primary key auto_increment comment '主键', cluster_id int unsigned not null comment '关联集群ID', target_id int unsigned not null comment '关联目标ID', target_type enum('instance','schema') not null default 'schema' comment '目标类型', UNIQUE KEY (cluster_id, target_id) ); CREATE TABLE `users` ( id INT unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT comment '主键', user_name VARCHAR(32) NOT NULL comment '用户名', user_password VARCHAR(64) NOT NULL comment '用户密码' ); |
