├── .gitignore ├── README.md ├── bucketlimit.go ├── lianjiaershoufang.go ├── linux_wellcome.sh ├── mycatDocs ├── LICENSE ├── MyCAT的S级别任务.docx ├── MyCAT自增字段和返回生成的主键ID的经验分享 ├── MyCat_In_Action_CN.doc ├── MyCat调研.pptx ├── Mycat Q&A.docx ├── Mycat-ePlatform │ └── Mycat_OpenBusinessPlatform.pptx ├── Mycat_OpenBusinessPlatform.pptx ├── Mycat介绍.pptx ├── README.md ├── history │ ├── 1.0 │ │ ├── Changelog_MyCat1.0.html │ │ ├── MyCAT性能测试案例集.wps │ │ ├── MyCat_In_Action_中文版.doc │ │ ├── MyCat专家系列之Mycat前世今生.doc │ │ ├── MySql常用命令总结.txt │ │ ├── Mycat Q&A.docx │ │ ├── Mycat-Balance使用指南.docx │ │ ├── Mycat-cluster设计简析.docx │ │ ├── Mycat_Develope_Guide.docx │ │ ├── Mycat命令行监控指南.docx │ │ ├── Mycat性能测试指南.docx │ │ ├── Mycat性能调优指南.docx │ │ ├── Mycat最权威DBCP使用手册.docx │ │ ├── Mycat最权威Mysql主从配置手册.docx │ │ └── Mycat高级功能测试案例.docx │ ├── 1.1 │ │ ├── MyCAT性能测试案例集.wps │ │ ├── MyCat_In_Action_中文版.doc │ │ ├── MyCat专家系列之Mycat前世今生.doc │ │ ├── MySql常用命令总结.txt │ │ ├── Mycat Q&A.docx │ │ ├── Mycat-Balance使用指南.docx │ │ ├── Mycat-cluster设计简析.docx │ │ ├── Mycat_Develope_Guide.docx │ │ ├── Mycat命令行监控指南.docx │ │ ├── Mycat性能测试指南.docx │ │ ├── Mycat性能调优指南.docx │ │ ├── Mycat最权威DBCP使用手册.docx │ │ ├── Mycat最权威Mysql主从配置手册.docx │ │ ├── Mycat运行时序图.vsd │ │ ├── Mycat高级功能测试案例.docx │ │ ├── NIO的陷阱.docx │ │ └── Select的where条件解析增加Between解析说明.docx │ ├── 1.2.1 │ │ └── MyCat_In_Action_中文版.doc │ ├── 1.2 │ │ ├── Haproxy+Mycat集群搭建指南.docx │ │ ├── MyCat_In_Action_中文版.doc │ │ ├── MyCat_In_Advanced.doc │ │ ├── MyCat专家系列之Mycat前世今生.doc │ │ ├── MyCat性能测试案例.docx │ │ ├── Mycat Q&A.docx │ │ ├── Mycat_Develope_Guide.docx │ │ ├── Mycat命令行监控指南.docx │ │ ├── Mycat性能调优指南.docx │ │ ├── Mycat最权威Mysql主从配置手册.docx │ │ ├── Q&A.docx │ │ └── sequnce-sql.txt │ ├── DDAP-FPMA第二轮性能提升测试报告.docx │ ├── Haproxy+Mycat集群搭建指南.docx │ ├── MyCAT人工智能解决跨分片SQL.docx │ ├── MyCAT的S级别任务.docx │ ├── MyCat_In_Action_中文版.doc │ ├── MyCat_In_Advanced.doc │ ├── MyCat_Professional.doc │ ├── MyCat_安装指南(linux).doc │ ├── MyCat专家系列之Mycat前世今生.doc │ ├── MyCat主键自增字段开启.docx │ ├── MyCat性能测试案例.docx │ ├── MySql常用命令总结.txt │ ├── Mycat 26亿单表分片案例及性能测试.docx │ ├── Mycat Q&A.docx │ ├── Mycat-Balance使用指南.docx │ ├── Mycat-cluster设计简析.docx │ ├── Mycat_Develope_Guide.docx │ ├── Mycat一致性哈希分片算法.docx │ ├── Mycat事务补偿设计文档(讨论稿).docx │ ├── Mycat命令行监控指南.docx │ ├── Mycat性能测试指南.docx │ ├── Mycat性能调优指南.docx │ ├── Mycat智能优化设计方案.doc │ ├── Mycat最权威DBCP使用手册.docx │ ├── Mycat最权威Mysql主从配置手册.docx │ ├── Mycat路由新解析器选型分析与结果.docx │ ├── Mycat运行时序图.vsd │ ├── Mycat高级功能测试案例.docx │ ├── Q&A.docx │ ├── dev │ │ ├── Mycat命令行监控指南.docx │ │ ├── Mycat智能优化设计方案.doc │ │ ├── mycat同步实现的设计.txt │ │ └── 一亿组数据排序.docx │ ├── mycat+percona_cluster.docx │ ├── mycat创建调用返回结果集的存储过程 (1).txt │ ├── mycat路由解析开发指南.docx │ ├── sequnce-sql.txt │ ├── 一亿组数据排序.docx │ └── 案例集 │ │ ├── mycat字符串枚举分片示例.txt │ │ ├── 从单租户改进到多租户模式的简单实现.docx │ │ └── 枚举分片容错性动态扩展.txt ├── mycat.io-bill.png ├── mycat技术分享 .ppt ├── mysql │ └── mysql事务级别和复制问题.rtf ├── 入门指南 │ ├── Mongodb in Mycat指南.docx │ ├── MyCat_In_Advanced.doc │ ├── MyCat_安装指南(linux).doc │ ├── MyCat专家系列之Mycat前世今生.doc │ ├── Mycat升级指南.docx │ ├── Mycat命令行监控指南.docx │ ├── Mycat跨分片Join指南.docx │ ├── mycat分片规则 .docx │ ├── mycat安装入门(两节点).md │ ├── mycat安装入门(两节点).pdf │ ├── rehash guide for murmur and mod.md │ ├── sequnce-sql.txt │ ├── 各数据库分页语法支持.docx │ ├── 字符集问题.txt │ └── 通配符配置指南.docx ├── 开发指南 │ ├── Hibernate连接Mycat例子详解_正能量_20150507.rar │ ├── MySql常用命令总结.txt │ ├── Mycat_Develope_Guide.docx │ ├── github个人使用笔记.doc │ └── mycat路由解析开发指南.docx ├── 怎样成为一名志愿者.docx ├── 案例分享 │ ├── mycat使用经验分享.docx │ └── readme.txt ├── 测试案例与报告 │ ├── DDAP-FPMA第二轮性能提升测试报告.docx │ ├── MyCAT性能损失率报告.docx │ ├── MyCAT性能测试案例集.wps │ ├── MyCat性能测试案例.docx │ ├── MyCat测试报告(olap读测试).docx │ ├── MyCat测试报告(单机MyCAT对比多机MyCAT).docx │ ├── MyCat测试报告(单机MySQL与通过MyCat分表后的对比情况).docx │ ├── Mycat 26亿单表分片案例及性能测试.docx │ ├── Mycat高级功能测试案例.docx │ ├── SQL92标准语句Mycat支持测试_基于Oracle和MySQL_20150422.docx │ ├── TPCC测试mycat测试报告.docx │ ├── mycat1.3性能测试案例.docx │ └── 某公司测试报告.docx ├── 生产部署 │ ├── Lvs基本安装&脚本启动版 │ │ ├── Lvs安装.docx │ │ ├── lvs.sh │ │ └── lvs_realserver.sh │ ├── MHA-by 左越宗.md │ ├── MyCat生产部署经验分享.docx │ ├── Mycat主从与读写分离配置详解与示例_正能量_20150721.rar │ ├── mycat实战笔记-1.doc │ ├── 集权对比.md │ └── 集群比对+haproxy.doc ├── 研究资料 │ └── mysql-xa.txt ├── 设计文档 │ ├── 1.5 │ │ ├── Mycat Architecture.docx │ │ ├── Mycat AutoOperation.docx │ │ ├── Mycat AutoScale.docx │ │ ├── Mycat HAProxy.docx │ │ ├── Mycat HBTEngine.docx │ │ ├── Mycat ZK.docx │ │ └── Mycat智能优化设计方案.doc │ ├── 2.0 │ │ ├── Mycat ZK配置文件详解.docx │ │ ├── ZK 配置文档.md │ │ ├── resource │ │ │ ├── cat1.png │ │ │ ├── cat2.png │ │ │ ├── cat3.png │ │ │ ├── cat4.png │ │ │ └── cat5.png │ │ └── 全局表一致性检测和SQL拦截改写的实现.docx │ ├── MyCAT人工智能解决跨分片SQL.docx │ ├── Mycat-cluster设计简析.docx │ ├── Mycat一致性哈希分片算法.docx │ ├── Mycat事务补偿设计文档(讨论稿).docx │ ├── Mycat智能优化设计方案.doc │ ├── Mycat运行时序图.vsd │ ├── NIO的陷阱.docx │ ├── Select的where条件解析增加Between解析说明.docx │ ├── mycat创建调用返回结果集的存储过程 (1).txt │ ├── mycat同步实现的设计.txt │ ├── mycat字符串枚举分片示例.txt │ ├── 一亿组数据排序.docx │ ├── 从单租户改进到多租户模式的简单实现.docx │ └── 枚举分片容错性动态扩展.txt └── 进阶文档 │ ├── Haproxy+Mycat集群搭建指南.docx │ ├── MyCat主键自增字段开启.docx │ ├── Mycat-Balance使用指南.docx │ ├── Mycat性能测试指南.docx │ ├── Mycat性能调优指南.docx │ ├── Mycat最权威DBCP使用手册.docx │ ├── Mycat最权威Mysql主从配置手册.docx │ ├── Mycat路由新解析器选型分析与结果.docx │ ├── loadData批量导入以及压缩协议使用指南.docx │ ├── mycat xa特性.txt │ ├── mycat+percona_cluster.docx │ └── mycat读写分离模式智能优化方案.docx ├── mysqlTools ├── binlog-rollbakc.pl ├── goopsrc │ └── gomysql.go ├── mysql_admin.py ├── mysql_physicbackup.sh ├── mysql_rotate_slowlog.sh ├── mysql_slave_admin.py ├── mysql_status.sh ├── mysql_utilities │ ├── CHANGES.txt │ ├── LICENSE.txt │ ├── MANIFEST │ ├── MANIFEST.in │ ├── README.txt │ ├── bs4 │ │ ├── __init__.py │ │ ├── __init__.pyc │ │ ├── builder │ │ │ ├── __init__.py │ │ │ ├── __init__.pyc │ │ │ ├── _html5lib.py │ │ │ ├── _html5lib.pyc │ │ │ ├── _htmlparser.py │ │ │ ├── _htmlparser.pyc │ │ │ ├── _lxml.py │ │ │ └── _lxml.pyc │ │ ├── dammit.py │ │ ├── dammit.pyc │ │ ├── element.py │ │ ├── element.pyc │ │ ├── testing.py │ │ └── tests │ │ │ ├── __init__.py │ │ │ ├── test_builder_registry.py │ │ │ ├── test_docs.py │ │ │ ├── test_html5lib.py │ │ │ ├── test_htmlparser.py │ │ │ ├── test_lxml.py │ │ │ ├── test_soup.py │ │ │ └── test_tree.py │ ├── check.py │ ├── doc │ │ ├── changes.rst │ │ ├── command │ │ │ ├── grep.rst │ │ │ ├── index.rst │ │ │ └── proc.rst │ │ ├── conf.py │ │ ├── index.rst │ │ ├── intro │ │ │ ├── connspec.rst │ │ │ ├── developers.rst │ │ │ ├── examples │ │ │ │ └── copy_server.py │ │ │ ├── index.rst │ │ │ └── intro.rst │ │ ├── man │ │ │ ├── index.rst │ │ │ ├── mut.rst │ │ │ ├── mysqldbcompare.rst │ │ │ ├── mysqldbcopy.rst │ │ │ ├── mysqldbexport.rst │ │ │ ├── mysqldbimport.rst │ │ │ ├── mysqldiff.rst │ │ │ ├── mysqldiskusage.rst │ │ │ ├── mysqlfailover.rst │ │ │ ├── mysqlindexcheck.rst │ │ │ ├── mysqlmetagrep.rst │ │ │ ├── mysqlprocgrep.rst │ │ │ ├── mysqlreplicate.rst │ │ │ ├── mysqlrpladmin.rst │ │ │ ├── mysqlrplcheck.rst │ │ │ ├── mysqlrplshow.rst │ │ │ ├── mysqlserverclone.rst │ │ │ ├── mysqlserverinfo.rst │ │ │ ├── mysqluserclone.rst │ │ │ └── overview.rst │ │ └── parser │ │ │ ├── index.rst │ │ │ └── parser.rst │ ├── freeze.py │ ├── info.py │ ├── info.pyc │ ├── mysql-test │ │ ├── disabled │ │ ├── mut.py │ │ ├── mutlib │ │ │ ├── __init__.py │ │ │ └── mutlib.py │ │ ├── r │ │ │ ├── audit_log_admin.result │ │ │ ├── audit_log_admin_errors.result │ │ │ ├── audit_log_grep.result │ │ │ ├── audit_log_grep_errors.result │ │ │ ├── check_index.result │ │ │ ├── check_index_best_worst_large.result │ │ │ ├── check_index_best_worst_small.result │ │ │ ├── check_index_errors.result │ │ │ ├── check_index_format.result │ │ │ ├── check_index_parameters.result │ │ │ ├── check_unsupported_server_version.result │ │ │ ├── clone_db_errors.result │ │ │ ├── clone_db_exclude.result │ │ │ ├── clone_db_parameters.result │ │ │ ├── clone_server.result │ │ │ ├── clone_server_errors.result │ │ │ ├── clone_server_parameters.result │ │ │ ├── clone_user.result │ │ │ ├── clone_user_errors.result │ │ │ ├── clone_user_parameters.result │ │ │ ├── compare_db.result │ │ │ ├── compare_db_errors.result │ │ │ ├── compare_db_parameters.result │ │ │ ├── compare_db_skips.result │ │ │ ├── compare_db_sql.result │ │ │ ├── copy_db_errors.result │ │ │ ├── copy_db_exclude.result │ │ │ ├── copy_db_parameters.result │ │ │ ├── copy_db_skip_objects.result │ │ │ ├── copy_db_special_symbols.result │ │ │ ├── copy_user.result │ │ │ ├── copy_user_errors.result │ │ │ ├── copy_user_parameters.result │ │ │ ├── diff.result │ │ │ ├── diff_errors.result │ │ │ ├── diff_parameters.result │ │ │ ├── diff_sql.result │ │ │ ├── diskusage_basic.result │ │ │ ├── diskusage_errors.result │ │ │ ├── diskusage_format.result │ │ │ ├── diskusage_parameters.result │ │ │ ├── diskusage_paths.result │ │ │ ├── export_basic.result │ │ │ ├── export_errors.result │ │ │ ├── export_exclude.result │ │ │ ├── export_file_per_table.result │ │ │ ├── export_locks.result │ │ │ ├── export_mysql.result │ │ │ ├── export_parameters_both.result │ │ │ ├── export_parameters_data.result │ │ │ ├── export_parameters_def.result │ │ │ ├── export_skip_objects.result │ │ │ ├── format_list.result │ │ │ ├── get_tool_windows.result │ │ │ ├── import_basic.result │ │ │ ├── import_engines.result │ │ │ ├── import_errors.result │ │ │ ├── import_file_per_table.result │ │ │ ├── import_parameters.result │ │ │ ├── meta_grep.result │ │ │ ├── meta_grep_parameters.result │ │ │ ├── mylogin.result │ │ │ ├── mylogin_clone_user.result │ │ │ ├── proc_grep.result │ │ │ ├── proc_grep_parameters.result │ │ │ ├── server_info.result │ │ │ ├── server_info_errors.result │ │ │ ├── server_info_parameters.result │ │ │ ├── utilities_console_base.result │ │ │ ├── utilities_console_custom_utildir.result │ │ │ ├── utilities_console_parameters.result │ │ │ └── utilities_console_pipe.result │ │ ├── std_data │ │ │ ├── audit.log.13488316109086370 │ │ │ ├── audit.log.invalid │ │ │ ├── backtick_data.sql │ │ │ ├── bad_engine.csv │ │ │ ├── bad_object.csv │ │ │ ├── bad_sql.sql │ │ │ ├── basic_data.sql │ │ │ ├── basic_users.sql │ │ │ ├── clone_db_inserts.inc │ │ │ ├── db_compare_backtick.sql │ │ │ ├── db_compare_test.sql │ │ │ ├── fkeys.sql │ │ │ ├── index_test.sql │ │ │ ├── show_arguments.sh │ │ │ ├── special_data.sql │ │ │ └── transform_data.sql │ │ ├── suite │ │ │ ├── experimental │ │ │ │ ├── r │ │ │ │ │ ├── t2.result │ │ │ │ │ └── t4.result │ │ │ │ └── t │ │ │ │ │ ├── t1.py │ │ │ │ │ ├── t2.py │ │ │ │ │ ├── t3.py │ │ │ │ │ └── t4.py │ │ │ ├── performance │ │ │ │ ├── r │ │ │ │ │ └── copy_db_multithreaded.result │ │ │ │ └── t │ │ │ │ │ └── copy_db_multithreaded.py │ │ │ └── replication │ │ │ │ ├── r │ │ │ │ ├── alias.result │ │ │ │ ├── check_gtid_version.result │ │ │ │ ├── check_rpl.result │ │ │ │ ├── check_rpl_errors.result │ │ │ │ ├── check_rpl_parameters.result │ │ │ │ ├── check_rpl_table.result │ │ │ │ ├── clone_db_rpl_errors.result │ │ │ │ ├── copy_db_gtid.result │ │ │ │ ├── copy_db_rpl_errors.result │ │ │ │ ├── export_gtid.result │ │ │ │ ├── export_rpl.result │ │ │ │ ├── export_rpl_errors.result │ │ │ │ ├── export_rpl_parameters.result │ │ │ │ ├── failover_errors.result │ │ │ │ ├── failover_parameters.result │ │ │ │ ├── gtid_no_password.result │ │ │ │ ├── replicate_engines.result │ │ │ │ ├── replicate_errors.result │ │ │ │ ├── replicate_innodb.result │ │ │ │ ├── replicate_parameters.result │ │ │ │ ├── rpl_admin.result │ │ │ │ ├── rpl_admin_errors.result │ │ │ │ ├── rpl_admin_failover_missing.result │ │ │ │ ├── rpl_admin_gtid.result │ │ │ │ ├── rpl_admin_gtid_demote_master_repo_file.result │ │ │ │ ├── rpl_admin_gtid_demote_master_repo_table.result │ │ │ │ ├── rpl_admin_logfile.result │ │ │ │ ├── rpl_admin_parameters.result │ │ │ │ ├── rpl_admin_scripts.result │ │ │ │ ├── rpl_admin_warnings.result │ │ │ │ ├── show_rpl.result │ │ │ │ ├── show_rpl_errors.result │ │ │ │ ├── show_rpl_parameters.result │ │ │ │ └── show_rpl_warnings.result │ │ │ │ └── t │ │ │ │ ├── alias.py │ │ │ │ ├── check_gtid_version.py │ │ │ │ ├── check_rpl.py │ │ │ │ ├── check_rpl_errors.py │ │ │ │ ├── check_rpl_parameters.py │ │ │ │ ├── check_rpl_table.py │ │ │ │ ├── clone_db_rpl_errors.py │ │ │ │ ├── copy_db_gtid.py │ │ │ │ ├── copy_db_rpl.py │ │ │ │ ├── copy_db_rpl_errors.py │ │ │ │ ├── export_gtid.py │ │ │ │ ├── export_rpl.py │ │ │ │ ├── export_rpl_errors.py │ │ │ │ ├── export_rpl_parameters.py │ │ │ │ ├── failover.py │ │ │ │ ├── failover_errors.py │ │ │ │ ├── failover_instances.py │ │ │ │ ├── failover_parameters.py │ │ │ │ ├── gtid_no_password.py │ │ │ │ ├── import_rpl.py │ │ │ │ ├── replicate.py │ │ │ │ ├── replicate_engines.py │ │ │ │ ├── replicate_errors.py │ │ │ │ ├── replicate_innodb.py │ │ │ │ ├── replicate_log_file.py │ │ │ │ ├── replicate_parameters.py │ │ │ │ ├── rpl_admin.py │ │ │ │ ├── rpl_admin_errors.py │ │ │ │ ├── rpl_admin_failover_missing.py │ │ │ │ ├── rpl_admin_gtid.py │ │ │ │ ├── rpl_admin_gtid_demote_master_repo_file.py │ │ │ │ ├── rpl_admin_gtid_demote_master_repo_table.py │ │ │ │ ├── rpl_admin_logfile.py │ │ │ │ ├── rpl_admin_parameters.py │ │ │ │ ├── rpl_admin_scripts.py │ │ │ │ ├── rpl_admin_warnings.py │ │ │ │ ├── show_rpl.py │ │ │ │ ├── show_rpl_errors.py │ │ │ │ ├── show_rpl_parameters.py │ │ │ │ └── show_rpl_warnings.py │ │ └── t │ │ │ ├── __init__.py │ │ │ ├── audit_log_admin.py │ │ │ ├── audit_log_admin_errors.py │ │ │ ├── audit_log_grep.py │ │ │ ├── audit_log_grep_errors.py │ │ │ ├── check_index.py │ │ │ ├── check_index_best_worst_large.py │ │ │ ├── check_index_best_worst_small.py │ │ │ ├── check_index_errors.py │ │ │ ├── check_index_format.py │ │ │ ├── check_index_parameters.py │ │ │ ├── check_unsupported_server_version.py │ │ │ ├── clone_db.py │ │ │ ├── clone_db_apostrophe.py │ │ │ ├── clone_db_errors.py │ │ │ ├── clone_db_exclude.py │ │ │ ├── clone_db_fkeys.py │ │ │ ├── clone_db_locks.py │ │ │ ├── clone_db_parameters.py │ │ │ ├── clone_server.py │ │ │ ├── clone_server_errors.py │ │ │ ├── clone_server_parameters.py │ │ │ ├── clone_user.py │ │ │ ├── clone_user_errors.py │ │ │ ├── clone_user_parameters.py │ │ │ ├── compare_db.py │ │ │ ├── compare_db_errors.py │ │ │ ├── compare_db_parameters.py │ │ │ ├── compare_db_skips.py │ │ │ ├── compare_db_sql.py │ │ │ ├── compare_db_sql_transform.py │ │ │ ├── connect_servers.py │ │ │ ├── connection_values.py │ │ │ ├── copy_db.py │ │ │ ├── copy_db_errors.py │ │ │ ├── copy_db_exclude.py │ │ │ ├── copy_db_fkeys.py │ │ │ ├── copy_db_locks.py │ │ │ ├── copy_db_parameters.py │ │ │ ├── copy_db_skip_objects.py │ │ │ ├── copy_db_special_symbols.py │ │ │ ├── copy_user.py │ │ │ ├── copy_user_errors.py │ │ │ ├── copy_user_parameters.py │ │ │ ├── diff.py │ │ │ ├── diff_errors.py │ │ │ ├── diff_parameters.py │ │ │ ├── diff_sql.py │ │ │ ├── diff_sql_databases.py │ │ │ ├── diff_sql_events.py │ │ │ ├── diff_sql_routines.py │ │ │ ├── diff_sql_tables_cols.py │ │ │ ├── diff_sql_tables_constr.py │ │ │ ├── diff_sql_tables_defn.py │ │ │ ├── diff_sql_tables_parts.py │ │ │ ├── diff_sql_triggers.py │ │ │ ├── diff_sql_views.py │ │ │ ├── diskusage_basic.py │ │ │ ├── diskusage_errors.py │ │ │ ├── diskusage_format.py │ │ │ ├── diskusage_parameters.py │ │ │ ├── diskusage_paths.py │ │ │ ├── export_basic.py │ │ │ ├── export_errors.py │ │ │ ├── export_exclude.py │ │ │ ├── export_file_per_table.py │ │ │ ├── export_locks.py │ │ │ ├── export_mysql.py │ │ │ ├── export_parameters_both.py │ │ │ ├── export_parameters_data.py │ │ │ ├── export_parameters_def.py │ │ │ ├── export_skip_objects.py │ │ │ ├── format_list.py │ │ │ ├── get_tool_windows.py │ │ │ ├── import_basic.py │ │ │ ├── import_engines.py │ │ │ ├── import_errors.py │ │ │ ├── import_file_per_table.py │ │ │ ├── import_parameters.py │ │ │ ├── locking.py │ │ │ ├── meta_grep.py │ │ │ ├── meta_grep_parameters.py │ │ │ ├── mylogin.py │ │ │ ├── mylogin_clone_db.py │ │ │ ├── mylogin_clone_user.py │ │ │ ├── parse_connection.py │ │ │ ├── proc_grep.py │ │ │ ├── proc_grep_parameters.py │ │ │ ├── server_info.py │ │ │ ├── server_info_errors.py │ │ │ ├── server_info_parameters.py │ │ │ ├── test_sql_template.py │ │ │ ├── utilities_console_base.py │ │ │ ├── utilities_console_custom_utildir.py │ │ │ ├── utilities_console_parameters.py │ │ │ └── utilities_console_pipe.py │ ├── mysql │ │ ├── __init__.py │ │ ├── __init__.pyc │ │ └── utilities │ │ │ ├── __init__.py │ │ │ ├── __init__.pyc │ │ │ ├── command │ │ │ ├── __init__.py │ │ │ ├── audit_log.py │ │ │ ├── check_rpl.py │ │ │ ├── dbcompare.py │ │ │ ├── dbcopy.py │ │ │ ├── dbexport.py │ │ │ ├── dbimport.py │ │ │ ├── diff.py │ │ │ ├── diskusage.py │ │ │ ├── failover_console.py │ │ │ ├── grep.py │ │ │ ├── indexcheck.py │ │ │ ├── proc.py │ │ │ ├── rpl_admin.py │ │ │ ├── serverclone.py │ │ │ ├── serverinfo.py │ │ │ ├── setup_rpl.py │ │ │ ├── show_rpl.py │ │ │ ├── userclone.py │ │ │ └── utilitiesconsole.py │ │ │ ├── common │ │ │ ├── __init__.py │ │ │ ├── audit_log_parser.py │ │ │ ├── audit_log_reader.py │ │ │ ├── console.py │ │ │ ├── database.py │ │ │ ├── dbcompare.py │ │ │ ├── format.py │ │ │ ├── lock.py │ │ │ ├── messages.py │ │ │ ├── my_print_defaults.py │ │ │ ├── options.py │ │ │ ├── parser.py │ │ │ ├── pattern_matching.py │ │ │ ├── replication.py │ │ │ ├── server.py │ │ │ ├── sql_transform.py │ │ │ ├── table.py │ │ │ ├── tools.py │ │ │ ├── topology.py │ │ │ ├── topology_map.py │ │ │ ├── user.py │ │ │ ├── utilities.py │ │ │ └── variables.py │ │ │ └── exception.py │ ├── scripts │ │ ├── mysqlauditadmin.py │ │ ├── mysqlauditgrep.py │ │ ├── mysqldbcompare.py │ │ ├── mysqldbcopy.py │ │ ├── mysqldbexport.py │ │ ├── mysqldbimport.py │ │ ├── mysqldiff.py │ │ ├── mysqldiskusage.py │ │ ├── mysqlfailover.py │ │ ├── mysqlindexcheck.py │ │ ├── mysqlmetagrep.py │ │ ├── mysqlprocgrep.py │ │ ├── mysqlreplicate.py │ │ ├── mysqlrpladmin.py │ │ ├── mysqlrplcheck.py │ │ ├── mysqlrplshow.py │ │ ├── mysqlserverclone.py │ │ ├── mysqlserverinfo.py │ │ ├── mysqluc.py │ │ └── mysqluserclone.py │ ├── setup.py │ ├── support │ │ ├── MSWindows │ │ │ ├── mysql_utilities.xml │ │ │ └── upgrade_codes.json │ │ ├── RPM │ │ │ └── mysql_utilities.spec │ │ ├── __init__.py │ │ ├── dist_msi.py │ │ └── wix.py │ └── unit_tests │ │ ├── __init__.py │ │ ├── sample-general.log │ │ ├── sample-slow.log │ │ ├── test_my_print_defaults.py │ │ ├── test_options.py │ │ └── test_parsers.py ├── orzdba ├── orzdba工具使用说明.pdf └── xa-general-statistic.py ├── osperftools ├── LICENSE ├── README.md ├── bin │ ├── bitesize │ ├── cachestat │ ├── execsnoop │ ├── funccount │ ├── funcgraph │ ├── funcslower │ ├── functrace │ ├── iolatency │ ├── iosnoop │ ├── killsnoop │ ├── kprobe │ ├── opensnoop │ ├── perf-stat-hist │ ├── reset-ftrace │ ├── syscount │ ├── tcpretrans │ ├── tpoint │ └── uprobe ├── deprecated │ ├── README.md │ ├── execsnoop-proc │ ├── execsnoop-proc.8 │ └── execsnoop-proc_example.txt ├── disk │ └── bitesize ├── examples │ ├── bitesize_example.txt │ ├── cachestat_example.txt │ ├── execsnoop_example.txt │ ├── funccount_example.txt │ ├── funcgraph_example.txt │ ├── funcslower_example.txt │ ├── functrace_example.txt │ ├── iolatency_example.txt │ ├── iosnoop_example.txt │ ├── killsnoop_example.txt │ ├── kprobe_example.txt │ ├── opensnoop_example.txt │ ├── perf-stat-hist_example.txt │ ├── reset-ftrace_example.txt │ ├── syscount_example.txt │ ├── tcpretrans_example.txt │ ├── tpoint_example.txt │ └── uprobe_example.txt ├── execsnoop ├── fs │ └── cachestat ├── images │ └── perf-tools_2016.png ├── iolatency ├── iosnoop ├── kernel │ ├── funccount │ ├── funcgraph │ ├── funcslower │ ├── functrace │ └── kprobe ├── killsnoop ├── man │ └── man8 │ │ ├── bitesize.8 │ │ ├── cachestat.8 │ │ ├── execsnoop.8 │ │ ├── funccount.8 │ │ ├── funcgraph.8 │ │ ├── funcslower.8 │ │ ├── functrace.8 │ │ ├── iolatency.8 │ │ ├── iosnoop.8 │ │ ├── killsnoop.8 │ │ ├── kprobe.8 │ │ ├── opensnoop.8 │ │ ├── perf-stat-hist.8 │ │ ├── reset-ftrace.8 │ │ ├── syscount.8 │ │ ├── tcpretrans.8 │ │ ├── tpoint.8 │ │ └── uprobe.8 ├── misc │ └── perf-stat-hist ├── net │ └── tcpretrans ├── opensnoop ├── syscount ├── system │ └── tpoint ├── tools │ └── reset-ftrace └── user │ └── uprobe ├── redisCmdCheckSyntx.go ├── redisTools ├── README.me ├── RedisClusterMonitor.py ├── goopsrc │ ├── LICENSE │ ├── aof │ │ ├── aof_const.go │ │ ├── aof_parse.go │ │ ├── aof_test.go │ │ ├── aof_tools.go │ │ ├── hash_cmd_parse.go │ │ ├── list_cmd_parse.go │ │ ├── set_cmd_parse.go │ │ ├── string_cmd_parse.go │ │ └── zset_cmd_parse.go │ ├── cmd │ │ └── redisDBATools.go │ └── test │ │ ├── redis-appendonly.aof │ │ └── redis-dump.rdb ├── redis-audit.rb ├── redis-cli-new ├── redis-cli-new.c ├── redis-sampler.rb ├── redisHealthy │ ├── README.me │ ├── cmd │ │ ├── main.go │ │ └── test │ │ │ └── main.go │ ├── ctrl │ │ ├── redisctl.go │ │ └── timectl.go │ ├── lib │ │ └── db │ │ │ └── redis.go │ └── logic │ │ ├── cmds │ │ ├── rediscmds.go │ │ ├── redishashcmds.go │ │ ├── redislistcmds.go │ │ ├── redissetcmds.go │ │ ├── redisstringcmds.go │ │ └── rediszsetcmds.go │ │ ├── macro │ │ └── global.go │ │ └── micro │ │ └── details.go ├── redis_key_delete.py └── redis_key_distribution.py └── stringSimilarity.go /bucketlimit.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "time" 6 | ) 7 | 8 | func LeakBucketLimit(MaxQps int, ticket chan struct{}) { 9 | 10 | nticket := int(float64(MaxQps) / 1000) // mileSeconds 11 | if nticket <= 0 { 12 | nticket = 1 13 | } 14 | 15 | fmt.Println("qps for per millseconds : ", nticket) 16 | tkChan := time.NewTicker(time.Millisecond) 17 | 18 | c := 0 19 | for { 20 | if _, ok := <-tkChan.C; ok { 21 | for i := 0; i < nticket; i++ { 22 | select { 23 | case ticket <- struct{}{}: 24 | continue 25 | //fmt.Println("make ticket : ", i) 26 | } 27 | c++ 28 | } 29 | //fmt.Println("make ticket ok ", c) 30 | } else { 31 | fmt.Println("exit make ticket") 32 | break 33 | } 34 | } 35 | } 36 | 37 | func main(){ 38 | ticket := make(chan struct{}, 100) 39 | go LeakBucketLimit(limit, ticket) 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /lianjiaershoufang.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | "github.com/go-redis/redis" 7 | "github.com/gocolly/colly" 8 | "strconv" 9 | "time" 10 | ) 11 | 12 | var ( 13 | watchList = []string{"bj", "sh", "sz", "cd", "cq", "xa"} 14 | watchDict = map[string]int{} 15 | cli *redis.Client 16 | addr, pswd string 17 | ) 18 | 19 | func init() { 20 | flag.StringVar(&addr, "addr", "127.0.0.1:33800", "redis addr") 21 | flag.StringVar(&pswd, "password", "testx1", "redis password") 22 | 23 | flag.Parse() 24 | cli = redis.NewClient(&redis.Options{ 25 | Addr: addr, 26 | Password: pswd, // no password set 27 | DB: 0, // use default DB 28 | }) 29 | } 30 | 31 | func main() { 32 | c := colly.NewCollector() 33 | 34 | var city string 35 | // Find and visit all links 36 | c.OnHTML(".content .resultDes .total", func(e *colly.HTMLElement) { 37 | str := e.ChildText("span") 38 | cnt, err := strconv.Atoi(str) 39 | if err != nil { 40 | fmt.Println("convert ", str, "to int failed ") 41 | } 42 | watchDict[city] = cnt 43 | }) 44 | 45 | //c.OnHTML("a[href]", func(e *colly.HTMLElement) { 46 | // //c.Visit(e.Request.AbsoluteURL(link)) 47 | // e.Request.Visit(e.Attr("href")) 48 | //}) 49 | 50 | //c.OnRequest(func(r *colly.Request) { 51 | // fmt.Println("Visiting", r.URL) 52 | //}) 53 | 54 | for _, city = range watchList { 55 | url := fmt.Sprintf("https://%s.lianjia.com/ershoufang", city) 56 | c.Visit(url) 57 | } 58 | showResultAndSave() 59 | } 60 | 61 | func showResultAndSave() { 62 | now := time.Now().Format("20060102") 63 | for c, cnt := range watchDict { 64 | hk := fmt.Sprintf("house|ershou|%s", c) 65 | cli.HSet(hk, now, cnt) 66 | fmt.Println(hk, now, cnt) 67 | } 68 | fmt.Println("Job Done") 69 | } 70 | -------------------------------------------------------------------------------- /linux_wellcome.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #Server OS info 3 | OS_version='' 4 | if grep -q 'release 6' /etc/redhat-release ; then 5 | OS_version='CentOS6' 6 | else 7 | OS_version='CentOS7' 8 | fi 9 | 10 | echo -e "#################################Server INFO#################################################" 11 | hostname=`hostname` 12 | echo -e "HostName = $hostname" 13 | 14 | osinfo=`cat /etc/redhat-release` 15 | echo -e "OS info = $osinfo" 16 | 17 | kernelinfo=`uname -r` 18 | echo -e "LinuxKernel = $kernelinfo" 19 | 20 | kernelmac=`uname -m` 21 | echo -e "HW Machine = $kernelmac" 22 | 23 | CPU=`cat /proc/cpuinfo | grep "model name" | head -n 1 | awk -F ":" "{print $2}"` 24 | echo -e "CPU info = $CPU" 25 | 26 | if [ ${OS_version} == 'CentOS6' ];then 27 | network=`ifconfig -a | awk 'BEGIN {FS="\n"; RS=""} {print $1,$2}' | grep -v 'lo' | awk '{print "\t\t"$1,$7}'` 28 | else 29 | network=`ifconfig -a | awk 'BEGIN {FS="\n"; RS=""} {print $1,$2}' | grep -v 'lo' | awk '{print "\t\t"$1,$6}'` 30 | fi 31 | 32 | echo -e "NetWork info = \n$network" 33 | 34 | externalip=$(timeout 3 curl -s ipecho.net/plain;echo) 35 | [ $? -ne 0 -o 'X' == "$externalip"X ] && externalip='No outside network or ACL drop' 36 | echo -e "External IP = $externalip" 37 | 38 | 39 | echo -e "---------------------------------------------------------------------------------------------" 40 | 41 | Username=`whoami` 42 | echo -e "UserName = $Username" 43 | 44 | echo -e "UserHomeDir = $HOME" 45 | 46 | echo -e "---------------------------------------------------------------------------------------------" 47 | -------------------------------------------------------------------------------- /mycatDocs/MyCAT的S级别任务.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/MyCAT的S级别任务.docx -------------------------------------------------------------------------------- /mycatDocs/MyCat_In_Action_CN.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/MyCat_In_Action_CN.doc -------------------------------------------------------------------------------- /mycatDocs/MyCat调研.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/MyCat调研.pptx -------------------------------------------------------------------------------- /mycatDocs/Mycat Q&A.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/Mycat Q&A.docx -------------------------------------------------------------------------------- /mycatDocs/Mycat-ePlatform/Mycat_OpenBusinessPlatform.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/Mycat-ePlatform/Mycat_OpenBusinessPlatform.pptx -------------------------------------------------------------------------------- /mycatDocs/Mycat_OpenBusinessPlatform.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/Mycat_OpenBusinessPlatform.pptx -------------------------------------------------------------------------------- /mycatDocs/Mycat介绍.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/Mycat介绍.pptx -------------------------------------------------------------------------------- /mycatDocs/README.md: -------------------------------------------------------------------------------- 1 | # Mycat介绍 2 | 3 | 支持1000亿大数据中国第一开源分布式数据库中间件 4 | >## Mycat是什么 5 | 一个可以用于MySQL读写分离和高可用的中间件 6 | 一个模拟为MySQL Server的超级数据库 7 | 一个能平滑扩展支持1000亿大表的分布式数据库系统 8 | 一个可管控多种关系数据库的数据库路由器 9 | 一个平滑从关系数据升级到大数据的应用中间件 10 | 11 | 12 | 13 | # 1. Mycat之前世今生 14 | 15 | ### 1. 2013年阿里的Cobar在某大型项目中使用过程中发现存在一些比较严重的问题,于是第一代改良版——Mycat诞生。 16 | 17 | 18 | ### 2. Mycat开源以后,一些Cobar的用户参与了Mycat的开发,最终Mycat发展成为一个由众多软件公司的实力派架构师和资深开发人员维护的社区型开源软件。 19 | 20 | ### 3. 2014年Mycat首次在上海的《中华架构师》大会上对外宣讲,引发围观,更多的人参与进来,随后越来越多的项目采用了Mycat 21 | ### 4. 2015年4月为止,Mycat项目总共有13个Committer,其中核心参与者的年薪总额超过200万 22 | 23 | ### 5. 2015年5月,由核心参与者们一起编写的第一本官方权威指南《Mycat权威指南》电子版发布,众筹预售超过200本,成为开源项目中的首创 24 | 25 | ### 6. 截至2015年4月,超过60个项目采用Mycat,涵盖电信、电子商务、物流、移动应用、O2O的众多领域和公司。 26 | 27 | # 2.Mycat社区的发展 28 | 29 | ### 1. 截至2014年5月,Mycat官方QQ群(106088787)已经超过1700人,大多数为资深IT工程师、架构师、DBA、以及一些CXO和高端猎头,成为国内最有影响力的高端IT专业群 30 | 31 | ### 2. Mycat社区首次提出BigSQL的概念,并逐步将大数据和实时计算等先进技术引入到Mycat里,从而吸引和聚集了一大批业内大数据和云计算方面的资深工程师,Mycat社区成为名副其实的国内大数据领域实力派成员。 32 | 33 | ### 3. Mycat社区里不断有优秀工程师被创业公司挖走,为了能更好的支持创业公司并寻求更多的优秀工程师参与采用,Mycat社区目前已经开始开展在线高端IT培训,培养高端Java架构师、工程师。 34 | 35 | # 3. 为什么选择Mycat 36 | 37 | ### 1.基于阿里的成熟项目Cobar而来,它有过大量的大规模生产案例 38 | 39 | ### 2. 社区非常活跃,维护者的水平很高,重大Bug都24小时修复 40 | ### 3. 目前的生产案例是开源项目中为数最多的,而且很多是大型项目 41 | ### 4. Mycat的版本分为长期支持版本和当前最新版本两种,前者出现重大Bug后,还会及时修复,解决了生产中应用的后顾之忧 42 | ### 5. Mycat的资料非常全,包括志愿者提供的资料,用户分享的经验资料,以及官方定期更新的《Mycat权威指南》,绝大多数技术问题,都可以通过文档和社区交流来解决 43 | ### 6. 如果需要专业技术支持服务,也可以跟Mycat社区交流,通过赞助开源项目的方式,名利双收,一举两得。 44 | 45 | # 4.关于 46 | > 官方网站 47 | [mycat.org.cn](http://mycat.org.cn) 48 | > 49 | 官方QQ群 106088787 50 | [点击链接加入群【MyCAT】](http://jq.qq.com/?_wv=1027&k=WsjgBb) 51 | > 52 | github地址 53 | https://github.com/MyCATApache 54 | -------------------------------------------------------------------------------- /mycatDocs/history/1.0/MyCAT性能测试案例集.wps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.0/MyCAT性能测试案例集.wps -------------------------------------------------------------------------------- /mycatDocs/history/1.0/MyCat_In_Action_中文版.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.0/MyCat_In_Action_中文版.doc -------------------------------------------------------------------------------- /mycatDocs/history/1.0/MyCat专家系列之Mycat前世今生.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.0/MyCat专家系列之Mycat前世今生.doc -------------------------------------------------------------------------------- /mycatDocs/history/1.0/MySql常用命令总结.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.0/MySql常用命令总结.txt -------------------------------------------------------------------------------- /mycatDocs/history/1.0/Mycat Q&A.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.0/Mycat Q&A.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.0/Mycat-Balance使用指南.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.0/Mycat-Balance使用指南.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.0/Mycat-cluster设计简析.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.0/Mycat-cluster设计简析.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.0/Mycat_Develope_Guide.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.0/Mycat_Develope_Guide.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.0/Mycat命令行监控指南.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.0/Mycat命令行监控指南.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.0/Mycat性能测试指南.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.0/Mycat性能测试指南.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.0/Mycat性能调优指南.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.0/Mycat性能调优指南.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.0/Mycat最权威DBCP使用手册.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.0/Mycat最权威DBCP使用手册.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.0/Mycat最权威Mysql主从配置手册.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.0/Mycat最权威Mysql主从配置手册.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.0/Mycat高级功能测试案例.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.0/Mycat高级功能测试案例.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.1/MyCAT性能测试案例集.wps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.1/MyCAT性能测试案例集.wps -------------------------------------------------------------------------------- /mycatDocs/history/1.1/MyCat_In_Action_中文版.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.1/MyCat_In_Action_中文版.doc -------------------------------------------------------------------------------- /mycatDocs/history/1.1/MyCat专家系列之Mycat前世今生.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.1/MyCat专家系列之Mycat前世今生.doc -------------------------------------------------------------------------------- /mycatDocs/history/1.1/MySql常用命令总结.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.1/MySql常用命令总结.txt -------------------------------------------------------------------------------- /mycatDocs/history/1.1/Mycat Q&A.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.1/Mycat Q&A.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.1/Mycat-Balance使用指南.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.1/Mycat-Balance使用指南.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.1/Mycat-cluster设计简析.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.1/Mycat-cluster设计简析.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.1/Mycat_Develope_Guide.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.1/Mycat_Develope_Guide.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.1/Mycat命令行监控指南.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.1/Mycat命令行监控指南.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.1/Mycat性能测试指南.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.1/Mycat性能测试指南.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.1/Mycat性能调优指南.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.1/Mycat性能调优指南.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.1/Mycat最权威DBCP使用手册.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.1/Mycat最权威DBCP使用手册.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.1/Mycat最权威Mysql主从配置手册.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.1/Mycat最权威Mysql主从配置手册.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.1/Mycat运行时序图.vsd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.1/Mycat运行时序图.vsd -------------------------------------------------------------------------------- /mycatDocs/history/1.1/Mycat高级功能测试案例.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.1/Mycat高级功能测试案例.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.1/NIO的陷阱.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.1/NIO的陷阱.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.1/Select的where条件解析增加Between解析说明.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.1/Select的where条件解析增加Between解析说明.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.2.1/MyCat_In_Action_中文版.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.2.1/MyCat_In_Action_中文版.doc -------------------------------------------------------------------------------- /mycatDocs/history/1.2/Haproxy+Mycat集群搭建指南.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.2/Haproxy+Mycat集群搭建指南.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.2/MyCat_In_Action_中文版.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.2/MyCat_In_Action_中文版.doc -------------------------------------------------------------------------------- /mycatDocs/history/1.2/MyCat_In_Advanced.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.2/MyCat_In_Advanced.doc -------------------------------------------------------------------------------- /mycatDocs/history/1.2/MyCat专家系列之Mycat前世今生.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.2/MyCat专家系列之Mycat前世今生.doc -------------------------------------------------------------------------------- /mycatDocs/history/1.2/MyCat性能测试案例.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.2/MyCat性能测试案例.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.2/Mycat Q&A.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.2/Mycat Q&A.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.2/Mycat_Develope_Guide.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.2/Mycat_Develope_Guide.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.2/Mycat命令行监控指南.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.2/Mycat命令行监控指南.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.2/Mycat性能调优指南.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.2/Mycat性能调优指南.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.2/Mycat最权威Mysql主从配置手册.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.2/Mycat最权威Mysql主从配置手册.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.2/Q&A.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/1.2/Q&A.docx -------------------------------------------------------------------------------- /mycatDocs/history/1.2/sequnce-sql.txt: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS MYCAT_SEQUENCE; 2 | CREATE TABLE MYCAT_SEQUENCE ( name VARCHAR(50) NOT NULL, current_value INT NOT NULL, increment INT NOT NULL DEFAULT 100, PRIMARY KEY (name) ) ENGINE=InnoDB; 3 | 4 | -- ---------------------------- 5 | -- Function structure for `mycat_seq_currval` 6 | -- ---------------------------- 7 | DROP FUNCTION IF EXISTS `mycat_seq_currval`; 8 | DELIMITER ;; 9 | CREATE DEFINER=`root`@`%` FUNCTION `mycat_seq_currval`(seq_name VARCHAR(50)) RETURNS varchar(64) CHARSET latin1 10 | DETERMINISTIC 11 | BEGIN 12 | DECLARE retval VARCHAR(64); 13 | SET retval="-999999999,null"; 14 | SELECT concat(CAST(current_value AS CHAR),",",CAST(increment AS CHAR) ) INTO retval FROM MYCAT_SEQUENCE WHERE name = seq_name; 15 | RETURN retval ; 16 | END 17 | ;; 18 | DELIMITER ; 19 | 20 | -- ---------------------------- 21 | -- Function structure for `mycat_seq_nextval` 22 | -- ---------------------------- 23 | DROP FUNCTION IF EXISTS `mycat_seq_nextval`; 24 | DELIMITER ;; 25 | CREATE DEFINER=`root`@`%` FUNCTION `mycat_seq_nextval`(seq_name VARCHAR(50)) RETURNS varchar(64) CHARSET latin1 26 | DETERMINISTIC 27 | BEGIN 28 | UPDATE MYCAT_SEQUENCE 29 | SET current_value = current_value + increment WHERE name = seq_name; 30 | RETURN mycat_seq_currval(seq_name); 31 | END 32 | ;; 33 | DELIMITER ; 34 | 35 | -- ---------------------------- 36 | -- Function structure for `mycat_seq_setval` 37 | -- ---------------------------- 38 | DROP FUNCTION IF EXISTS `mycat_seq_setval`; 39 | DELIMITER ;; 40 | CREATE DEFINER=`root`@`%` FUNCTION `mycat_seq_setval`(seq_name VARCHAR(50), value INTEGER) RETURNS varchar(64) CHARSET latin1 41 | DETERMINISTIC 42 | BEGIN 43 | UPDATE MYCAT_SEQUENCE 44 | SET current_value = value 45 | WHERE name = seq_name; 46 | RETURN mycat_seq_currval(seq_name); 47 | END 48 | ;; 49 | DELIMITER ; 50 | 51 | INSERT INTO MYCAT_SEQUENCE VALUES ('GLOBAL', 0, 100); 52 | SELECT MYCAT_SEQ_SETVAL('GLOBAL', 1); 53 | SELECT MYCAT_SEQ_CURRVAL('GLOBAL'); 54 | SELECT MYCAT_SEQ_NEXTVAL('GLOBAL'); 55 | 56 | 57 | -------------------------------------------------------------------------------- /mycatDocs/history/DDAP-FPMA第二轮性能提升测试报告.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/DDAP-FPMA第二轮性能提升测试报告.docx -------------------------------------------------------------------------------- /mycatDocs/history/Haproxy+Mycat集群搭建指南.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/Haproxy+Mycat集群搭建指南.docx -------------------------------------------------------------------------------- /mycatDocs/history/MyCAT人工智能解决跨分片SQL.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/MyCAT人工智能解决跨分片SQL.docx -------------------------------------------------------------------------------- /mycatDocs/history/MyCAT的S级别任务.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/MyCAT的S级别任务.docx -------------------------------------------------------------------------------- /mycatDocs/history/MyCat_In_Action_中文版.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/MyCat_In_Action_中文版.doc -------------------------------------------------------------------------------- /mycatDocs/history/MyCat_In_Advanced.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/MyCat_In_Advanced.doc -------------------------------------------------------------------------------- /mycatDocs/history/MyCat_Professional.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/MyCat_Professional.doc -------------------------------------------------------------------------------- /mycatDocs/history/MyCat_安装指南(linux).doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/MyCat_安装指南(linux).doc -------------------------------------------------------------------------------- /mycatDocs/history/MyCat专家系列之Mycat前世今生.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/MyCat专家系列之Mycat前世今生.doc -------------------------------------------------------------------------------- /mycatDocs/history/MyCat主键自增字段开启.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/MyCat主键自增字段开启.docx -------------------------------------------------------------------------------- /mycatDocs/history/MyCat性能测试案例.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/MyCat性能测试案例.docx -------------------------------------------------------------------------------- /mycatDocs/history/MySql常用命令总结.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/MySql常用命令总结.txt -------------------------------------------------------------------------------- /mycatDocs/history/Mycat 26亿单表分片案例及性能测试.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/Mycat 26亿单表分片案例及性能测试.docx -------------------------------------------------------------------------------- /mycatDocs/history/Mycat Q&A.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/Mycat Q&A.docx -------------------------------------------------------------------------------- /mycatDocs/history/Mycat-Balance使用指南.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/Mycat-Balance使用指南.docx -------------------------------------------------------------------------------- /mycatDocs/history/Mycat-cluster设计简析.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/Mycat-cluster设计简析.docx -------------------------------------------------------------------------------- /mycatDocs/history/Mycat_Develope_Guide.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/Mycat_Develope_Guide.docx -------------------------------------------------------------------------------- /mycatDocs/history/Mycat一致性哈希分片算法.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/Mycat一致性哈希分片算法.docx -------------------------------------------------------------------------------- /mycatDocs/history/Mycat事务补偿设计文档(讨论稿).docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/Mycat事务补偿设计文档(讨论稿).docx -------------------------------------------------------------------------------- /mycatDocs/history/Mycat命令行监控指南.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/Mycat命令行监控指南.docx -------------------------------------------------------------------------------- /mycatDocs/history/Mycat性能测试指南.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/Mycat性能测试指南.docx -------------------------------------------------------------------------------- /mycatDocs/history/Mycat性能调优指南.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/Mycat性能调优指南.docx -------------------------------------------------------------------------------- /mycatDocs/history/Mycat智能优化设计方案.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/Mycat智能优化设计方案.doc -------------------------------------------------------------------------------- /mycatDocs/history/Mycat最权威DBCP使用手册.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/Mycat最权威DBCP使用手册.docx -------------------------------------------------------------------------------- /mycatDocs/history/Mycat最权威Mysql主从配置手册.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/Mycat最权威Mysql主从配置手册.docx -------------------------------------------------------------------------------- /mycatDocs/history/Mycat路由新解析器选型分析与结果.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/Mycat路由新解析器选型分析与结果.docx -------------------------------------------------------------------------------- /mycatDocs/history/Mycat运行时序图.vsd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/Mycat运行时序图.vsd -------------------------------------------------------------------------------- /mycatDocs/history/Mycat高级功能测试案例.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/Mycat高级功能测试案例.docx -------------------------------------------------------------------------------- /mycatDocs/history/Q&A.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/Q&A.docx -------------------------------------------------------------------------------- /mycatDocs/history/dev/Mycat命令行监控指南.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/dev/Mycat命令行监控指南.docx -------------------------------------------------------------------------------- /mycatDocs/history/dev/Mycat智能优化设计方案.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/dev/Mycat智能优化设计方案.doc -------------------------------------------------------------------------------- /mycatDocs/history/dev/mycat同步实现的设计.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/dev/mycat同步实现的设计.txt -------------------------------------------------------------------------------- /mycatDocs/history/dev/一亿组数据排序.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/dev/一亿组数据排序.docx -------------------------------------------------------------------------------- /mycatDocs/history/mycat+percona_cluster.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/mycat+percona_cluster.docx -------------------------------------------------------------------------------- /mycatDocs/history/mycat创建调用返回结果集的存储过程 (1).txt: -------------------------------------------------------------------------------- 1 | 2 | 1.在包含employee的分片上创建存储过程: 3 | /*!mycat: sql=select sharding_id from employee */ create procedure proc_rtn_list(in v_in int) begin select * from employee where sharding_id=v_in;end; 4 | 5 | 2.调用存储过程, 通过注解指定在哪个分片上执行: 6 | /*!mycat: sql=select sharding_id from employee where sharding_id=10000*/ call proc_rtn_list(10000); 7 | 8 | 3.出现问题: 9 | "[Err] 1312 - PROCEDURE db1.proc_rtn_list can't return a result set in the given context" 10 | 11 | 4.解决方案:修改代码 org.opencloudb.mysql.nio包内的MySQLConnection类, 取消第85行的注释. 12 | 13 | 5.遗留问题: 14 | 调用存储过程后, 客户端没有收到相应的报文, 导致一直处于等待状态, 而不是正常的显示"mysql> ", 求大侠抓包解决, 看下mysql直连情况下,返回的这个报文跟Mycat的有哪些不同, 解决这个问题 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /mycatDocs/history/mycat路由解析开发指南.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/mycat路由解析开发指南.docx -------------------------------------------------------------------------------- /mycatDocs/history/sequnce-sql.txt: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS MYCAT_SEQUENCE; 2 | CREATE TABLE MYCAT_SEQUENCE ( name VARCHAR(50) NOT NULL, current_value INT NOT NULL, increment INT NOT NULL DEFAULT 100, PRIMARY KEY (name) ) ENGINE=InnoDB; 3 | 4 | -- ---------------------------- 5 | -- Function structure for `mycat_seq_currval` 6 | -- ---------------------------- 7 | DROP FUNCTION IF EXISTS `mycat_seq_currval`; 8 | DELIMITER ;; 9 | CREATE DEFINER=`root`@`%` FUNCTION `mycat_seq_currval`(seq_name VARCHAR(50)) RETURNS varchar(64) CHARSET latin1 10 | DETERMINISTIC 11 | BEGIN 12 | DECLARE retval VARCHAR(64); 13 | SET retval="-999999999,null"; 14 | SELECT concat(CAST(current_value AS CHAR),",",CAST(increment AS CHAR) ) INTO retval FROM MYCAT_SEQUENCE WHERE name = seq_name; 15 | RETURN retval ; 16 | END 17 | ;; 18 | DELIMITER ; 19 | 20 | -- ---------------------------- 21 | -- Function structure for `mycat_seq_nextval` 22 | -- ---------------------------- 23 | DROP FUNCTION IF EXISTS `mycat_seq_nextval`; 24 | DELIMITER ;; 25 | CREATE DEFINER=`root`@`%` FUNCTION `mycat_seq_nextval`(seq_name VARCHAR(50)) RETURNS varchar(64) CHARSET latin1 26 | DETERMINISTIC 27 | BEGIN 28 | UPDATE MYCAT_SEQUENCE 29 | SET current_value = current_value + increment WHERE name = seq_name; 30 | RETURN mycat_seq_currval(seq_name); 31 | END 32 | ;; 33 | DELIMITER ; 34 | 35 | -- ---------------------------- 36 | -- Function structure for `mycat_seq_setval` 37 | -- ---------------------------- 38 | DROP FUNCTION IF EXISTS `mycat_seq_setval`; 39 | DELIMITER ;; 40 | CREATE DEFINER=`root`@`%` FUNCTION `mycat_seq_setval`(seq_name VARCHAR(50), value INTEGER) RETURNS varchar(64) CHARSET latin1 41 | DETERMINISTIC 42 | BEGIN 43 | UPDATE MYCAT_SEQUENCE 44 | SET current_value = value 45 | WHERE name = seq_name; 46 | RETURN mycat_seq_currval(seq_name); 47 | END 48 | ;; 49 | DELIMITER ; 50 | 51 | INSERT INTO MYCAT_SEQUENCE VALUES ('GLOBAL', 0, 100); 52 | SELECT MYCAT_SEQ_SETVAL('GLOBAL', 1); 53 | SELECT MYCAT_SEQ_CURRVAL('GLOBAL'); 54 | SELECT MYCAT_SEQ_NEXTVAL('GLOBAL'); 55 | 56 | 57 | -------------------------------------------------------------------------------- /mycatDocs/history/一亿组数据排序.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/一亿组数据排序.docx -------------------------------------------------------------------------------- /mycatDocs/history/案例集/从单租户改进到多租户模式的简单实现.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/history/案例集/从单租户改进到多租户模式的简单实现.docx -------------------------------------------------------------------------------- /mycatDocs/history/案例集/枚举分片容错性动态扩展.txt: -------------------------------------------------------------------------------- 1 | 枚举分片之前的《mycat字符串枚举分片示例.txt》中已经介绍过。 2 | 3 | 使用这种分片策略之后碰到了一个问题: 4 | 场景: 5 | 使用连锁店的店铺编号枚举分片(第1至第100分布店分在第一个分片,第101至第250分店),全国的连锁店会不断增加。在还没有来得及往配置文件中配置新的店铺编号时,新店铺的数据无法插入到mycat中(mycat会抛出异常can't find datanode for sharding column:SHOP_NO val:SHOP1002 ),而且店铺可能今天加一个新店,明天再加一个新店,难道维护人员每天来给你修改这个枚举店铺编号的配置文件? 6 | 7 | 8 | 解决办法: 9 | 不识别的枚举值,路由到一个默认的节点,这样,mycat将新店铺的数据全部插入到默认节点。当不识别的店铺编号达到一定的数量后,比如新增了1000个店铺后,新增一个数据节点,将默认节点上的那1000个店铺的数据整体迁移到新节点上。枚举分片的迁移非常容易,两个命令搞定: 10 | 1、默认节点的mysql服务器上执行导出:mysqldump -uroot -p123456 databasename shop --where=" shop_no in ('shop1001','shop1002'.....,'shop2000') " > /data/shop.sql 11 | 2、新节点的mysql服务器上执行导入:mysql -uroot -p123456 databasename < /data/shop.sql 12 | 13 | 14 | 修改的代码: 15 | 为了支持该方案,对org.opencloudb.route.function.PartitionByFileMap类做修改,增加一个属性defaultNode,如下: 16 | /** 17 | * 默认节点:小于0表示不设置默认节点,大于等于0表示设置默认节点 18 | * 19 | * 默认节点的作用:枚举分片时,如果碰到不识别的枚举值,就让它路由到默认节点 20 | * 如果不配置默认节点(defaultNode值小于0表示不配置默认节点),碰到 21 | * 不识别的枚举值就会报错, 22 | * like this:can't find datanode for sharding column:column_name val:ffffffff 23 | */ 24 | private int defaultNode = -1; 25 | 26 | defaultNode的默认值为-1表示不配置默认节点,如果要配置默认节点,需要从配置文件配置defaultNode的值,一般是从rule.xml中配置: 27 | 28 | partition-by-shop_no-enum.txt 29 | 1 30 | 0 31 | 32 | 33 | private void initialize() 方法根据defaultNode的值往map中增加defaultNode: 34 | //设置默认节点 35 | if(defaultNode >= 0) { 36 | app2Partition.put(DEFAULT_NODE, defaultNode); 37 | } 38 | 39 | public Integer calculate(String columnValue) 方法: 40 | Integer pid = app2Partition.get(value); 41 | if (pid != null) { 42 | rst = pid; 43 | } else { 44 | rst =app2Partition.get(DEFAULT_NODE); 45 | } 46 | return rst; 47 | 48 | 49 | -------------------------------------------------------------------------------- /mycatDocs/mycat.io-bill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/mycat.io-bill.png -------------------------------------------------------------------------------- /mycatDocs/mycat技术分享 .ppt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/mycat技术分享 .ppt -------------------------------------------------------------------------------- /mycatDocs/入门指南/Mongodb in Mycat指南.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/入门指南/Mongodb in Mycat指南.docx -------------------------------------------------------------------------------- /mycatDocs/入门指南/MyCat_In_Advanced.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/入门指南/MyCat_In_Advanced.doc -------------------------------------------------------------------------------- /mycatDocs/入门指南/MyCat_安装指南(linux).doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/入门指南/MyCat_安装指南(linux).doc -------------------------------------------------------------------------------- /mycatDocs/入门指南/MyCat专家系列之Mycat前世今生.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/入门指南/MyCat专家系列之Mycat前世今生.doc -------------------------------------------------------------------------------- /mycatDocs/入门指南/Mycat升级指南.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/入门指南/Mycat升级指南.docx -------------------------------------------------------------------------------- /mycatDocs/入门指南/Mycat命令行监控指南.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/入门指南/Mycat命令行监控指南.docx -------------------------------------------------------------------------------- /mycatDocs/入门指南/Mycat跨分片Join指南.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/入门指南/Mycat跨分片Join指南.docx -------------------------------------------------------------------------------- /mycatDocs/入门指南/mycat分片规则 .docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/入门指南/mycat分片规则 .docx -------------------------------------------------------------------------------- /mycatDocs/入门指南/mycat安装入门(两节点).md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/入门指南/mycat安装入门(两节点).md -------------------------------------------------------------------------------- /mycatDocs/入门指南/mycat安装入门(两节点).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/入门指南/mycat安装入门(两节点).pdf -------------------------------------------------------------------------------- /mycatDocs/入门指南/rehash guide for murmur and mod.md: -------------------------------------------------------------------------------- 1 | **一致性哈希分片与取余分片扩容指南** 2 | 3 | 假设有10个分片节点,1000万的数据量,主键从100万开始自增。下面是分别以一致性哈希和取余分片的结果 4 | 5 | - **一致性哈希分片** 6 | 7 | 执行PartitionByMurmurHash的main方法,按上述假设会得到以下结果 8 | index bucket ratio 9 | 0 1001836 0.1001836 10 | 1 1038892 0.1038892 11 | 2 927886 0.0927886 12 | 3 972728 0.0972728 13 | 4 1086100 0.10861 14 | 5 908616 0.0908616 15 | 6 1024269 0.1024269 16 | 7 1018029 0.1018029 17 | 8 995581 0.0995581 18 | 9 1026063 0.1026063 19 | 第一列是分片节点的编号,第二列是hash到每个节点的数据量,第三列是每个hash到每个节点的数据量与总数据量的比值。第三列的和是1.0,第十五列的和是10000000。 20 | 如果数据量相当少,会发现一致性哈希的分布不够均匀,而只要数据量在10000以上一致性哈希的分布比率就能保持在0.1左右,数据越多分布越均匀,每个节点的数据量越接近。 21 | 22 | 现在假设增加二个新节点,对0号节点执行rehash,会出现以下结果 23 | index bucket ratio 24 | 0 853804 0.8522392886660092 25 | 1 0 0.0 26 | 2 0 0.0 27 | 3 0 0.0 28 | 4 0 0.0 29 | 5 0 0.0 30 | 6 0 0.0 31 | 7 0 0.0 32 | 8 0 0.0 33 | 9 0 0.0 34 | 10 70075 0.06994657808264028 35 | 11 77957 0.07781413325135052 36 | 第一第二列的意义与上一组列表一样,第三列是hash到当前节点上的数据量与原0号节点总数据量的比值。 37 | 从以上列表可以看到,原0号节点有1001836数据,rehash之后大部分数据仍然hash到0号上面,少量数据hash到了10、11号两个新节点,其它旧节点没有得到原来0号上的数据。其实不管增加多少节点,数据的rehash结果都会呈现这个规律:已有节点的数据发生rehash时只有两个可能的去处,要么是rehash之前的节点,要么是新增加的节点,这也是**一致性哈希**的意义所在。 38 | 39 | 采用这种该片方式,可以保证数据在rehash时尽可能的少迁移数据。 40 | 41 | - **取余分片** 42 | 43 | 模仿一致性哈希的main方法实现一段取余分片的测试代码,初始节点数、数据量、id起始值、扩容数与前面一样,会得到以下结果 44 | index bucket ratio 45 | 0 1000000 0.1 46 | 1 1000000 0.1 47 | 2 1000000 0.1 48 | 3 1000000 0.1 49 | 4 1000000 0.1 50 | 5 1000000 0.1 51 | 6 1000000 0.1 52 | 7 1000000 0.1 53 | 8 1000000 0.1 54 | 9 1000000 0.1 55 | 0.9999999999999999 10000000 56 | **************************************************** 57 | 1000000 1000000 58 | index bucket ratio 59 | 0 166667 0.166667 60 | 1 0 0.0 61 | 2 166667 0.166667 62 | 3 0 0.0 63 | 4 166667 0.166667 64 | 5 0 0.0 65 | 6 166666 0.166666 66 | 7 0 0.0 67 | 8 166666 0.166666 68 | 9 0 0.0 69 | 10 166667 0.166667 70 | 11 0 0.0 71 | 72 | 星号行上面的内容是10个节点的哈希结果,星号行下面是0号节点rehash的结果,这个结果非常明显的显示出取余分片会均匀的把数据hash到每个节点,但是发生rehash时会把原节点中的数据再次平均分配,而且rehash结果会因为初始节点数和扩容节点数的不同而变化。 73 | 74 | 取余分片的rehash数据迁移量比一致性哈希的要大的多。在按原节点数的2倍扩容时取余迁移量最低,为总数据量的1/2。随着调整初始节点和扩容节点的奇偶性以及二者的倍数关系,会得到不同的结果。有兴趣的同学可以自行试验,此处不再赘述。 -------------------------------------------------------------------------------- /mycatDocs/入门指南/各数据库分页语法支持.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/入门指南/各数据库分页语法支持.docx -------------------------------------------------------------------------------- /mycatDocs/入门指南/字符集问题.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/入门指南/字符集问题.txt -------------------------------------------------------------------------------- /mycatDocs/入门指南/通配符配置指南.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/入门指南/通配符配置指南.docx -------------------------------------------------------------------------------- /mycatDocs/开发指南/Hibernate连接Mycat例子详解_正能量_20150507.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/开发指南/Hibernate连接Mycat例子详解_正能量_20150507.rar -------------------------------------------------------------------------------- /mycatDocs/开发指南/MySql常用命令总结.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/开发指南/MySql常用命令总结.txt -------------------------------------------------------------------------------- /mycatDocs/开发指南/Mycat_Develope_Guide.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/开发指南/Mycat_Develope_Guide.docx -------------------------------------------------------------------------------- /mycatDocs/开发指南/github个人使用笔记.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/开发指南/github个人使用笔记.doc -------------------------------------------------------------------------------- /mycatDocs/开发指南/mycat路由解析开发指南.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/开发指南/mycat路由解析开发指南.docx -------------------------------------------------------------------------------- /mycatDocs/怎样成为一名志愿者.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/怎样成为一名志愿者.docx -------------------------------------------------------------------------------- /mycatDocs/案例分享/mycat使用经验分享.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/案例分享/mycat使用经验分享.docx -------------------------------------------------------------------------------- /mycatDocs/案例分享/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/案例分享/readme.txt -------------------------------------------------------------------------------- /mycatDocs/测试案例与报告/DDAP-FPMA第二轮性能提升测试报告.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/测试案例与报告/DDAP-FPMA第二轮性能提升测试报告.docx -------------------------------------------------------------------------------- /mycatDocs/测试案例与报告/MyCAT性能损失率报告.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/测试案例与报告/MyCAT性能损失率报告.docx -------------------------------------------------------------------------------- /mycatDocs/测试案例与报告/MyCAT性能测试案例集.wps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/测试案例与报告/MyCAT性能测试案例集.wps -------------------------------------------------------------------------------- /mycatDocs/测试案例与报告/MyCat性能测试案例.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/测试案例与报告/MyCat性能测试案例.docx -------------------------------------------------------------------------------- /mycatDocs/测试案例与报告/MyCat测试报告(olap读测试).docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/测试案例与报告/MyCat测试报告(olap读测试).docx -------------------------------------------------------------------------------- /mycatDocs/测试案例与报告/MyCat测试报告(单机MyCAT对比多机MyCAT).docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/测试案例与报告/MyCat测试报告(单机MyCAT对比多机MyCAT).docx -------------------------------------------------------------------------------- /mycatDocs/测试案例与报告/MyCat测试报告(单机MySQL与通过MyCat分表后的对比情况).docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/测试案例与报告/MyCat测试报告(单机MySQL与通过MyCat分表后的对比情况).docx -------------------------------------------------------------------------------- /mycatDocs/测试案例与报告/Mycat 26亿单表分片案例及性能测试.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/测试案例与报告/Mycat 26亿单表分片案例及性能测试.docx -------------------------------------------------------------------------------- /mycatDocs/测试案例与报告/Mycat高级功能测试案例.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/测试案例与报告/Mycat高级功能测试案例.docx -------------------------------------------------------------------------------- /mycatDocs/测试案例与报告/SQL92标准语句Mycat支持测试_基于Oracle和MySQL_20150422.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/测试案例与报告/SQL92标准语句Mycat支持测试_基于Oracle和MySQL_20150422.docx -------------------------------------------------------------------------------- /mycatDocs/测试案例与报告/TPCC测试mycat测试报告.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/测试案例与报告/TPCC测试mycat测试报告.docx -------------------------------------------------------------------------------- /mycatDocs/测试案例与报告/mycat1.3性能测试案例.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/测试案例与报告/mycat1.3性能测试案例.docx -------------------------------------------------------------------------------- /mycatDocs/测试案例与报告/某公司测试报告.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/测试案例与报告/某公司测试报告.docx -------------------------------------------------------------------------------- /mycatDocs/生产部署/Lvs基本安装&脚本启动版/Lvs安装.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/生产部署/Lvs基本安装&脚本启动版/Lvs安装.docx -------------------------------------------------------------------------------- /mycatDocs/生产部署/Lvs基本安装&脚本启动版/lvs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | source /etc/profile 3 | 4 | VIP=10.47.7.77 5 | RIP1=10.47.7.211 6 | RIP2=10.47.7.212 7 | 8 | bond_name='bond0' 9 | key=8066 10 | 11 | /bin/chmod 755 /etc/rc.d/init.d/functions 12 | 13 | . /etc/rc.d/init.d/functions 14 | 15 | logger $0 called with $1 16 | case "$1" in 17 | start) 18 | echo " start LVS of DirectorServer" 19 | 20 | echo "1" > /proc/sys/net/ipv4/ip_forward 21 | 22 | sysctl -p > /dev/null 2>&1 23 | 24 | /sbin/ifconfig ${bond_name}:${key} $VIP broadcast $VIP netmask 255.255.255.255 up 25 | /sbin/route add -host $VIP dev ${bond_name}:${key} 26 | 27 | #Clear IPVS table 28 | /sbin/ipvsadm -C 29 | #set LVS 30 | /sbin/ipvsadm -A -t $VIP:8066 -s wrr 31 | /sbin/ipvsadm -a -t $VIP:8066 -r $RIP1 -g 32 | /sbin/ipvsadm -a -t $VIP:8066 -r $RIP2 -g 33 | 34 | /sbin/ipvsadm -A -t $VIP:9066 -s wrr 35 | /sbin/ipvsadm -a -t $VIP:9066 -r $RIP1 -g 36 | /sbin/ipvsadm -a -t $VIP:9066 -r $RIP2 -g 37 | 38 | #Run LVS 39 | /sbin/ipvsadm 40 | 41 | echo " start LVS of DirectorServer [OK]" 42 | ;; 43 | stop) 44 | echo "close LVS Directorserver" 45 | 46 | echo "0" > /proc/sys/net/ipv4/ip_forward 47 | 48 | /sbin/ipvsadm -C 49 | /sbin/ifconfig ${bond_name}:${key} down 50 | 51 | echo "close LVS Directorserver [OK]" 52 | ;; 53 | status) 54 | isLoOn=`/sbin/ifconfig ${bond_name}:${key} | grep "${VIP}"` 55 | isRoOn=`/bin/netstat -rn | grep "${VIP}"` 56 | if [ "$isLoOn" == "" -a "$isRoOn" == "" ]; then 57 | echo "LVS-DR has to run yet." 58 | else 59 | echo "LVS-DR is running." 60 | fi 61 | exit 3 62 | ;; 63 | *) 64 | 65 | echo "Usage: $0 {start|stop|status}" 66 | exit 1 67 | esac 68 | 69 | exit 0 -------------------------------------------------------------------------------- /mycatDocs/生产部署/Lvs基本安装&脚本启动版/lvs_realserver.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | source /etc/profile 3 | 4 | 5 | /bin/chmod 755 /etc/rc.d/init.d/functions 6 | 7 | . /etc/rc.d/init.d/functions 8 | 9 | 10 | VIP=10.47.7.77 11 | 12 | case "$1" in 13 | start) 14 | echo " start LVS of REALServer" 15 | /sbin/ifconfig lo:0 $VIP broadcast $VIP netmask 255.255.255.255 up 16 | /sbin/route add -host $VIP dev lo:0 17 | 18 | echo "1" >/proc/sys/net/ipv4/conf/lo/arp_ignore 19 | echo "2" >/proc/sys/net/ipv4/conf/lo/arp_announce 20 | echo "1" >/proc/sys/net/ipv4/conf/all/arp_ignore 21 | echo "2" >/proc/sys/net/ipv4/conf/all/arp_announce 22 | 23 | sysctl -p >/dev/null 2>&1 24 | echo " start LVS of REALServer [OK]" 25 | ;; 26 | stop) 27 | /sbin/ifconfig lo:0 down 28 | 29 | echo "close LVS Directorserver" 30 | echo "0" >/proc/sys/net/ipv4/conf/lo/arp_ignore 31 | echo "0" >/proc/sys/net/ipv4/conf/lo/arp_announce 32 | echo "0" >/proc/sys/net/ipv4/conf/all/arp_ignore 33 | echo "0" >/proc/sys/net/ipv4/conf/all/arp_announce 34 | echo "close LVS Directorserver [OK]" 35 | ;; 36 | *) 37 | 38 | echo "Usage: $0 {start|stop}" 39 | exit 1 40 | esac 41 | 42 | exit 0 43 | -------------------------------------------------------------------------------- /mycatDocs/生产部署/MHA-by 左越宗.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/生产部署/MHA-by 左越宗.md -------------------------------------------------------------------------------- /mycatDocs/生产部署/MyCat生产部署经验分享.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/生产部署/MyCat生产部署经验分享.docx -------------------------------------------------------------------------------- /mycatDocs/生产部署/Mycat主从与读写分离配置详解与示例_正能量_20150721.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/生产部署/Mycat主从与读写分离配置详解与示例_正能量_20150721.rar -------------------------------------------------------------------------------- /mycatDocs/生产部署/mycat实战笔记-1.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/生产部署/mycat实战笔记-1.doc -------------------------------------------------------------------------------- /mycatDocs/生产部署/集权对比.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/生产部署/集权对比.md -------------------------------------------------------------------------------- /mycatDocs/生产部署/集群比对+haproxy.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/生产部署/集群比对+haproxy.doc -------------------------------------------------------------------------------- /mycatDocs/研究资料/mysql-xa.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/研究资料/mysql-xa.txt -------------------------------------------------------------------------------- /mycatDocs/设计文档/1.5/Mycat Architecture.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/设计文档/1.5/Mycat Architecture.docx -------------------------------------------------------------------------------- /mycatDocs/设计文档/1.5/Mycat AutoOperation.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/设计文档/1.5/Mycat AutoOperation.docx -------------------------------------------------------------------------------- /mycatDocs/设计文档/1.5/Mycat AutoScale.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/设计文档/1.5/Mycat AutoScale.docx -------------------------------------------------------------------------------- /mycatDocs/设计文档/1.5/Mycat HAProxy.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/设计文档/1.5/Mycat HAProxy.docx -------------------------------------------------------------------------------- /mycatDocs/设计文档/1.5/Mycat HBTEngine.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/设计文档/1.5/Mycat HBTEngine.docx -------------------------------------------------------------------------------- /mycatDocs/设计文档/1.5/Mycat ZK.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/设计文档/1.5/Mycat ZK.docx -------------------------------------------------------------------------------- /mycatDocs/设计文档/1.5/Mycat智能优化设计方案.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/设计文档/1.5/Mycat智能优化设计方案.doc -------------------------------------------------------------------------------- /mycatDocs/设计文档/2.0/Mycat ZK配置文件详解.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/设计文档/2.0/Mycat ZK配置文件详解.docx -------------------------------------------------------------------------------- /mycatDocs/设计文档/2.0/resource/cat1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/设计文档/2.0/resource/cat1.png -------------------------------------------------------------------------------- /mycatDocs/设计文档/2.0/resource/cat2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/设计文档/2.0/resource/cat2.png -------------------------------------------------------------------------------- /mycatDocs/设计文档/2.0/resource/cat3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/设计文档/2.0/resource/cat3.png -------------------------------------------------------------------------------- /mycatDocs/设计文档/2.0/resource/cat4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/设计文档/2.0/resource/cat4.png -------------------------------------------------------------------------------- /mycatDocs/设计文档/2.0/resource/cat5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/设计文档/2.0/resource/cat5.png -------------------------------------------------------------------------------- /mycatDocs/设计文档/2.0/全局表一致性检测和SQL拦截改写的实现.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/设计文档/2.0/全局表一致性检测和SQL拦截改写的实现.docx -------------------------------------------------------------------------------- /mycatDocs/设计文档/MyCAT人工智能解决跨分片SQL.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/设计文档/MyCAT人工智能解决跨分片SQL.docx -------------------------------------------------------------------------------- /mycatDocs/设计文档/Mycat-cluster设计简析.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/设计文档/Mycat-cluster设计简析.docx -------------------------------------------------------------------------------- /mycatDocs/设计文档/Mycat一致性哈希分片算法.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/设计文档/Mycat一致性哈希分片算法.docx -------------------------------------------------------------------------------- /mycatDocs/设计文档/Mycat事务补偿设计文档(讨论稿).docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/设计文档/Mycat事务补偿设计文档(讨论稿).docx -------------------------------------------------------------------------------- /mycatDocs/设计文档/Mycat智能优化设计方案.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/设计文档/Mycat智能优化设计方案.doc -------------------------------------------------------------------------------- /mycatDocs/设计文档/Mycat运行时序图.vsd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/设计文档/Mycat运行时序图.vsd -------------------------------------------------------------------------------- /mycatDocs/设计文档/NIO的陷阱.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/设计文档/NIO的陷阱.docx -------------------------------------------------------------------------------- /mycatDocs/设计文档/Select的where条件解析增加Between解析说明.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/设计文档/Select的where条件解析增加Between解析说明.docx -------------------------------------------------------------------------------- /mycatDocs/设计文档/mycat创建调用返回结果集的存储过程 (1).txt: -------------------------------------------------------------------------------- 1 | 2 | 1.在包含employee的分片上创建存储过程: 3 | /*!mycat: sql=select sharding_id from employee */ create procedure proc_rtn_list(in v_in int) begin select * from employee where sharding_id=v_in;end; 4 | 5 | 2.调用存储过程, 通过注解指定在哪个分片上执行: 6 | /*!mycat: sql=select sharding_id from employee where sharding_id=10000*/ call proc_rtn_list(10000); 7 | 8 | 3.出现问题: 9 | "[Err] 1312 - PROCEDURE db1.proc_rtn_list can't return a result set in the given context" 10 | 11 | 4.解决方案:修改代码 org.opencloudb.mysql.nio包内的MySQLConnection类, 取消第85行的注释. 12 | 13 | 5.遗留问题: 14 | 调用存储过程后, 客户端没有收到相应的报文, 导致一直处于等待状态, 而不是正常的显示"mysql> ", 求大侠抓包解决, 看下mysql直连情况下,返回的这个报文跟Mycat的有哪些不同, 解决这个问题 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /mycatDocs/设计文档/mycat同步实现的设计.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/设计文档/mycat同步实现的设计.txt -------------------------------------------------------------------------------- /mycatDocs/设计文档/一亿组数据排序.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/设计文档/一亿组数据排序.docx -------------------------------------------------------------------------------- /mycatDocs/设计文档/从单租户改进到多租户模式的简单实现.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/设计文档/从单租户改进到多租户模式的简单实现.docx -------------------------------------------------------------------------------- /mycatDocs/设计文档/枚举分片容错性动态扩展.txt: -------------------------------------------------------------------------------- 1 | 枚举分片之前的《mycat字符串枚举分片示例.txt》中已经介绍过。 2 | 3 | 使用这种分片策略之后碰到了一个问题: 4 | 场景: 5 | 使用连锁店的店铺编号枚举分片(第1至第100分布店分在第一个分片,第101至第250分店),全国的连锁店会不断增加。在还没有来得及往配置文件中配置新的店铺编号时,新店铺的数据无法插入到mycat中(mycat会抛出异常can't find datanode for sharding column:SHOP_NO val:SHOP1002 ),而且店铺可能今天加一个新店,明天再加一个新店,难道维护人员每天来给你修改这个枚举店铺编号的配置文件? 6 | 7 | 8 | 解决办法: 9 | 不识别的枚举值,路由到一个默认的节点,这样,mycat将新店铺的数据全部插入到默认节点。当不识别的店铺编号达到一定的数量后,比如新增了1000个店铺后,新增一个数据节点,将默认节点上的那1000个店铺的数据整体迁移到新节点上。枚举分片的迁移非常容易,两个命令搞定: 10 | 1、默认节点的mysql服务器上执行导出:mysqldump -uroot -p123456 databasename shop --where=" shop_no in ('shop1001','shop1002'.....,'shop2000') " > /data/shop.sql 11 | 2、新节点的mysql服务器上执行导入:mysql -uroot -p123456 databasename < /data/shop.sql 12 | 13 | 14 | 修改的代码: 15 | 为了支持该方案,对org.opencloudb.route.function.PartitionByFileMap类做修改,增加一个属性defaultNode,如下: 16 | /** 17 | * 默认节点:小于0表示不设置默认节点,大于等于0表示设置默认节点 18 | * 19 | * 默认节点的作用:枚举分片时,如果碰到不识别的枚举值,就让它路由到默认节点 20 | * 如果不配置默认节点(defaultNode值小于0表示不配置默认节点),碰到 21 | * 不识别的枚举值就会报错, 22 | * like this:can't find datanode for sharding column:column_name val:ffffffff 23 | */ 24 | private int defaultNode = -1; 25 | 26 | defaultNode的默认值为-1表示不配置默认节点,如果要配置默认节点,需要从配置文件配置defaultNode的值,一般是从rule.xml中配置: 27 | 28 | partition-by-shop_no-enum.txt 29 | 1 30 | 0 31 | 32 | 33 | private void initialize() 方法根据defaultNode的值往map中增加defaultNode: 34 | //设置默认节点 35 | if(defaultNode >= 0) { 36 | app2Partition.put(DEFAULT_NODE, defaultNode); 37 | } 38 | 39 | public Integer calculate(String columnValue) 方法: 40 | Integer pid = app2Partition.get(value); 41 | if (pid != null) { 42 | rst = pid; 43 | } else { 44 | rst =app2Partition.get(DEFAULT_NODE); 45 | } 46 | return rst; 47 | 48 | 49 | -------------------------------------------------------------------------------- /mycatDocs/进阶文档/Haproxy+Mycat集群搭建指南.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/进阶文档/Haproxy+Mycat集群搭建指南.docx -------------------------------------------------------------------------------- /mycatDocs/进阶文档/MyCat主键自增字段开启.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/进阶文档/MyCat主键自增字段开启.docx -------------------------------------------------------------------------------- /mycatDocs/进阶文档/Mycat-Balance使用指南.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/进阶文档/Mycat-Balance使用指南.docx -------------------------------------------------------------------------------- /mycatDocs/进阶文档/Mycat性能测试指南.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/进阶文档/Mycat性能测试指南.docx -------------------------------------------------------------------------------- /mycatDocs/进阶文档/Mycat性能调优指南.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/进阶文档/Mycat性能调优指南.docx -------------------------------------------------------------------------------- /mycatDocs/进阶文档/Mycat最权威DBCP使用手册.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/进阶文档/Mycat最权威DBCP使用手册.docx -------------------------------------------------------------------------------- /mycatDocs/进阶文档/Mycat最权威Mysql主从配置手册.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/进阶文档/Mycat最权威Mysql主从配置手册.docx -------------------------------------------------------------------------------- /mycatDocs/进阶文档/Mycat路由新解析器选型分析与结果.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/进阶文档/Mycat路由新解析器选型分析与结果.docx -------------------------------------------------------------------------------- /mycatDocs/进阶文档/loadData批量导入以及压缩协议使用指南.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/进阶文档/loadData批量导入以及压缩协议使用指南.docx -------------------------------------------------------------------------------- /mycatDocs/进阶文档/mycat xa特性.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/进阶文档/mycat xa特性.txt -------------------------------------------------------------------------------- /mycatDocs/进阶文档/mycat+percona_cluster.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/进阶文档/mycat+percona_cluster.docx -------------------------------------------------------------------------------- /mycatDocs/进阶文档/mycat读写分离模式智能优化方案.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mycatDocs/进阶文档/mycat读写分离模式智能优化方案.docx -------------------------------------------------------------------------------- /mysqlTools/mysql_rotate_slowlog.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ############################################### 3 | ## Function: rotate slow_log ,interval everyday 4 | ## Created by xiean@2016-05-09 xiepaup@163.com 5 | ## Version : 1.2.2 6 | ## 10 0 * * * /bin/bash /root/xa/rotate_slow_log.sh 3306 >> /data/dbbak/ops_mysql.log 2>&1 7 | ############################################### 8 | 9 | USER="dbbackup" 10 | PWD="dbbackup" 11 | DATE="`date "+%F"`" 12 | DEL_DATE="`date "+%F" -d '12 days ago'`" 13 | MYSQL="/usr/local/mysql/bin/mysql" 14 | 15 | rotate_log(){ 16 | ${MYSQL} -u${USER} -p${PWD} -S /data/mysql/${port}/mysql.sock information_schema -sss < ',@new_slow_log_file); 24 | EOF 25 | if [ $? -eq 0 ]; then 26 | echo "`date "+%F %T"` : Switch Log File Success !" 27 | else 28 | echo "`date "+%F %T"` : Switch Log File Falied !" 29 | exit -100 30 | fi 31 | } 32 | 33 | 34 | remove_log(){ 35 | _FILE_DEL_="/data/mysql/${port}/mysql_slow_${DEL_DATE}.log" 36 | echo "`date "+%F %T"` : Execute command : rm -f ${_FILE_DEL_}" 37 | rm -f /data/mysql/${port}/mysql_slow_${DEL_DATE}.log >/dev/null 2>&1 38 | if [ $? -eq 0 ]; then 39 | echo "`date "+%F %T"` : Remove File[${_FILE_DEL_}] Success !" 40 | else 41 | echo "`date "+%F %T"` : Remove File[${_FILE_DEL_}] Failed !" 42 | fi 43 | } 44 | 45 | export port=$1 46 | rotate_log 47 | remove_log 48 | -------------------------------------------------------------------------------- /mysqlTools/mysql_status.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mysqladmin -P3306 -uroot -prootpwd -h127.0.0.1 -r -i 1 ext |\ 4 | awk -F"|" \ 5 | "BEGIN{ count=0; }"\ 6 | '{ if($2 ~ /Variable_name/ && ((++count)%20 == 1)){\ 7 | print "----------|---------|--- MySQL Command Status --|----- Innodb row operation ----|-- Buffer Pool Read --";\ 8 | print "---Time---|---QPS---|select insert update delete| read inserted updated deleted| logical physical";\ 9 | }\ 10 | else if ($2 ~ /Queries/){queries=$3;}\ 11 | else if ($2 ~ /Com_select /){com_select=$3;}\ 12 | else if ($2 ~ /Com_insert /){com_insert=$3;}\ 13 | else if ($2 ~ /Com_update /){com_update=$3;}\ 14 | else if ($2 ~ /Com_delete /){com_delete=$3;}\ 15 | else if ($2 ~ /Innodb_rows_read/){innodb_rows_read=$3;}\ 16 | else if ($2 ~ /Innodb_rows_deleted/){innodb_rows_deleted=$3;}\ 17 | else if ($2 ~ /Innodb_rows_inserted/){innodb_rows_inserted=$3;}\ 18 | else if ($2 ~ /Innodb_rows_updated/){innodb_rows_updated=$3;}\ 19 | else if ($2 ~ /Innodb_buffer_pool_read_requests/){innodb_lor=$3;}\ 20 | else if ($2 ~ /Innodb_buffer_pool_reads/){innodb_phr=$3;}\ 21 | else if ($2 ~ /Uptime / && count >= 2){\ 22 | printf(" %s |%9d",strftime("%H:%M:%S"),queries);\ 23 | printf("|%6d %6d %6d %6d",com_select,com_insert,com_update,com_delete);\ 24 | printf("|%6d %8d %7d %7d",innodb_rows_read,innodb_rows_inserted,innodb_rows_updated,innodb_rows_deleted);\ 25 | printf("|%10d %11d\n",innodb_lor,innodb_phr);\ 26 | }}' 27 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include *.txt 2 | recursive-include unit_tests *.py 3 | recursive-include doc *.py *.rst 4 | include info.py -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/bs4/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mysqlTools/mysql_utilities/bs4/__init__.pyc -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/bs4/builder/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mysqlTools/mysql_utilities/bs4/builder/__init__.pyc -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/bs4/builder/_html5lib.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mysqlTools/mysql_utilities/bs4/builder/_html5lib.pyc -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/bs4/builder/_htmlparser.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mysqlTools/mysql_utilities/bs4/builder/_htmlparser.pyc -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/bs4/builder/_lxml.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mysqlTools/mysql_utilities/bs4/builder/_lxml.pyc -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/bs4/dammit.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mysqlTools/mysql_utilities/bs4/dammit.pyc -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/bs4/element.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mysqlTools/mysql_utilities/bs4/element.pyc -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/bs4/tests/__init__.py: -------------------------------------------------------------------------------- 1 | "The beautifulsoup tests." 2 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/bs4/tests/test_docs.py: -------------------------------------------------------------------------------- 1 | "Test harness for doctests." 2 | 3 | # pylint: disable-msg=E0611,W0142 4 | 5 | __metaclass__ = type 6 | __all__ = [ 7 | 'additional_tests', 8 | ] 9 | 10 | import atexit 11 | import doctest 12 | import os 13 | from pkg_resources import ( 14 | resource_filename, resource_exists, resource_listdir, cleanup_resources) 15 | import unittest 16 | 17 | DOCTEST_FLAGS = ( 18 | doctest.ELLIPSIS | 19 | doctest.NORMALIZE_WHITESPACE | 20 | doctest.REPORT_NDIFF) 21 | 22 | 23 | # def additional_tests(): 24 | # "Run the doc tests (README.txt and docs/*, if any exist)" 25 | # doctest_files = [ 26 | # os.path.abspath(resource_filename('bs4', 'README.txt'))] 27 | # if resource_exists('bs4', 'docs'): 28 | # for name in resource_listdir('bs4', 'docs'): 29 | # if name.endswith('.txt'): 30 | # doctest_files.append( 31 | # os.path.abspath( 32 | # resource_filename('bs4', 'docs/%s' % name))) 33 | # kwargs = dict(module_relative=False, optionflags=DOCTEST_FLAGS) 34 | # atexit.register(cleanup_resources) 35 | # return unittest.TestSuite(( 36 | # doctest.DocFileSuite(*doctest_files, **kwargs))) 37 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/bs4/tests/test_html5lib.py: -------------------------------------------------------------------------------- 1 | """Tests to ensure that the html5lib tree builder generates good trees.""" 2 | 3 | import warnings 4 | 5 | try: 6 | from bs4.builder import HTML5TreeBuilder 7 | HTML5LIB_PRESENT = True 8 | except ImportError, e: 9 | HTML5LIB_PRESENT = False 10 | from bs4.element import SoupStrainer 11 | from bs4.testing import ( 12 | HTML5TreeBuilderSmokeTest, 13 | SoupTest, 14 | skipIf, 15 | ) 16 | 17 | @skipIf( 18 | not HTML5LIB_PRESENT, 19 | "html5lib seems not to be present, not testing its tree builder.") 20 | class HTML5LibBuilderSmokeTest(SoupTest, HTML5TreeBuilderSmokeTest): 21 | """See ``HTML5TreeBuilderSmokeTest``.""" 22 | 23 | @property 24 | def default_builder(self): 25 | return HTML5TreeBuilder() 26 | 27 | def test_soupstrainer(self): 28 | # The html5lib tree builder does not support SoupStrainers. 29 | strainer = SoupStrainer("b") 30 | markup = "

A bold statement.

" 31 | with warnings.catch_warnings(record=True) as w: 32 | soup = self.soup(markup, parse_only=strainer) 33 | self.assertEqual( 34 | soup.decode(), self.document_for(markup)) 35 | 36 | self.assertTrue( 37 | "the html5lib tree builder doesn't support parse_only" in 38 | str(w[0].message)) 39 | 40 | def test_correctly_nested_tables(self): 41 | """html5lib inserts tags where other parsers don't.""" 42 | markup = ('' 43 | '' 44 | "') 48 | 49 | self.assertSoupEquals( 50 | markup, 51 | '
Here's another table:" 45 | '' 46 | '' 47 | '
foo
Here\'s another table:' 52 | '
foo
' 53 | '
') 54 | 55 | self.assertSoupEquals( 56 | "" 57 | "" 58 | "
Foo
Bar
Baz
") 59 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/bs4/tests/test_htmlparser.py: -------------------------------------------------------------------------------- 1 | """Tests to ensure that the html.parser tree builder generates good 2 | trees.""" 3 | 4 | from bs4.testing import SoupTest, HTMLTreeBuilderSmokeTest 5 | from bs4.builder import HTMLParserTreeBuilder 6 | 7 | class HTMLParserTreeBuilderSmokeTest(SoupTest, HTMLTreeBuilderSmokeTest): 8 | 9 | @property 10 | def default_builder(self): 11 | return HTMLParserTreeBuilder() 12 | 13 | def test_namespaced_system_doctype(self): 14 | # html.parser can't handle namespaced doctypes, so skip this one. 15 | pass 16 | 17 | def test_namespaced_public_doctype(self): 18 | # html.parser can't handle namespaced doctypes, so skip this one. 19 | pass 20 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/check.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; version 2 of the License. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 16 | # 17 | import glob 18 | import os.path 19 | import sys 20 | import unittest 21 | 22 | if __name__ == '__main__': 23 | suite = unittest.TestSuite() 24 | for fname in glob.glob("unit_tests/test*.py"): 25 | base, ext = os.path.splitext(fname) 26 | name = '.'.join(base.split('/')) 27 | suite.addTest(unittest.defaultTestLoader.loadTestsFromName(name)) 28 | result = unittest.TextTestRunner(verbosity=2).run(suite) 29 | if not result.wasSuccessful(): 30 | sys.exit(1) # Results are printed above 31 | 32 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/doc/changes.rst: -------------------------------------------------------------------------------- 1 | :tocdepth: 2 2 | 3 | .. _changes: 4 | 5 | Changes in MySQL Utilities 6 | ************************** 7 | 8 | .. include:: ../CHANGES.txt 9 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/doc/command/grep.rst: -------------------------------------------------------------------------------- 1 | #################################################################### 2 | :mod:`mysql.utilities.command.grep` --- Search Databases for Objects 3 | #################################################################### 4 | 5 | .. module:: mysql.utilities.command.grep 6 | 7 | This module provides utilities to search for objects on a server. The module 8 | defines a set of *object types* that can be searched by searching the 9 | *fields* of each object. The notion of an object field is 10 | very loosely defined and means any names occurring as part of the 11 | object definition. For example, the fields of a table include the table 12 | name, the column names, and the partition names (if it is a partitioned 13 | table). 14 | 15 | 16 | Constants 17 | --------- 18 | 19 | The following constants denote the object types that can be searched. 20 | 21 | .. data:: ROUTINE 22 | EVENT 23 | TRIGGER 24 | TABLE 25 | DATABASE 26 | VIEW 27 | USER 28 | 29 | The following constant is a sequence of all the object types that are 30 | available. It can be used to generate a version-independent list of object 31 | types that can be searched; for example, options and help texts. 32 | 33 | .. data:: OBJECT_TYPES 34 | 35 | Classes 36 | ------- 37 | 38 | .. class:: ObjectGrep(pattern[, database_pattern=None, types=OBJECT_TYPES, check_body=False, use_regexp=False]) 39 | 40 | Search MySQL server instances for objects where the name (or content, for 41 | routines, triggers, or events) matches a given pattern. 42 | 43 | .. method:: sql() -> string 44 | 45 | Return the SQL code for executing the search in the form of a 46 | `SELECT`_ statement. 47 | 48 | :returns: SQL code for executing the operation specified by the 49 | options. 50 | :rtype: string 51 | 52 | .. method:: execute(connections[, output=sys.output, connector=mysql.connector]) 53 | 54 | Execute the search on each of the connections in turn and print an 55 | aggregate of the result as a grid table. 56 | 57 | :param connections: Sequence of connection specifiers to send the query to 58 | :param output: File object to use for writing the result 59 | :param connector: Connector to use for connecting to the servers 60 | 61 | 62 | .. References 63 | .. ---------- 64 | .. _`SELECT`: http://dev.mysql.com/doc/mysql/en/select.html 65 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/doc/command/index.rst: -------------------------------------------------------------------------------- 1 | .. _command-index: 2 | 3 | ############### 4 | Command Package 5 | ############### 6 | 7 | .. toctree:: 8 | :maxdepth: 2 9 | 10 | grep 11 | proc 12 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/doc/index.rst: -------------------------------------------------------------------------------- 1 | .. MySQL Utilities documentation master file, created by 2 | sphinx-quickstart on Thu Oct 14 14:45:08 2010. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | MySQL Utilities Documentation 7 | =============================== 8 | 9 | MySQL Utilities is both a set of command-line utilities as well as a 10 | Python library for making the common tasks easy to accomplish. The 11 | library is written entirely in Python, meaning that it is not 12 | necessary to have any other tools or libraries installed to make it 13 | work. It is currently designed to work with Python v2.6 or later and 14 | there is no support (yet) for Python v3.1. 15 | 16 | Contents: 17 | 18 | .. toctree:: 19 | :maxdepth: 2 20 | 21 | intro/index 22 | command/index 23 | parser/index 24 | man/index 25 | changes 26 | 27 | Indices and tables 28 | ================== 29 | 30 | * :ref:`genindex` 31 | * :ref:`modindex` 32 | * :ref:`search` 33 | 34 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/doc/intro/connspec.rst: -------------------------------------------------------------------------------- 1 | .. `connection specification` 2 | 3 | Connection Parameters 4 | ===================== 5 | 6 | To connect to a server, it is necessary to specify connection 7 | parameters such as user name, host name, password, and perhaps also port or 8 | socket. 9 | 10 | Whenever connection parameters are required, they can be specified 11 | three different ways: 12 | 13 | - As a dictionary containing the connection parameters. 14 | 15 | - As a connection specification string containing the connection 16 | parameters. 17 | 18 | - As a Server instance. 19 | 20 | When providing the connection parameters as a dictionary, the 21 | parameters are passed unchanged to the connector's ``connect`` 22 | function. This enables you to pass parameters not supported through 23 | the other interfaces, but at least these parameters are supported: 24 | 25 | _`user` 26 | The name of the user to connect as. The default if no user is supplied 27 | is login name of the user, as returned by `getpass.getuser`_. 28 | 29 | _`passwd` 30 | The password to use when connecting. The default if no password is supplied 31 | is the empty password. 32 | 33 | _`host` 34 | The domain name of the host or the IP address. The default iIf no host name 35 | is provided is 'localhost'. This field accepts host names, and IPv4 and IPv6 36 | addresses. It also accepts quoted values which are not validated and passed 37 | directly to the calling methods. This enables users to specify host names and 38 | IP addresses that are outside of the supported validation mechanisms. 39 | 40 | 41 | _`port` 42 | The port to use when connecting to the server. The default if no port is 43 | supplied is 3306 (which is the default port for the MySQL server as well). 44 | 45 | _`unix_socket` 46 | The socket to connect to (instead of using the host_ and port_ parameters). 47 | 48 | .. _`connection specification`: 49 | 50 | Providing the connection parameters as a string requires the string to 51 | have the format ``user[:passwd]@host[:port][:socket]``, where some values 52 | are optional. If a connection specification string is provided, it 53 | is parsed using the options.parse_connection function. 54 | 55 | .. _`getpass.getuser`: http://docs.python.org/library/getpass.html#getpass.getuser 56 | 57 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/doc/intro/index.rst: -------------------------------------------------------------------------------- 1 | 2 | ############################### 3 | Introduction 4 | ############################### 5 | 6 | .. toctree:: 7 | 8 | intro 9 | developers 10 | connspec 11 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/doc/intro/intro.rst: -------------------------------------------------------------------------------- 1 | .. _`intro`: 2 | 3 | ############################### 4 | Introduction to MySQL Utilities 5 | ############################### 6 | 7 | What are the MySQL Utilities? 8 | ----------------------------- 9 | 10 | It is a package of utilities that are used for maintenance and 11 | administration of MySQL servers. These utilities encapsulate a set of 12 | primitive commands, and bundles them so they can be used to perform 13 | macro operations with a single command. They can be installed via 14 | MySQL Workbench, or as a standalone package. 15 | 16 | The utilities are written in Python, available under the GPLv2 license, 17 | and are extendable using the supplied library. 18 | 19 | How do we access the MySQL Utilities? 20 | ------------------------------------- 21 | 22 | There are two ways to access the utilities from within the MySQL 23 | Workbench. Either use ``Plugins`` -> ``Start Shell for MySQL Utilities`` 24 | from the main Workbench toolbar, or click the MySQL Utilities icon from 25 | the main Workbench page. Both methods will open a terminal/shell 26 | window, and list the available commands. 27 | 28 | You can launch any of the utilities listed by typing the name of the 29 | command. To find out what options are available, use the `--help` option, 30 | or read the appropriate manual page. 31 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/doc/man/index.rst: -------------------------------------------------------------------------------- 1 | 2 | ###################### 3 | Command-Line Utilities 4 | ###################### 5 | 6 | .. toctree:: 7 | 8 | overview 9 | mysqldbcompare 10 | mysqldbcopy 11 | mysqldbimport 12 | mysqldbexport 13 | mysqldiff 14 | mysqldiskusage 15 | mysqlfailover 16 | mysqlindexcheck 17 | mysqlmetagrep 18 | mysqlprocgrep 19 | mysqlreplicate 20 | mysqlrpladmin 21 | mysqlrplcheck 22 | mysqlrplshow 23 | mysqlserverclone 24 | mysqlserverinfo 25 | mysqluserclone 26 | mut 27 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/doc/parser/index.rst: -------------------------------------------------------------------------------- 1 | .. _parser-index: 2 | 3 | ############# 4 | Parser Module 5 | ############# 6 | 7 | .. toctree:: 8 | :maxdepth: 2 9 | 10 | parser 11 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/freeze.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # 3 | # Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; version 2 of the License. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | # 18 | 19 | import sys 20 | 21 | from info import META_INFO, INSTALL, COMMANDS 22 | 23 | from cx_Freeze import setup # Setup function to use 24 | 25 | if sys.platform.startswith("win32"): 26 | META_INFO['name'] = 'MySQL Utilities' 27 | 28 | ARGS = { 29 | 'executable': [ 30 | cx_Freeze.Executable(exe, base="Console") for exe in INSTALL['scripts'] 31 | ], 32 | 'options': { 33 | 'bdist_msi': { 'add_to_path': True, }, 34 | } 35 | } 36 | 37 | ARGS.update(META_INFO) 38 | ARGS.update(INSTALL) 39 | ARGS.update(COMMANDS) 40 | setup(**ARGS) 41 | 42 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/info.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mysqlTools/mysql_utilities/info.pyc -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/disabled: -------------------------------------------------------------------------------- 1 | # 2 | # Use this file to disable tests for non-deterministic or other reasons that keep the 3 | # test from passing on all platforms. 4 | # 5 | # Include the following information (CSV): 6 | # suite.test, reason 7 | # main.example, This is a test (bug#xxxxx) 8 | # 9 | main.copy_db_multithreaded, Does not run on all platforms. Need to move to an optional performance suite. 10 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/mutlib/__init__.py: -------------------------------------------------------------------------------- 1 | from mutlib import System_test 2 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/r/check_index_best_worst_large.result: -------------------------------------------------------------------------------- 1 | Test case 1 - show best indexes 2 | # Source on localhost: ... connected. 3 | # Checking indexes... 4 | # Getting indexes for employees.dept_emp 5 | # The following indexes are duplicates or redundant for table employees.dept_emp: 6 | # 7 | CREATE INDEX emp_no ON employees.dept_emp (emp_no) USING BTREE 8 | # may be redundant or duplicate of: 9 | ALTER TABLE employees.dept_emp ADD PRIMARY KEY (emp_no, dept_no) 10 | # 11 | # Showing the top best performing indexes from employees.dept_emp: 12 | # 13 | database,table,name,column,sequence,num columns,cardinality,est. rows,percent 14 | employees,dept_emp,emp_no,emp_no,1,1,NNNNNNN,NNNNNNN,NNNNNNN 15 | employees,dept_emp,dept_no,dept_no,1,1,NNNNNNN,NNNNNNN,NNNNNNN 16 | # 17 | # ...done. 18 | Test case 2 - show worst indexes 19 | # Source on localhost: ... connected. 20 | # Checking indexes... 21 | # Getting indexes for employees.dept_emp 22 | # The following indexes are duplicates or redundant for table employees.dept_emp: 23 | # 24 | CREATE INDEX emp_no ON employees.dept_emp (emp_no) USING BTREE 25 | # may be redundant or duplicate of: 26 | ALTER TABLE employees.dept_emp ADD PRIMARY KEY (emp_no, dept_no) 27 | # 28 | # Showing the top worst performing indexes from employees.dept_emp: 29 | # 30 | database,table,name,column,sequence,num columns,cardinality,est. rows,percent 31 | employees,dept_emp,dept_no,dept_no,1,1,NNNNNNN,NNNNNNN,NNNNNNN 32 | employees,dept_emp,emp_no,emp_no,1,1,NNNNNNN,NNNNNNN,NNNNNNN 33 | # 34 | # ...done. 35 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/r/check_index_best_worst_small.result: -------------------------------------------------------------------------------- 1 | Test case 1 - show best indexes on small database 2 | # Getting indexes for util_test_a.t1 3 | # The following indexes are duplicates or redundant for table util_test_a.t1: 4 | # 5 | CREATE INDEX s4 ON util_test_a.t1 (d(32)) 6 | # may be redundant or duplicate of: 7 | CREATE INDEX s2 ON util_test_a.t1 (d(32)) 8 | # 9 | CREATE INDEX s2 ON util_test_a.t1 (d(32)) 10 | # may be redundant or duplicate of: 11 | CREATE INDEX s4 ON util_test_a.t1 (d(32)) 12 | # Getting indexes for util_test_a.t2 13 | # Table util_test_a.t2 has no duplicate indexes. 14 | Test case 2 - show worst indexes on small database 15 | # Getting indexes for util_test_a.t1 16 | # The following indexes are duplicates or redundant for table util_test_a.t1: 17 | # 18 | CREATE INDEX s4 ON util_test_a.t1 (d(32)) 19 | # may be redundant or duplicate of: 20 | CREATE INDEX s2 ON util_test_a.t1 (d(32)) 21 | # 22 | CREATE INDEX s2 ON util_test_a.t1 (d(32)) 23 | # may be redundant or duplicate of: 24 | CREATE INDEX s4 ON util_test_a.t1 (d(32)) 25 | # Getting indexes for util_test_a.t2 26 | # Table util_test_a.t2 has no duplicate indexes. 27 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/r/check_index_errors.result: -------------------------------------------------------------------------------- 1 | Test case 1 - error: no db specified 2 | Usage: mysqlindexcheck.py --server=user:pass@host:port:socket db1.table1 db2 db3.table2 3 | 4 | mysqlindexcheck.py: error: You must specify at least one table or database to check. 5 | Test case 2 - error: invalid source specified 6 | # Source on nohost: ... ERROR: Cannot connect to the Source server. 7 | Error XXXX: Access denied 8 | Test case 3 - error: invalid login to server 9 | # Source on localhost: ... ERROR: Cannot connect to the Source server. 10 | Error XXXX: Access denied 11 | Test case 4 - error: stats and best=alpha 12 | Usage: mysqlindexcheck.py --server=user:pass@host:port:socket db1.table1 db2 db3.table2 13 | 14 | mysqlindexcheck.py: error: The --best parameter must be an integer > 1 15 | Test case 5 - error: stats and worst=alpha 16 | Usage: mysqlindexcheck.py --server=user:pass@host:port:socket db1.table1 db2 db3.table2 17 | 18 | mysqlindexcheck.py: error: The --worst parameter must be an integer > 1 19 | Test case 6 - error: not stats 20 | Usage: mysqlindexcheck.py --server=user:pass@host:port:socket db1.table1 db2 db3.table2 21 | 22 | mysqlindexcheck.py: error: You must specify --stats for --best or --worst to take effect. 23 | Test case 7 - error: stats and both best and worst 24 | Usage: mysqlindexcheck.py --server=user:pass@host:port:socket db1.table1 db2 db3.table2 25 | 26 | mysqlindexcheck.py: error: You must specify either --best or --worst but not both. 27 | Test case 8 - error: stats and worst=-1 28 | Usage: mysqlindexcheck.py --server=user:pass@host:port:socket db1.table1 db2 db3.table2 29 | 30 | mysqlindexcheck.py: error: The --worst parameter must be an integer > 1 31 | Test case 9 - error: stats and best=-1 32 | Usage: mysqlindexcheck.py --server=user:pass@host:port:socket db1.table1 db2 db3.table2 33 | 34 | mysqlindexcheck.py: error: The --best parameter must be an integer > 1 35 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/r/check_unsupported_server_version.result: -------------------------------------------------------------------------------- 1 | Test case 1 - compare two databases on unsupported server 2 | # server1 on localhost: ... connected. 3 | ERROR: The server1 version is incompatible. Utility requires version 5.1.30 or higher. 4 | 5 | # Database consistency check failed. 6 | # 7 | # ...done 8 | 9 | Test case 2 - compare two databases on unsupported 2nd server 10 | # server1 on localhost: ... connected. 11 | # server2 on localhost: ... connected. 12 | ERROR: The server2 version is incompatible. Utility requires version 5.1.30 or higher. 13 | 14 | # Database consistency check failed. 15 | # 16 | # ...done 17 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/r/clone_db_exclude.result: -------------------------------------------------------------------------------- 1 | Test case 1 - exclude by name 2 | # Source on localhost: ... connected. 3 | # Destination on localhost: ... connected. 4 | # Copying database util_test renamed as util_db_clone 5 | # Copying TABLE util_test.t1 6 | # Copying TABLE util_test.t2 7 | # Copying TABLE util_test.t3 8 | # Copying PROCEDURE util_test.p1 9 | # Copying FUNCTION util_test.f1 10 | # Copying data for TABLE util_test.t1 11 | # Copying data for TABLE util_test.t2 12 | # Copying data for TABLE util_test.t3 13 | # Copying TRIGGER util_test.trg 14 | # Copying EVENT util_test.e1 15 | #...done. 16 | Test case 2 - exclude by regex 17 | # Source on localhost: ... connected. 18 | # Destination on localhost: ... connected. 19 | # Copying database util_test renamed as util_db_clone 20 | # Copying TABLE util_test.t1 21 | # Copying TABLE util_test.t2 22 | # Copying TABLE util_test.t3 23 | # Copying VIEW util_test.v1 24 | # Copying PROCEDURE util_test.p1 25 | # Copying FUNCTION util_test.f1 26 | # Copying data for TABLE util_test.t1 27 | # Copying data for TABLE util_test.t2 28 | # Copying data for TABLE util_test.t3 29 | # Copying TRIGGER util_test.trg 30 | #...done. 31 | Test case 3 - exclude by name and regex 32 | # Source on localhost: ... connected. 33 | # Destination on localhost: ... connected. 34 | # Copying database util_test renamed as util_db_clone 35 | # Copying TABLE util_test.t1 36 | # Copying TABLE util_test.t2 37 | # Copying TABLE util_test.t3 38 | # Copying PROCEDURE util_test.p1 39 | # Copying FUNCTION util_test.f1 40 | # Copying data for TABLE util_test.t1 41 | # Copying data for TABLE util_test.t2 42 | # Copying data for TABLE util_test.t3 43 | #...done. 44 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/r/clone_server.result: -------------------------------------------------------------------------------- 1 | Test case 1 - clone a running server 2 | # Cloning the MySQL server running on localhost. 3 | # Creating new data directory... 4 | # Configuring new instance... 5 | # Locating mysql tools... 6 | # Setting up empty database and mysql tables... 7 | # Starting new instance of the server... 8 | # Testing connection to new instance... 9 | # Success! 10 | # Setting the root password... 11 | # Connection Information: 12 | # -uroot [...] 13 | #...done. 14 | Test case 2 - clone a server from basedir 15 | # Cloning the MySQL server located at XXXX 16 | # Creating new data directory... 17 | # Configuring new instance... 18 | # Locating mysql tools... 19 | # Setting up empty database and mysql tables... 20 | # Starting new instance of the server... 21 | # Testing connection to new instance... 22 | # Success! 23 | # Setting the root password... 24 | # Connection Information: 25 | # -uroot [...] 26 | #...done. 27 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/r/clone_server_errors.result: -------------------------------------------------------------------------------- 1 | Test case 1 - error: no --new-data option 2 | Usage: mysqlserverclone.py --server=user:pass@host:port:socket --new-data=/tmp/data2 --new-port=3310 --new-id=12 --root-password=root 3 | 4 | mysqlserverclone.py: error: No new database path. Use --help for available options. 5 | Test case 2 - error: no login 6 | # WARNING: Root password for new instance has not been set. 7 | ERROR: Cannot connect to the source server. 8 | Error ####: Can't connect to MySQL server on 'nothere:####' 9 | Test case 3 - error: cannot connect 10 | ERROR: Cannot connect to the source server. 11 | Error ####: Can't connect to MySQL server on 'nothere:####' 12 | Test case 4 - cannot create directory 13 | # Cloning the MySQL server running on localhost. 14 | # Creating new data directory... 15 | ERROR: Unable to create directory '/not/there/yes' 16 | Test case 5 - error: --new-data exists 17 | Usage: mysqlserverclone.py --server=user:pass@host:port:socket --new-data=/tmp/data2 --new-port=3310 --new-id=12 --root-password=root 18 | 19 | mysqlserverclone.py: error: Target data directory exists and is not empty. Use --delete-data option to delete folder before cloning. 20 | Test case 6 - --new-data does not exist (but cannot connect) 21 | ERROR: Cannot connect to the source server. 22 | Error ####: Can't connect to MySQL server on 'nothere:####' 23 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/r/clone_user_errors.result: -------------------------------------------------------------------------------- 1 | Test case 1 - error: invalid login to source server 2 | # Source on localhost: ... ERROR: Cannot connect to the Source server. 3 | Error XXXX: Access denied 4 | Test case 2 - error: invalid login to destination server 5 | # Source on localhost: ... connected. 6 | # Destination on localhost: ... ERROR: Cannot connect to the Destination server. 7 | Error XXXX: Access denied 8 | Test case 3 - error: no arguments 9 | Usage: mysqluserclone.py --source=user:pass@host:port:socket --destination=user:pass@host:port:socket joe@localhost sam:secret1@localhost 10 | 11 | mysqluserclone.py: error: No arguments found. Use --help for available options. 12 | Test case 4 - error: no new user 13 | Usage: mysqluserclone.py --source=user:pass@host:port:socket --destination=user:pass@host:port:socket joe@localhost sam:secret1@localhost 14 | 15 | mysqluserclone.py: error: Wrong parameter combination or no new users. 16 | Test case 5 - error: cannot use dump and quiet together 17 | Usage: mysqluserclone.py --source=user:pass@host:port:socket --destination=user:pass@host:port:socket joe@localhost sam:secret1@localhost 18 | 19 | mysqluserclone.py: error: You cannot use --quiet and --dump together. 20 | Test case 6 - error: cannot parser source connection 21 | Usage: mysqluserclone.py --source=user:pass@host:port:socket --destination=user:pass@host:port:socket joe@localhost sam:secret1@localhost 22 | 23 | mysqluserclone.py: error: Source connection values invalid 24 | Test case 7 - error: cannot parser destination connection 25 | Usage: mysqluserclone.py --source=user:pass@host:port:socket --destination=user:pass@host:port:socket joe@localhost sam:secret1@localhost 26 | 27 | mysqluserclone.py: error: Destination connection values invalid 28 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/r/clone_user_parameters.result: -------------------------------------------------------------------------------- 1 | Test case 1 - show the grant statements 2 | # Source on localhost: ... connected. 3 | # Dumping grants for user joe_nopass@user 4 | GRANT USAGE ON *.* TO 'joe_nopass'@'user' 5 | GRANT ALL PRIVILEGES ON `util_test`.* TO 'joe_nopass'@'user' 6 | Test case 2 - show the help 7 | Usage: mysqluserclone.py --source=user:pass@host:port:socket --destination=user:pass@host:port:socket joe@localhost sam:secret1@localhost 8 | 9 | mysqluserclone - clone a MySQL user account to one or more new users 10 | 11 | Options: 12 | --version show program's version number and exit 13 | --help display a help message and exit 14 | --source=SOURCE connection information for source server in the form: 15 | [:]@[:][:] or 16 | [:][:]. 17 | --destination=DESTINATION 18 | connection information for destination server in the 19 | form: [:]@[:][:] 20 | or [:][:]. 21 | -d, --dump dump GRANT statements for user - does not require a 22 | destination 23 | --force drop the new user if it exists 24 | --include-global-privileges 25 | include privileges that match base_user@% as well as 26 | base_user@host 27 | --list list all users on the source - does not require a 28 | destination 29 | -f FORMAT, --format=FORMAT 30 | display the list of users in either grid (default), 31 | tab, csv, or vertical format - valid only for --list 32 | option 33 | -v, --verbose control how much information is displayed. e.g., -v = 34 | verbose, -vv = more verbose, -vvv = debug 35 | -q, --quiet turn off all messages for quiet execution. 36 | Test case 3 - use the quiet parameter 37 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/r/compare_db_errors.result: -------------------------------------------------------------------------------- 1 | Test case 1 - Invalid --server1 2 | Usage: mysqldbcompare.py --server1=user:pass@host:port:socket --server2=user:pass@host:port:socket db1:db2 3 | 4 | mysqldbcompare.py: error: Server1 connection values invalid 5 | Test case 2 - Invalid --server2 6 | Usage: mysqldbcompare.py --server1=user:pass@host:port:socket --server2=user:pass@host:port:socket db1:db2 7 | 8 | mysqldbcompare.py: error: Server2 connection values invalid 9 | Test case 3 - missing backticks inventory.inventory 10 | Usage: mysqldbcompare.py --server1=user:pass@host:port:socket --server2=user:pass@host:port:socket db1:db2 11 | 12 | mysqldbcompare.py: error: Cannot parse the specified database(s): 'inventory.inventory'. Please verify that the database(s) are specified in a valid format (i.e., db1[:db2]) and that backtick quotes are properly used when required. The use of backticks is required if non alphanumeric characters are used for database names. Parsing the specified database results in db1 = 'inventory' and db2 = 'inventory'. 13 | Test case 4 - non existing database '`inventory.inventory`' 14 | # server1 on localhost: ... connected. 15 | # server2 on localhost: ... connected. 16 | ERROR: The database inventory.inventory does not exist. 17 | 18 | # Database consistency check failed. 19 | # 20 | # ...done 21 | Test case 5 - invalid format :inventory 22 | Usage: mysqldbcompare.py --server1=user:pass@host:port:socket --server2=user:pass@host:port:socket db1:db2 23 | 24 | mysqldbcompare.py: error: Cannot parse the specified database(s): ':inventory'. Please verify that the database(s) are specified in a valid format (i.e., db1[:db2]) and that backtick quotes are properly used when required. 25 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/r/copy_db_exclude.result: -------------------------------------------------------------------------------- 1 | Test case 1 - exclude by name 2 | # Source on localhost: ... connected. 3 | # Destination on localhost: ... connected. 4 | # Copying database util_test renamed as util_db_clone 5 | # Copying TABLE util_test.t1 6 | # Copying TABLE util_test.t2 7 | # Copying TABLE util_test.t3 8 | # Copying PROCEDURE util_test.p1 9 | # Copying FUNCTION util_test.f1 10 | # Copying data for TABLE util_test.t1 11 | # Copying data for TABLE util_test.t2 12 | # Copying data for TABLE util_test.t3 13 | # Copying TRIGGER util_test.trg 14 | # Copying EVENT util_test.e1 15 | #...done. 16 | Test case 2 - exclude by regex 17 | # Source on localhost: ... connected. 18 | # Destination on localhost: ... connected. 19 | # Copying database util_test renamed as util_db_clone 20 | # Copying TABLE util_test.t1 21 | # Copying TABLE util_test.t2 22 | # Copying TABLE util_test.t3 23 | # Copying VIEW util_test.v1 24 | # Copying PROCEDURE util_test.p1 25 | # Copying FUNCTION util_test.f1 26 | # Copying data for TABLE util_test.t1 27 | # Copying data for TABLE util_test.t2 28 | # Copying data for TABLE util_test.t3 29 | # Copying TRIGGER util_test.trg 30 | #...done. 31 | Test case 3 - exclude by name and regex 32 | # Source on localhost: ... connected. 33 | # Destination on localhost: ... connected. 34 | # Copying database util_test renamed as util_db_clone 35 | # Copying TABLE util_test.t1 36 | # Copying TABLE util_test.t2 37 | # Copying TABLE util_test.t3 38 | # Copying PROCEDURE util_test.p1 39 | # Copying FUNCTION util_test.f1 40 | # Copying data for TABLE util_test.t1 41 | # Copying data for TABLE util_test.t2 42 | # Copying data for TABLE util_test.t3 43 | #...done. 44 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/r/copy_db_special_symbols.result: -------------------------------------------------------------------------------- 1 | Test case 1 - copy a database with special symbols 2 | # Source on localhost: ... connected. 3 | # Destination on localhost: ... connected. 4 | # Copying database util_spec renamed as util_spec_clone 5 | # Copying FUNCTION util_spec.spec_date 6 | #...done. 7 | RETURN DATE_FORMAT(mydatetime, '%d/%m %H:%i') 8 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/r/copy_user_errors.result: -------------------------------------------------------------------------------- 1 | Test case 1 - error: invalid login to source server 2 | # Source on localhost: ... ERROR: Cannot connect to the Source server. 3 | Error XXXX: Access denied 4 | Test case 2 - error: invalid login to destination server 5 | # Source on localhost: ... connected. 6 | # Destination on localhost: ... ERROR: Cannot connect to the Destination server. 7 | Error XXXX: Access denied 8 | Test case 3 - error: no arguments 9 | Usage: mysqluserclone.py --source=user:pass@host:port:socket --destination=user:pass@host:port:socket joe@localhost sam:secret1@localhost 10 | 11 | mysqluserclone.py: error: No arguments found. Use --help for available options. 12 | Test case 4 - error: no new user 13 | Usage: mysqluserclone.py --source=user:pass@host:port:socket --destination=user:pass@host:port:socket joe@localhost sam:secret1@localhost 14 | 15 | mysqluserclone.py: error: Wrong parameter combination or no new users. 16 | Test case 5 - error: cannot use dump and quiet together 17 | Usage: mysqluserclone.py --source=user:pass@host:port:socket --destination=user:pass@host:port:socket joe@localhost sam:secret1@localhost 18 | 19 | mysqluserclone.py: error: You cannot use --quiet and --dump together. 20 | Test case 6 - error: cannot parser source connection 21 | Usage: mysqluserclone.py --source=user:pass@host:port:socket --destination=user:pass@host:port:socket joe@localhost sam:secret1@localhost 22 | 23 | mysqluserclone.py: error: Source connection values invalid 24 | Test case 7 - error: cannot parser destination connection 25 | Usage: mysqluserclone.py --source=user:pass@host:port:socket --destination=user:pass@host:port:socket joe@localhost sam:secret1@localhost 26 | 27 | mysqluserclone.py: error: Destination connection values invalid 28 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/r/diskusage_basic.result: -------------------------------------------------------------------------------- 1 | Test Case 1 : Testing disk space (simple) 2 | # Source on localhost: ... connected. 3 | # Database totals: 4 | db_name,total 5 | util_test,XXXXXXX 6 | 7 | Total database disk usage = XXXXXXX 8 | 9 | #...done. 10 | Test Case 2 : Testing disk space (with empty) 11 | # Source on localhost: ... connected. 12 | # Database totals: 13 | +------------+----------+ 14 | | db_name | total | 15 | +------------+----------+ 16 | | util_test | XXXXXXX | 17 | +------------+----------+ 18 | 19 | Total database disk usage = XXXXXXX 20 | 21 | #...done. 22 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/r/diskusage_errors.result: -------------------------------------------------------------------------------- 1 | Test Case 1 : Errors for logs, binlog, innodb 2 | # Source on localhost: ... connected. 3 | # Database totals: 4 | db_name,db_dir_size,data_size,misc_files,total 5 | mysql,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX 6 | util_test,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX 7 | 8 | Total database disk usage = XXXXXXX 9 | 10 | # Log information. 11 | # The general_log is turned off on the server. 12 | # The slow_query_log is turned off on the server. 13 | log_name,size 14 | error_log.err,XXXX 15 | 16 | Total size of logs = XXXX 17 | 18 | # Binary logging is turned off on the server. 19 | # Server is not an active slave - no relay log information. 20 | # InnoDB is disabled on this server. 21 | #...done. 22 | 23 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/r/diskusage_format.result: -------------------------------------------------------------------------------- 1 | Test Case 1 : Testing disk space with CSV format 2 | # Source on localhost: ... connected. 3 | # Database totals: 4 | db_name,total 5 | util_test,XXXXXXX 6 | 7 | Total database disk usage = XXXXXXX 8 | 9 | #...done. 10 | Test Case 2 : Testing disk space with TAB format 11 | # Source on localhost: ... connected. 12 | # Database totals: 13 | db_name total 14 | util_test XXXXXXX 15 | 16 | Total database disk usage = XXXXXXX 17 | 18 | #...done. 19 | Test Case 3 : Testing disk space with GRID format 20 | # Source on localhost: ... connected. 21 | # Database totals: 22 | +------------+----------+ 23 | | db_name | total | 24 | +------------+----------+ 25 | | util_test | XXXXXXX | 26 | +------------+----------+ 27 | 28 | Total database disk usage = XXXXXXX 29 | 30 | #...done. 31 | Test Case 4 : Testing disk space with VERTICAL format 32 | # Source on localhost: ... connected. 33 | # Database totals: 34 | ************************* 1. row ************************* 35 | db_name: util_test 36 | total: XXXXXXX 37 | 1 rows. 38 | 39 | Total database disk usage = XXXXXXX 40 | 41 | #...done. 42 | Test Case 5 : Testing disk space with NOT_THERE format 43 | Usage: mysqldiskusage.py --server=user:pass@host:port:socket db1 --all 44 | 45 | mysqldiskusage.py: error: option --format: invalid choice: 'NOT_THERE' (choose from 'grid', 'tab', 'csv', 'vertical') 46 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/r/diskusage_paths.result: -------------------------------------------------------------------------------- 1 | Test Case 1 : Testing disk space (with paths) 2 | # Source on localhost: ... connected. 3 | # Database totals: 4 | db_name,total 5 | util_test,XXXXXXX 6 | 7 | Total database disk usage = XXXXXXX 8 | 9 | # Log information. 10 | log_name,size 11 | slow.log,XXXX 12 | general.log,XXXX 13 | error_log.err,XXXXX 14 | 15 | Total size of logs = XXXX 16 | 17 | # binary log information: 18 | Current binary log file = XXXX 19 | log_file,size 20 | mysql-bin.000001,XXXX 21 | mysql-bin.index,XXXX 22 | 23 | Total size of binary logs = XXXX 24 | 25 | # Server is not an active slave - no relay log information. 26 | # InnoDB tablespace information: 27 | innodb_file,size 28 | ib_logfile0,XXXXXXXX 29 | ib_logfile1,XXXXXXXX 30 | ibdata1,XXXXXXXX 31 | 32 | Total size of InnoDB files = XXXXXXXX 33 | 34 | #...done. 35 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/r/export_errors.result: -------------------------------------------------------------------------------- 1 | Test case 1 - bad --skip values 2 | ERROR: The value wiki-waki is not a valid value for --skip. 3 | Test case 2 - exporting data and skipping data 4 | ERROR: You cannot use --export=data and --skip-data when exporting table data. 5 | Test case 3 - no database specified 6 | Usage: mysqldbexport.py --server=user:pass@host:port:socket db1, db2, db3 7 | 8 | mysqldbexport.py: error: You must specify at least one database to export or use the --all option to export all databases. 9 | Test case 4 - cannot parse --server 10 | Usage: mysqldbexport.py --server=user:pass@host:port:socket db1, db2, db3 11 | 12 | mysqldbexport.py: error: Server connection values invalid 13 | Test case 5 - error: cannot connect to server 14 | # Source on localhost: ... ERROR: Cannot connect to the Source server. 15 | Error 1045: Access denied for user 'nope'@'localhost' (using password: YES) 16 | Test case 6 - error: not enough privileges 17 | # Source on localhost: ... connected. 18 | ERROR: User joe on the Source server does not have permissions to read all objects in util_test. User needs SELECT privilege on util_test. 19 | Test case 7 - database does not exist 20 | # Source on localhost: ... connected. 21 | ERROR: Source database does not exist - notthereatall 22 | Test case 8 - error: not enough privileges 23 | # Source on localhost: ... connected. 24 | ERROR: User joe on the Source server does not have permissions to read all objects in util_test. User needs SELECT privilege on util_test. 25 | Test case 9 - error: db list and --all 26 | Usage: mysqldbexport.py --server=user:pass@host:port:socket db1, db2, db3 27 | 28 | mysqldbexport.py: error: You cannot use the --all option with a list of databases. 29 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/r/export_file_per_table.result: -------------------------------------------------------------------------------- 1 | Test case 1 - warning: def only with --file-per-table 2 | # WARNING: --file-per-table option ignored for metadata export. 3 | # Source on localhost: ... connected. 4 | # Exporting metadata from util_test_mt 5 | DROP DATABASE IF EXISTS `util_test_mt`; 6 | CREATE DATABASE `util_test_mt`; 7 | USE `util_test_mt`; 8 | #...done. 9 | Test case 2 - sql format with --file-per-table 10 | # Checking for file-per-table creation: 11 | # util_test.t1.sql ................. [PASS] 12 | # util_test.t2.sql ................. [PASS] 13 | # util_test.t3.sql ................. [PASS] 14 | # util_test.t4.sql ................. [PASS] 15 | 16 | Test case 3 - grid format with --file-per-table 17 | # Checking for file-per-table creation: 18 | # util_test.t1.grid ................. [PASS] 19 | # util_test.t2.grid ................. [PASS] 20 | # util_test.t3.grid ................. [PASS] 21 | # util_test.t4.grid ................. [PASS] 22 | 23 | Test case 4 - csv format with --file-per-table 24 | # Checking for file-per-table creation: 25 | # util_test.t1.csv ................. [PASS] 26 | # util_test.t2.csv ................. [PASS] 27 | # util_test.t3.csv ................. [PASS] 28 | # util_test.t4.csv ................. [PASS] 29 | 30 | Test case 5 - tab format with --file-per-table 31 | # Checking for file-per-table creation: 32 | # util_test.t1.tab ................. [PASS] 33 | # util_test.t2.tab ................. [PASS] 34 | # util_test.t3.tab ................. [PASS] 35 | # util_test.t4.tab ................. [PASS] 36 | 37 | Test case 6 - vertical format with --file-per-table 38 | # Checking for file-per-table creation: 39 | # util_test.t1.vertical ................. [PASS] 40 | # util_test.t2.vertical ................. [PASS] 41 | # util_test.t3.vertical ................. [PASS] 42 | # util_test.t4.vertical ................. [PASS] 43 | 44 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/r/export_mysql.result: -------------------------------------------------------------------------------- 1 | Test case 1 - export metadata to new server via the mysql monitor 2 | OBJECT COUNTS: tables = 4, views = 1, triggers = 1, procedures = 1, functions = 1, 3 | Test case 2 - export the data to new server via the mysql monitor 4 | Showing data for table t1 5 | a 6 | 01 Test Basic database example 7 | 02 Test Basic database example 8 | 03 Test Basic database example 9 | 04 Test Basic database example 10 | 05 Test Basic database example 11 | 06 Test Basic database example 12 | 07 Test Basic database example 13 | Showing data for table t2 14 | a 15 | Test objects count 16 | Test objects count 17 | Test objects count 18 | Test objects count 19 | Test objects count 20 | Test objects count 21 | Test objects count 22 | 11 Test Basic database example 23 | 12 Test Basic database example 24 | 13 Test Basic database example 25 | Showing data for table t3 26 | a b 27 | 1 14 test fkeys 28 | 2 15 test fkeys 29 | 3 16 test fkeys 30 | Showing data for table t4 31 | c d 32 | 3 2 33 | OBJECT COUNTS: tables = 0, views = 0, triggers = 0, procedures = 0, functions = 0, 34 | Test case 3 - export all objects and data to new server via the mysql monitor 35 | OBJECT COUNTS: tables = 4, views = 1, triggers = 1, procedures = 1, functions = 1, 36 | Showing data for table t1 37 | a 38 | 01 Test Basic database example 39 | 02 Test Basic database example 40 | 03 Test Basic database example 41 | 04 Test Basic database example 42 | 05 Test Basic database example 43 | 06 Test Basic database example 44 | 07 Test Basic database example 45 | Showing data for table t2 46 | a 47 | Test objects count 48 | Test objects count 49 | Test objects count 50 | Test objects count 51 | Test objects count 52 | Test objects count 53 | Test objects count 54 | 11 Test Basic database example 55 | 12 Test Basic database example 56 | 13 Test Basic database example 57 | Showing data for table t3 58 | a b 59 | 1 14 test fkeys 60 | 2 15 test fkeys 61 | 3 16 test fkeys 62 | Showing data for table t4 63 | c d 64 | 3 2 65 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/r/format_list.result: -------------------------------------------------------------------------------- 1 | +--------+ 2 | | a | 3 | +--------+ 4 | | one | 5 | | two | 6 | | three | 7 | +--------+ 8 | +--------+-------+ 9 | | a | b | 10 | +--------+-------+ 11 | | one | None | 12 | | two | None | 13 | | three | None | 14 | +--------+-------+ 15 | +--------+-------+-----+ 16 | | a | b | c | 17 | +--------+-------+-----+ 18 | | one | None | 31 | 19 | | two | None | 32 | 20 | | three | None | 33 | 21 | +--------+-------+-----+ 22 | ************************* 1. row ************************* 23 | a: one 24 | ************************* 2. row ************************* 25 | a: two 26 | ************************* 3. row ************************* 27 | a: three 28 | 3 rows. 29 | ************************* 1. row ************************* 30 | a: one 31 | b: None 32 | ************************* 2. row ************************* 33 | a: two 34 | b: None 35 | ************************* 3. row ************************* 36 | a: three 37 | b: None 38 | 3 rows. 39 | ************************* 1. row ************************* 40 | a: one 41 | b: None 42 | c: 31 43 | ************************* 2. row ************************* 44 | a: two 45 | b: None 46 | c: 32 47 | ************************* 3. row ************************* 48 | a: three 49 | b: None 50 | c: 33 51 | 3 rows. 52 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/r/get_tool_windows.result: -------------------------------------------------------------------------------- 1 | Test case 1 - get_tool mysqld-nt.exe 2 | Pass 3 | 4 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/r/mylogin.result: -------------------------------------------------------------------------------- 1 | {'passwd': '', 'host': 'localhost', 'user': 'test_user', 'port': 3306} 2 | {'passwd': '', 'host': 'localhost', 'user': 'test_user', 'port': 3306} 3 | {'passwd': '', 'host': 'localhost', 'user': 'test_user', 'port': 1000} 4 | {'passwd': '', 'host': 'localhost', 'user': 'test_user', 'port': 1000} 5 | {'passwd': '', 'unix_socket': '/my.socket', 'host': 'localhost', 'user': 'test_user', 'port': 1000} 6 | {'passwd': '', 'unix_socket': '/my.socket', 'host': 'localhost', 'user': 'test_user', 'port': 1000} 7 | {'passwd': '', 'unix_socket': '/my.socket', 'host': 'localhost', 'user': 'test_user', 'port': 3306} 8 | {'passwd': '', 'unix_socket': '/my.socket', 'host': 'localhost', 'user': 'test_user', 'port': 3306} 9 | ('test_user', None) 10 | ('test_user', None) 11 | ('test_user', '') 12 | ('user_x', '') 13 | ('user_x', 'pass_y') 14 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/r/mylogin_clone_user.result: -------------------------------------------------------------------------------- 1 | Test case 1 - Clone one user to another (using login-path) 2 | # Source on localhost: ... connected. 3 | # Destination on localhost: ... connected. 4 | # Cloning 1 users... 5 | # Cloning joe_pass@user to user jill:duh@user 6 | # ...done. 7 | GRANT USAGE ON *.* TO 'jill'@'user' IDENTIFIED BY PASSWORD '*76293EBE39BB165EF83BE0C62A146506D85FDBD2' 8 | GRANT SELECT ON `util_test`.* TO 'jill'@'user' 9 | Test case 2 - Clone a user to multiple users (using login-path) 10 | # Source on localhost: ... connected. 11 | # Destination on localhost: ... connected. 12 | # Cloning 2 users... 13 | # Cloning amy_nopass@user to user jack:duh@user 14 | # Cloning amy_nopass@user to user john@user 15 | # ...done. 16 | GRANT USAGE ON *.* TO 'jack'@'user' IDENTIFIED BY PASSWORD '*76293EBE39BB165EF83BE0C62A146506D85FDBD2' 17 | GRANT INSERT ON `util_test`.* TO 'jack'@'user' 18 | GRANT USAGE ON *.* TO 'john'@'user' 19 | GRANT INSERT ON `util_test`.* TO 'john'@'user' 20 | Test case 3 - Clone one user to another (using login-path) with only source specified 21 | # Source on localhost: ... connected. 22 | # Cloning 1 users... 23 | # Cloning joe_pass@user to user jill:duh@user 24 | # ...done. 25 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/r/proc_grep.result: -------------------------------------------------------------------------------- 1 | Test case 1 - find processes for current user format=CSV 2 | Connection,Id,User,Host,Db,Command,Time,State,Info 3 | root[...],XXXXX,root,localhost,,Query,XXXXX,executing,"SELECT 4 | Id, User, Host, Db, Command, Time, State, Info 5 | FROM 6 | INFORMATION_SCHEMA.PROCESSLIST 7 | WHERE 8 | USER LIKE 'root'" 9 | root[...],XXXXX,root,localhost,,Sleep,XXXXX,, 10 | 11 | Test case 2 - find processes for current user format=TAB 12 | Connection Id User Host Db Command Time State Info 13 | root[...] 14 | Id, User, Host, Db, Command, Time, State, Info 15 | FROM 16 | INFORMATION_SCHEMA.PROCESSLIST 17 | WHERE 18 | USER LIKE 'root'" 19 | root[...] 20 | 21 | Test case 3 - find processes for current user format=VERTICAL 22 | ************************* 1. row ************************* 23 | Connection: XXXXX 24 | Id: XXXXX 25 | User: root 26 | Host: localhost 27 | Db: None 28 | Command: Query 29 | Time: XXXXX 30 | State: executing 31 | Info: SELECT 32 | Id, User, Host, Db, Command, Time, State, Info 33 | FROM 34 | INFORMATION_SCHEMA.PROCESSLIST 35 | WHERE 36 | USER LIKE 'root' 37 | ************************* 2. row ************************* 38 | Connection: XXXXX 39 | Id: XXXXX 40 | User: root 41 | Host: localhost 42 | Db: None 43 | Command: Sleep 44 | Time: XXXXX 45 | State: 46 | Info: None 47 | 2 rows. 48 | 49 | Test case 4 - find processes for current user format=GRID 50 | +---+ 51 | | Connection | Id | User | Host | Db | Command | Time | State | Info [...] | 52 | +---+ 53 | | root[...] | XXXXX | root | localhost | None | Query | XXXXX | executing | SELECT 54 | Id, User, Host, Db, Command, Time, State, Info 55 | FROM 56 | INFORMATION_SCHEMA.PROCESSLIST 57 | WHERE 58 | USER LIKE 'root' | 59 | | root[...] | XXXXX | root | localhost | None | Sleep | XXXXX | | None | 60 | +---+ 61 | 62 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/r/server_info.result: -------------------------------------------------------------------------------- 1 | Test case 1 - basic serverinfo 2 | # Source on localhost: ... connected. 3 | ************************* 1. row ************************* 4 | server: localhost: XXXX 5 | version: XXXX 6 | datadir: XXXX 7 | basedir: XXXX 8 | plugin_dir: XXXX 9 | config_file: XXXX 10 | binary_log: XXXX 11 | binary_log_pos: XXXX 12 | relay_log: XXXX 13 | relay_log_pos: XXXX 14 | 1 rows. 15 | #...done. 16 | 17 | Test case 2 - basic serverinfo with -d option 18 | 19 | Test case 3 - re-started server prints results 20 | # Server is offline. 21 | # Checking server version ... done. 22 | # Starting read-only instance of the server ... done. 23 | # Source on localhost: ... connected. 24 | # Shutting down server ... done. 25 | ************************* 1. row ************************* 26 | server: localhost: XXXX 27 | version: XXXX 28 | datadir: XXXX 29 | basedir: XXXX 30 | plugin_dir: XXXX 31 | config_file: XXXX 32 | binary_log: XXXX 33 | binary_log_pos: XXXX 34 | relay_log: XXXX 35 | relay_log_pos: XXXX 36 | 1 rows. 37 | #...done. 38 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/r/server_info_errors.result: -------------------------------------------------------------------------------- 1 | Test case 1 - no server 2 | Usage: mysqlserverinfo.py --server=user:pass@host:port:socket --format=grid 3 | 4 | mysqlserverinfo.py: error: You must specify at least one server. 5 | 6 | Test case 2 - bad server 7 | ERROR: Server connection values invalid 8 | 9 | Test case 3 - bad format 10 | Usage: mysqlserverinfo.py --server=user:pass@host:port:socket --format=grid 11 | 12 | mysqlserverinfo.py: error: option --format: invalid choice: 'ASDASDASD' (choose from 'grid', 'tab', 'csv', 'vertical') 13 | 14 | Test case 4 - wrong password 15 | ERROR: Access denied for user 'root'@'localhost' using password: YES 16 | 17 | Test case 5 - no password 18 | ERROR: Access denied for user 'root'@'localhost' using password: NO 19 | 20 | Test case 6 - offline server without start, basedir, datadir option 21 | ERROR: Server is offline. To connect, you must also provide basedir, datadir and the start option 22 | 23 | Test case 7 - offline server without start, datadir option 24 | ERROR: Server is offline. To connect, you must also provide datadir and the start option 25 | 26 | Test case 8 - offline server without start option 27 | ERROR: Server is offline. To connect, you must also provide start option 28 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/std_data/backtick_data.sql: -------------------------------------------------------------------------------- 1 | # DROP DATABASE IF EXISTS `db``:db`; 2 | 3 | CREATE DATABASE `db``:db`; 4 | 5 | CREATE TABLE `db``:db`.```t``export_1` (`id``` int not null primary key auto_increment, other char(30)) ENGINE=InnoDB; 6 | CREATE TABLE `db``:db`.```t``.``export_2` (`id``` int not null primary key auto_increment, other char(30)) ENGINE=InnoDB; 7 | 8 | INSERT INTO `db``:db`.```t``export_1` (other) VALUES ("@`var``var`"); 9 | INSERT INTO `db``:db`.```t``.``export_2` (other) VALUES ("@`var`.`var`"); 10 | 11 | USE `db``:db`; 12 | 13 | CREATE FUNCTION `fu``nc`(`a``` TEXT) RETURNS TEXT DETERMINISTIC RETURN `a```; 14 | 15 | # NOTE: There is a bug in MySQL server 5.6.10 when backticks are used to create a trigger 16 | # (i.e., The ACTION_STATEMENT value in INFORMATION_SCHEMA.TRIGGERS is incorrect). 17 | # Uncomment the trigger creation statment in a later release, once the bug is fixed. 18 | # CREATE TRIGGER `trg``1` AFTER INSERT ON `db``:db`.```t``export_1` FOR EACH ROW INSERT INTO `db``:db`.```t``.``export_2` (other) VALUES (`fu``nc`(new.other)); 19 | 20 | CREATE PROCEDURE `pr````oc`() INSERT INTO `db``:db`.```t``export_1` (other) VALUES ("proc->trigger->func"); 21 | 22 | CREATE VIEW `db``:db`.```v``export_1` as SELECT * FROM `db``:db`.```t``export_1`; 23 | 24 | CREATE EVENT `db``:db`.```e``export_1` ON SCHEDULE EVERY 1 YEAR DISABLE DO DELETE FROM `db``:db`.```t``export_1` WHERE other = "not there"; 25 | 26 | GRANT ALL ON `db``:db`.* TO 'joe'@'user'; 27 | 28 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/std_data/bad_engine.csv: -------------------------------------------------------------------------------- 1 | # Source on localhost: ... connected. 2 | # Exporting metadata from util_test 3 | # TABLES in util_test: 4 | TABLE_SCHEMA,TABLE_NAME,ENGINE,ORDINAL_POSITION,COLUMN_NAME,COLUMN_TYPE,IS_NULLABLE,COLUMN_DEFAULT,COLUMN_KEY,TABLE_COLLATION,CREATE_OPTIONS,CONSTRAINT_NAME,REFERENCED_TABLE_NAME,UNIQUE_CONSTRAINT_NAME,UPDATE_RULE,DELETE_RULE,CONSTRAINT_NAME,COL_NAME,REFERENCED_TABLE_SCHEMA,REFERENCED_COLUMN_NAME 5 | util_test,t1,,1,a,char(30),YES,,,latin1_swedish_ci,,,,,,,,,, 6 | util_test,t2,CAYMAN,1,a,char(30),YES,,,latin1_swedish_ci,,,,,,,,,, 7 | util_test,t3,BOXSTER,1,a,int(11),NO,,PRI,latin1_swedish_ci,,,,,,,PRIMARY,a,, 8 | util_test,t3,BOXSTER,2,b,char(30),YES,,,latin1_swedish_ci,,,,,,,PRIMARY,a,, 9 | util_test,t4,MYISAM,1,c,int(11),NO,,MUL,latin1_swedish_ci,,ref_t3,t3,PRIMARY,RESTRICT,RESTRICT,ref_t3,c,util_test,a 10 | util_test,t4,MYISAM,2,d,int(11),NO,,,latin1_swedish_ci,,ref_t3,t3,PRIMARY,RESTRICT,RESTRICT,ref_t3,c,util_test,a 11 | util_test,t5,,1,c,char(30),YES,,,latin1_swedish_ci,,,,,,,,,, 12 | util_test,t5,,2,b,char(40),YES,,,latin1_swedish_ci,,,,,,,,,, 13 | util_test,t5,,3,a,char(10),YES,,,latin1_swedish_ci,,,,,,,,,, 14 | util_test,t5,,4,d,char(20),YES,,,latin1_swedish_ci,,,,,,,,,, 15 | util_test,t6,CARRERA,1,a,char(30),YES,,,latin1_swedish_ci,,,,,,,,,, 16 | util_test,t7,,1,c,char(30),YES,,,latin1_swedish_ci,,,,,,,,,, 17 | util_test,t8,PANAMERA,1,a,char(30),YES,,,latin1_swedish_ci,,,,,,,,,, 18 | util_test,t9,INNODB,1,c,char(10),YES,,,latin1_swedish_ci,,,,,,,,,, 19 | util_test,t10,,1,b,char(60),YES,,,latin1_swedish_ci,,,,,,,,,, 20 | # done. -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/std_data/bad_sql.sql: -------------------------------------------------------------------------------- 1 | CREATE DATABASE util_test; 2 | CREATE TABLES util_test.t1 (a char(30)) ENGINE=MEMORY; 3 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/std_data/basic_data.sql: -------------------------------------------------------------------------------- 1 | # 2 | # DROP DATABASE IF EXISTS util_test; 3 | # 4 | CREATE DATABASE util_test; 5 | CREATE TABLE util_test.t1 (a char(30)) ENGINE=MEMORY; 6 | INSERT INTO util_test.t1 VALUES ("01 Test Basic database example"); 7 | INSERT INTO util_test.t1 VALUES ("02 Test Basic database example"); 8 | INSERT INTO util_test.t1 VALUES ("03 Test Basic database example"); 9 | INSERT INTO util_test.t1 VALUES ("04 Test Basic database example"); 10 | INSERT INTO util_test.t1 VALUES ("05 Test Basic database example"); 11 | INSERT INTO util_test.t1 VALUES ("06 Test Basic database example"); 12 | INSERT INTO util_test.t1 VALUES ("07 Test Basic database example"); 13 | 14 | CREATE TABLE util_test.t2 (a char(30)) ENGINE=MYISAM; 15 | INSERT INTO util_test.t2 VALUES ("11 Test Basic database example"); 16 | INSERT INTO util_test.t2 VALUES ("12 Test Basic database example"); 17 | INSERT INTO util_test.t2 VALUES ("13 Test Basic database example"); 18 | 19 | CREATE TABLE util_test.t3 (a int not null auto_increment, b char(30), primary key(a)) ENGINE=InnoDB; 20 | INSERT INTO util_test.t3 (b) VALUES ("14 test fkeys"); 21 | INSERT INTO util_test.t3 (b) VALUES ("15 test fkeys"); 22 | INSERT INTO util_test.t3 (b) VALUES ("16 test fkeys"); 23 | 24 | CREATE TABLE util_test.t4 (c int not null, d int not null, CONSTRAINT ref_t3 FOREIGN KEY(c) REFERENCES util_test.t3(a)) ENGINE=InnoDB; 25 | INSERT INTO util_test.t4 VALUES (3, 2); 26 | 27 | CREATE PROCEDURE util_test.p1(p1 CHAR(20)) INSERT INTO util_test.t1 VALUES ("50"); 28 | 29 | CREATE TRIGGER util_test.trg AFTER INSERT ON util_test.t1 FOR EACH ROW INSERT INTO util_test.t2 VALUES('Test objects count'); 30 | 31 | CREATE FUNCTION util_test.f1() RETURNS INT DETERMINISTIC RETURN (SELECT 1); 32 | 33 | CREATE VIEW util_test.v1 as SELECT * FROM util_test.t1; 34 | 35 | CREATE EVENT util_test.e1 ON SCHEDULE EVERY 1 YEAR DISABLE DO DELETE FROM util_test.t1 WHERE a = "not there"; 36 | 37 | GRANT ALL ON util_test.* TO 'joe'@'user'; 38 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/std_data/basic_users.sql: -------------------------------------------------------------------------------- 1 | DROP DATABASE IF EXISTS util_test; 2 | CREATE DATABASE util_test; 3 | GRANT ALL ON util_test.* TO 'joe_nopass'@'user'; 4 | GRANT SELECT ON util_test.* TO 'joe_pass'@'user' IDENTIFIED BY 'dumb'; 5 | GRANT INSERT ON util_test.* TO 'amy_nopass'@'user'; 6 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/std_data/clone_db_inserts.inc: -------------------------------------------------------------------------------- 1 | INSERT INTO util_test.t1 VALUES ("21 Test Basic database example"); 2 | INSERT INTO util_test.t1 VALUES ("22 Test Basic database example"); 3 | INSERT INTO util_test.t1 VALUES ("23 Test Basic database example"); 4 | INSERT INTO util_test.t1 VALUES ("24 Test Basic database example"); 5 | INSERT INTO util_test.t1 VALUES ("25 Test Basic database example"); 6 | INSERT INTO util_test.t1 VALUES ("26 Test Basic database example"); 7 | INSERT INTO util_test.t1 VALUES ("27 Test Basic database example"); 8 | INSERT INTO util_test.t2 VALUES ("31 Test Basic database example"); 9 | INSERT INTO util_test.t2 VALUES ("32 Test Basic database example"); 10 | INSERT INTO util_test.t2 VALUES ("33 Test Basic database example"); 11 | 12 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/std_data/db_compare_backtick.sql: -------------------------------------------------------------------------------- 1 | DROP DATABASE IF EXISTS `db``:db`; 2 | 3 | CREATE DATABASE `db``:db`; 4 | 5 | CREATE TABLE `db``:db`.```t``export_1` (`id``` int not null primary key auto_increment, other char(30)) ENGINE=InnoDB DEFAULT CHARSET=latin1; 6 | CREATE TABLE `db``:db`.```t``.``export_2` (`id``` int not null primary key auto_increment, other char(30)) ENGINE=InnoDB DEFAULT CHARSET=latin1; 7 | 8 | INSERT INTO `db``:db`.```t``export_1` (other) VALUES ("@`var``var1`"); 9 | INSERT INTO `db``:db`.```t``export_1` (other) VALUES ("@`var``var2`"); 10 | INSERT INTO `db``:db`.```t``export_1` (other) VALUES ("@`var``var3`"); 11 | INSERT INTO `db``:db`.```t``export_1` (other) VALUES ("@`var``var4`"); 12 | INSERT INTO `db``:db`.```t``export_1` (other) VALUES ("@`var``var5`"); 13 | INSERT INTO `db``:db`.```t``.``export_2` (other) VALUES ("@`var`.`var1`"); 14 | INSERT INTO `db``:db`.```t``.``export_2` (other) VALUES ("@`var`.`var2`"); 15 | INSERT INTO `db``:db`.```t``.``export_2` (other) VALUES ("@`var`.`var3`"); 16 | 17 | USE `db``:db`; 18 | 19 | CREATE VIEW `db``:db`.```v``export_1` as SELECT * FROM `db``:db`.```t``export_1`; 20 | 21 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/std_data/fkeys.sql: -------------------------------------------------------------------------------- 1 | # 2 | # DROP DATABASE IF EXISTS util_test_fk; 3 | # 4 | # NOTE: Must load with FKey checks OFF. This is so a1 is 'created' before 5 | # t1 to show proper functioning. 6 | # 7 | CREATE DATABASE util_test_fk; 8 | CREATE TABLE util_test_fk.a1 (a int, b char(20), c int, PRIMARY KEY(a), CONSTRAINT c FOREIGN KEY (c) REFERENCES t1(d)) ENGINE=INNODB; 9 | CREATE TABLE util_test_fk.t1 (d int, b char(20), PRIMARY KEY(d)) ENGINE=INNODB; 10 | INSERT INTO util_test_fk.t1 VALUES (1, 'one'), (2, 'two'), (3, 'three'); 11 | INSERT INTO util_test_fk.a1 VALUES (4, 'four', 1), (5, 'five', 2), (6, 'six', 3), (7, NULL, 3); 12 | 13 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/std_data/index_test.sql: -------------------------------------------------------------------------------- 1 | CREATE DATABASE util_test_a 2 | CREATE DATABASE util_test_b 3 | CREATE DATABASE util_test_c 4 | 5 | CREATE TABLE util_test_a.`t1` (`A` int(11) NOT NULL DEFAULT '0', `b` varchar(2) DEFAULT NULL, `c` varchar(255) DEFAULT NULL, `d` point NOT NULL, `e` geometry NOT NULL, PRIMARY KEY (`A`), SPATIAL KEY `s1` (`e`), SPATIAL KEY `s2` (`d`), SPATIAL KEY `s4` (`d`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 6 | CREATE TABLE util_test_a.`t2` (`id` int(11) DEFAULT NULL, KEY `id` (`id`) USING HASH) ENGINE=MyISAM DEFAULT CHARSET=latin1 7 | CREATE TABLE util_test_b.`t3` (`id` int(11) DEFAULT NULL, KEY `id` (`id`) USING HASH) ENGINE=MEMORY DEFAULT CHARSET=latin1 8 | CREATE TABLE util_test_b.`t4` (`id` int(11) DEFAULT NULL, KEY `id` (`id`) USING BTREE) ENGINE=MEMORY DEFAULT CHARSET=latin1 9 | CREATE TABLE util_test_c.`t5` (`x` int(11) DEFAULT NULL, `y` varchar(255) DEFAULT NULL, `a` varchar(255) DEFAULT NULL, `b` varchar(255) DEFAULT NULL, `c` varchar(255) DEFAULT NULL, FULLTEXT KEY `ft` (`y`), FULLTEXT KEY `ft1` (`y`), FULLTEXT KEY `ft2` (`a`,`b`,`c`), FULLTEXT KEY `ft3` (`a`,`b`), FULLTEXT KEY `ft4` (`a`,`b`,`y`), FULLTEXT KEY `ft5` (`y`,`a`,`b`), FULLTEXT KEY `ft6` (`c`,`a`,`b`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 10 | CREATE TABLE util_test_c.`t6` (a char(30)) 11 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/std_data/show_arguments.sh: -------------------------------------------------------------------------------- 1 | echo "# ARGUMENTS PASSED:" 2 | echo "# old master host: " $1 3 | echo "# old master port: " $2 4 | echo "# new master host: " $3 5 | echo "# new master port: " $4 6 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/std_data/special_data.sql: -------------------------------------------------------------------------------- 1 | # 2 | # Create a database with special symbols for compatibility testing. 3 | # 4 | CREATE DATABASE util_spec; 5 | CREATE FUNCTION util_spec.spec_date(mydatetime datetime) RETURNS datetime DETERMINISTIC RETURN DATE_FORMAT(mydatetime, '%d/%m %H:%i') 6 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/std_data/transform_data.sql: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a variant of the basic_data.sql file and is used for doing 3 | # compares and generating tests for transofmations. 4 | # 5 | #DROP DATABASE IF EXISTS util_test; 6 | # 7 | CREATE DATABASE util_test; 8 | CREATE TABLE util_test.t1 (a char(30)) ENGINE=MEMORY; 9 | INSERT INTO util_test.t1 VALUES ("01 Test Basic database example"); 10 | INSERT INTO util_test.t1 VALUES ("02 Test Basic mod1 database example"); 11 | INSERT INTO util_test.t1 VALUES ("03 Test Basic database example"); 12 | INSERT INTO util_test.t1 VALUES ("04 Test Basic database example"); 13 | INSERT INTO util_test.t1 VALUES ("05 Test Basic mod2 database example"); 14 | INSERT INTO util_test.t1 VALUES ("06 Test Basic database example"); 15 | INSERT INTO util_test.t1 VALUES ("08 Test Basic database example"); 16 | 17 | CREATE TABLE util_test.t2 (a char(30)) ENGINE=MYISAM; 18 | INSERT INTO util_test.t2 VALUES ("11 Test Basic database example"); 19 | INSERT INTO util_test.t2 VALUES ("12 modified Basic database example"); 20 | INSERT INTO util_test.t2 VALUES ("13 Test Basic database example"); 21 | 22 | CREATE TABLE util_test.t3 (a int not null auto_increment, d char(30), primary key(a)) ENGINE=MYISAM; 23 | INSERT INTO util_test.t3 (d) VALUES ("14 test fkeys"); 24 | INSERT INTO util_test.t3 (d) VALUES ("15 test fkeys"); 25 | INSERT INTO util_test.t3 (d) VALUES ("16 test fkeys"); 26 | 27 | CREATE TABLE util_test.t4 (c int not null, d int not null) ENGINE=MYISAM; 28 | INSERT INTO util_test.t4 VALUES (3, 2); 29 | 30 | CREATE PROCEDURE util_test.p1(p1 CHAR(20)) INSERT INTO util_test.t2 VALUES ("100"); 31 | 32 | CREATE TRIGGER util_test.trg BEFORE UPDATE ON util_test.t1 FOR EACH ROW INSERT INTO util_test.t1 VALUES('Wax on, wax off'); 33 | 34 | CREATE FUNCTION util_test.f1() RETURNS INT DETERMINISTIC RETURN (SELECT -1); 35 | 36 | CREATE VIEW util_test.v1 as SELECT * FROM util_test.t2; 37 | 38 | GRANT ALL ON util_test.* TO 'joe'@'user'; 39 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/suite/experimental/r/t2.result: -------------------------------------------------------------------------------- 1 | Line 1 2 | Line 2 3 | Line 3 4 | Line 4 5 | Line 5 6 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/suite/experimental/r/t4.result: -------------------------------------------------------------------------------- 1 | Wack-a-mole 1 2 | Wack-a-mole 2 3 | Wack-a-mole 3 4 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/suite/experimental/t/t1.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; version 2 of the License. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 16 | # 17 | import os 18 | import mutlib 19 | 20 | class test(mutlib.System_test): 21 | """Experimental test #1 22 | This is a demonstration of running a simple execution and supplying a 23 | test result file for comparison. This example compares return code only 24 | supplying a custom result to be displayed to the user on failure. 25 | """ 26 | 27 | def check_prerequisites(self): 28 | return self.check_num_servers(1) 29 | 30 | def setup(self): 31 | return True 32 | 33 | def run(self): 34 | # 35 | # Note: comment out the following line and uncomment the next line 36 | # to see an unsuccessful test run 37 | # 38 | cmd = "mysqlserverclone.py --help" 39 | #cmd = "NOTREALLYTHEREATALL!" 40 | self.result = self.exec_util(cmd, "./result.txt") 41 | return True 42 | 43 | def get_result(self): 44 | str = None 45 | if self.result != 0: 46 | str = "Unexpected return code: %d\n" % (self.result) 47 | return (self.result == 0, str) 48 | 49 | def record(self): 50 | # Not a comparative test, returning True 51 | return True 52 | 53 | def cleanup(self): 54 | os.unlink("./result.txt") 55 | return True 56 | 57 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/suite/experimental/t/t3.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; version 2 of the License. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 16 | # 17 | import mutlib 18 | 19 | class test(mutlib.System_test): 20 | """Experimental test #3 21 | This example tests the return codes for the methods. Uncomment out the 22 | False returns and comment out the True returns to see failed execution. 23 | """ 24 | 25 | def check_prerequisites(self): 26 | return True 27 | #return False 28 | 29 | def setup(self): 30 | return True 31 | #return False 32 | 33 | def run(self): 34 | return True 35 | #return False 36 | 37 | def get_result(self): 38 | return (True, None) 39 | #return (False, "Test message\nAnother test message\n") 40 | 41 | def record(self): 42 | # Not a comparative test, returning True 43 | return True 44 | #return False 45 | 46 | def cleanup(self): 47 | return True 48 | #return False 49 | 50 | 51 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/suite/experimental/t/t4.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; version 2 of the License. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 16 | # 17 | import t2 18 | 19 | class test(t2.test): 20 | """Experimental test #4 21 | This is a demonstration of how to reuse other tests to run additional 22 | test cases. This is a sample test using comparative results. 23 | In this test, we reuse the test 't2' and simulate running a different 24 | utility. We reuse the prerequisite, setup, and cleanup of t2. 25 | """ 26 | 27 | def check_prerequisites(self): 28 | return t2.test.check_prerequisites(self) 29 | 30 | def setup(self): 31 | return t2.test.setup(self) 32 | 33 | def run(self): 34 | 35 | # A result list will be generated here by the callee. 36 | self.ret_val = [] 37 | self.ret_val.append("Wack-a-mole 1\n") 38 | # Note: comment out the next line and uncomment out the following line 39 | # to see an unsuccessful test run 40 | self.ret_val.append("Wack-a-mole 2\n") 41 | #self.ret_val.append("Something hinky happened here\n") 42 | self.ret_val.append("Wack-a-mole 3\n") 43 | return True 44 | 45 | def get_result(self): 46 | return self.compare(__name__, self.ret_val) 47 | 48 | def record(self): 49 | return self.save_result_file(__name__, self.ret_val) 50 | 51 | def cleanup(self): 52 | return t2.test.cleanup(self) 53 | 54 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/suite/performance/r/copy_db_multithreaded.result: -------------------------------------------------------------------------------- 1 | Test case 1 - copy a sample database 2 | # Source on localhost: ... connected. 3 | # Destination on localhost: ... connected. 4 | # Copying database employees renamed as emp_mt 5 | # Copying TABLE employees.departments 6 | # Copying data for TABLE employees.departments 7 | # Copying TABLE employees.dept_emp 8 | # Copying data for TABLE employees.dept_emp 9 | # Copying TABLE employees.dept_manager 10 | # Copying data for TABLE employees.dept_manager 11 | # Copying TABLE employees.employees 12 | # Copying data for TABLE employees.employees 13 | # Copying TABLE employees.salaries 14 | # Copying data for TABLE employees.salaries 15 | # Copying TABLE employees.titles 16 | # Copying data for TABLE employees.titles 17 | #...done. 18 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/suite/replication/r/check_gtid_version.result: -------------------------------------------------------------------------------- 1 | Test case 1 attempt failed gtid version check 2 | # Source on localhost: ... connected. 3 | ERROR: The server localhost:XXXXX does not comply to the latest GTID feature support. Errors: 4 | Server version must be 5.6.9 or greater. 5 | Missing gtid_executed system variable. 6 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/suite/replication/r/check_rpl_errors.result: -------------------------------------------------------------------------------- 1 | Test case 1 - master parameter invalid 2 | Usage: mysqlrplcheck.py --master=root@localhost:3306 --slave=root@localhost:3310 3 | 4 | mysqlrplcheck.py: error: Master connection values invalid 5 | Test case 2 - slave parameter invalid 6 | Usage: mysqlrplcheck.py --master=root@localhost:3306 --slave=root@localhost:3310 7 | 8 | mysqlrplcheck.py: error: Slave connection values invalid 9 | Test case 3 - same server literal specification 10 | Usage: mysqlrplcheck.py --master=root@localhost:3306 --slave=root@localhost:3310 11 | 12 | mysqlrplcheck.py: error: The master and slave are the same host and port. 13 | Test case 4 - error: invalid login to server (master) 14 | # master on nada: ... ERROR: Cannot connect to the master server. 15 | Error ####: Can't connect to local MySQL server ####... 16 | Test case 5 - error: invalid login to server (slave) 17 | # master on localhost: ... connected. 18 | # slave on nada: ... ERROR: Cannot connect to the slave server. 19 | Error ####: Can't connect to local MySQL server ####... 20 | Test case 6 - master and slave same host 21 | Usage: mysqlrplcheck.py --master=root@localhost:3306 --slave=root@localhost:3310 22 | 23 | mysqlrplcheck.py: error: The master and slave are the same host and port. 24 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/suite/replication/r/clone_db_rpl_errors.result: -------------------------------------------------------------------------------- 1 | Test case 1 - error: --rpl-user=root but no --rpl 2 | Usage: mysqldbcopy.py --source=user:pass@host:port:socket --destination=user:pass@host:port:socket orig_db:new_db 3 | 4 | mysqldbcopy.py: error: You cannot use the --rpl option for copying on the same server. 5 | Test case 2 - error: using --rpl with cloning 6 | Usage: mysqldbcopy.py --source=user:pass@host:port:socket --destination=user:pass@host:port:socket orig_db:new_db 7 | 8 | mysqldbcopy.py: error: You cannot use the --rpl option for copying on the same server. 9 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/suite/replication/r/copy_db_gtid.result: -------------------------------------------------------------------------------- 1 | Test case 1 gtid->gtid 2 | # GTID operation: SET @MYSQLUTILS_TEMP_LOG_BIN = @@SESSION.SQL_LOG_BIN; 3 | # GTID operation: SET @@SESSION.SQL_LOG_BIN = 0; 4 | # GTID operation: SET @@GLOBAL.GTID_PURGED = ? 5 | # GTID operation: SET @@SESSION.SQL_LOG_BIN = @MYSQLUTILS_TEMP_LOG_BIN; 6 | Test case 2 gtid->non_gtid 7 | # WARNING: The destination server does not support GTIDs yet the source server does support GTIDs. To suppress this warning, use the --skip-gtid option when copying to a non-GTID enabled server. 8 | Test case 3 non_gtid->gtid 9 | # WARNING: The source server does not support GTIDs yet the destination server does support GTIDs. To suppress this warning, use the --skip-gtid option when copying from a non-GTID enabled server. 10 | Test case 4 partial backup 11 | # WARNING: A partial copy from a server that has GTIDs enabled will by default include the GTIDs of all transactions, even those that changed suppressed parts of the database. If you don't want to generate the GTID statement, use the --skip-gtid option. To export all databases, use the --all option and do not specify a list of databases. 12 | # GTID operation: SET @MYSQLUTILS_TEMP_LOG_BIN = @@SESSION.SQL_LOG_BIN; 13 | # GTID operation: SET @@SESSION.SQL_LOG_BIN = 0; 14 | # GTID operation: SET @@GLOBAL.GTID_PURGED = ? 15 | # GTID operation: SET @@SESSION.SQL_LOG_BIN = @MYSQLUTILS_TEMP_LOG_BIN; 16 | Test case 5 skip gtids 17 | # WARNING: The server supports GTIDs but you have elected to skip exexcuting the GTID_EXECUTED statement. Please refer to the MySQL online reference manual for more information about how to handle GTID enabled servers with backup and restore operations. 18 | Test case 6 gtid_executed error 19 | ERROR: The copy operation contains GTID statements that require the global gtid_executed system variable on the target to be empty (no value). The gtid_executed value must be reset by issuing a RESET MASTER command on the target prior to attempting the copy operation. Once the global gtid_executed value is cleared, you may retry the copy. 20 | Test case 7 fixed empty gtid_executed error 21 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/suite/replication/r/copy_db_rpl_errors.result: -------------------------------------------------------------------------------- 1 | Test case 1 - error: --rpl=both 2 | Usage: mysqldbcopy.py --source=user:pass@host:port:socket --destination=user:pass@host:port:socket orig_db:new_db 3 | 4 | mysqldbcopy.py: error: option --rpl: invalid choice: 'both' (choose from 'master', 'slave') 5 | Test case 2 - warning: --rpl-user missing 6 | # Source on localhost: ... connected. 7 | # Destination on localhost: ... connected. 8 | ERROR: No --rpl-user specified and multiple users found with replication privileges. 9 | Test case 3 - error: --rpl-user missing user 10 | # Source on localhost: ... connected. 11 | # Destination on localhost: ... connected. 12 | ERROR: The replication user missing@localhost was not found on localhost:PORT1. 13 | Test case 4 - error: --rpl-user missing privileges 14 | # Source on localhost: ... connected. 15 | # Destination on localhost: ... connected. 16 | ERROR: Replication user does not have the correct privilege. She needs 'REPLICATION SLAVE' on all replicated databases. 17 | Test case 5 - error: slave not connected 18 | # Source on localhost: ... connected. 19 | # Destination on localhost: ... connected. 20 | ERROR: Cannot generate CHANGE MASTER command. The slave is not connected to a master and no master information was provided. 21 | Test case 6 - error: no binlog 22 | # Source on localhost: ... connected. 23 | ERROR: Master must have binary logging turned on. 24 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/suite/replication/r/export_rpl_errors.result: -------------------------------------------------------------------------------- 1 | Test case 1 - error: --rpl-file=test.txt but no --rpl 2 | Usage: mysqldbexport.py --server=user:pass@host:port:socket db1, db2, db3 3 | 4 | mysqldbexport.py: error: The --rpl-file option must be used with the --rpl option. 5 | Test case 2 - error: --comment-rpl but no --rpl 6 | Usage: mysqldbexport.py --server=user:pass@host:port:socket db1, db2, db3 7 | 8 | mysqldbexport.py: error: The --comment-rpl option must be used with the --rpl option. 9 | Test case 3 - error: --rpl-user=root but no --rpl 10 | Usage: mysqldbexport.py --server=user:pass@host:port:socket db1, db2, db3 11 | 12 | mysqldbexport.py: error: The --rpl-user option must be used with the --rpl option. 13 | Test case 4 - error: --rpl-file=test.txt --comment-rpl --rpl-user=root but no --rpl 14 | Usage: mysqldbexport.py --server=user:pass@host:port:socket db1, db2, db3 15 | 16 | mysqldbexport.py: error: The --rpl-file, --rpl-user, --comment-rpl options must be used with the --rpl option. 17 | Test case 5 - error: --rpl-file bad path 18 | # Source on localhost: ... connected. 19 | ERROR: File inaccessible or bad path: /bad/path/not/there.atall 20 | Test case 6 - warning: --rpl-user missing 21 | # Source on localhost: ... connected. 22 | STOP SLAVE; 23 | #...done. 24 | # Connecting to the current server as master 25 | # WARNING: No --rpl-user specified and multiple users found with replication privileges. 26 | CHANGE MASTER 27 | START SLAVE; 28 | Test case 7 - error: --rpl-user missing user 29 | # Source on localhost: ... connected. 30 | ERROR: The replication user missing@localhost was not found on localhost:PORT1. 31 | Test case 8 - error: --rpl-user missing privileges 32 | # Source on localhost: ... connected. 33 | ERROR: Replication user does not have the correct privilege. She needs 'REPLICATION SLAVE' on all replicated databases. 34 | Test case 9 - error: slave not connected 35 | # Source on localhost: ... connected. 36 | ERROR: Cannot generate CHANGE MASTER command. The slave is not connected to a master and no master information was provided. 37 | Test case 10 - error: no binlog 38 | # Source on localhost: ... connected. 39 | ERROR: Master must have binary logging turned on. 40 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/suite/replication/r/failover_errors.result: -------------------------------------------------------------------------------- 1 | Test case 1 - No master 2 | Usage: mysqlfailover.py --master=root@localhost --discover-slaves-login=root --candidates=root@host123:3306,root@host456:3306 3 | 4 | mysqlfailover.py: error: You must specify a master to monitor. 5 | Test case 2 - No slaves or discover-slaves-login 6 | Usage: mysqlfailover.py --master=root@localhost --discover-slaves-login=root --candidates=root@host123:3306,root@host456:3306 7 | 8 | mysqlfailover.py: error: You must supply a list of slaves or the --discover-slaves-login option. 9 | Test case 3 - Low value for interval. 10 | Usage: mysqlfailover.py --master=root@localhost --discover-slaves-login=root --candidates=root@host123:3306,root@host456:3306 11 | 12 | mysqlfailover.py: error: The --interval option requires a value greater than or equal to 5. 13 | Test case 4 - elect mode but no candidates 14 | Usage: mysqlfailover.py --master=root@localhost --discover-slaves-login=root --candidates=root@host123:3306,root@host456:3306 15 | 16 | mysqlfailover.py: error: Failover mode = 'elect' reqiures at least one candidate. 17 | Test case 5 - FILE/TABLE mix and missing --rpl-user 18 | NOTE: Log file 'a.txt' does not exist. Will be created. 19 | # Checking privileges. 20 | ERROR: Failover requires --master-info-repository=TABLE for all slaves. 21 | Test case 6 - Master listed as a slave - literal 22 | Usage: mysqlfailover.py --master=root@localhost --discover-slaves-login=root --candidates=root@host123:3306,root@host456:3306 23 | 24 | mysqlfailover.py: error: The master and one of the slaves are the same host and port. 25 | Test case 7 - Master listed as a slave - alias 26 | Usage: mysqlfailover.py --master=root@localhost --discover-slaves-login=root --candidates=root@host123:3306,root@host456:3306 27 | 28 | mysqlfailover.py: error: The master and one of the slaves are the same host and port. 29 | Test case 8 - Master listed as a candiate - alias 30 | Usage: mysqlfailover.py --master=root@localhost --discover-slaves-login=root --candidates=root@host123:3306,root@host456:3306 31 | 32 | mysqlfailover.py: error: The master and one of the candidates are the same host and port. 33 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/suite/replication/r/gtid_no_password.result: -------------------------------------------------------------------------------- 1 | +------------+-------+---------+--------+------------+---------+ 2 | | host | port | role | state | gtid_mode | health | 3 | +------------+-------+---------+--------+------------+---------+ 4 | | localhost | PORT1 | MASTER | UP | ON | OK | 5 | | localhost | PORT2 | SLAVE | UP | ON | OK | 6 | +------------+-------+---------+--------+------------+---------+ 7 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/suite/replication/r/rpl_admin_logfile.result: -------------------------------------------------------------------------------- 1 | Test Case 1 - Log file is newly created 2 | NOTE: Log file 'temp_log.txt' does not exist. Will be created. 3 | # Checking privileges. 4 | # 5 | # Replication Topology Health: 6 | +------------+-------+---------+--------+------------+---------+ 7 | | host | port | role | state | gtid_mode | health | 8 | +------------+-------+---------+--------+------------+---------+ 9 | | localhost | PORT1 | MASTER | UP | NO | OK | 10 | | localhost | PORT2 | SLAVE | UP | NO | OK | 11 | +------------+-------+---------+--------+------------+---------+ 12 | # ...done. 13 | Test Case 2 - Log file is reopened 14 | # Checking privileges. 15 | # 16 | # Replication Topology Health: 17 | +------------+-------+---------+--------+------------+---------+ 18 | | host | port | role | state | gtid_mode | health | 19 | +------------+-------+---------+--------+------------+---------+ 20 | | localhost | PORT1 | MASTER | UP | NO | OK | 21 | | localhost | PORT2 | SLAVE | UP | NO | OK | 22 | +------------+-------+---------+--------+------------+---------+ 23 | # ...done. 24 | Test Case 3 - Log file can not be written to 25 | Usage: mysqlrpladmin.py --slaves=root@localhost:3306 26 | 27 | mysqlrpladmin.py: error: Error opening log file: Permission denied 28 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/suite/replication/r/rpl_admin_warnings.result: -------------------------------------------------------------------------------- 1 | Test case 1 - warning for --exec* and not switchover or failover 2 | WARNING: The --exec-* options are used only with the failover and switchover commands. 3 | host,port,role,state,gtid_mode,health 4 | localhost,PORT1,MASTER,UP,OFF,OK 5 | localhost,PORT2,SLAVE,UP,OFF,OK 6 | localhost,PORT3,SLAVE,UP,OFF,OK 7 | localhost,PORT4,SLAVE,UP,OFF,OK 8 | Test case 2 - warning for --candidate and not switchover 9 | WARNING: The --candidates option is used only with the failover and elect commands. 10 | host,port,role,state,gtid_mode,health 11 | localhost,PORT1,MASTER,UP,OFF,OK 12 | localhost,PORT2,SLAVE,UP,OFF,OK 13 | localhost,PORT3,SLAVE,UP,OFF,OK 14 | localhost,PORT4,SLAVE,UP,OFF,OK 15 | Test case 3 - warning for --new-master and not switchover 16 | WARNING: The --new-master option is used only with the switchover command. 17 | host port role state gtid_mode health 18 | localhost PORT1 MASTER UP OFF OK 19 | localhost PORT2 SLAVE UP OFF OK 20 | localhost PORT3 SLAVE UP OFF OK 21 | localhost PORT4 SLAVE UP OFF OK 22 | Test case 4 - warning for missing --report-host 23 | # Discovering slaves for master at localhost:PORT1 24 | WARNING: There are slaves that have not been registered with --report-host or --report-port. 25 | # Checking privileges. 26 | # 27 | # Replication Topology Health: 28 | host,port,role,state,gtid_mode,health 29 | localhost,PORT1,MASTER,UP,OFF,OK 30 | localhost,PORT2,SLAVE,UP,OFF,OK 31 | localhost,PORT3,SLAVE,UP,OFF,OK 32 | localhost,PORT4,SLAVE,UP,OFF,OK 33 | # ...done. 34 | Test case 5 - warning for --format and not health or gtid 35 | WARNING: The --format option is used only with the health and gtid commands. 36 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/suite/replication/r/show_rpl_errors.result: -------------------------------------------------------------------------------- 1 | Test case 1 - error: cannot parse master string 2 | Usage: mysqlrplshow.py --master=root@localhost:3306 3 | 4 | mysqlrplshow.py: error: Master connection values invalid 5 | Test case 2 - error: invalid login to master 6 | # master on localhost: ... FAILED. 7 | 8 | ERROR: Cannot connect to the master server. 9 | Error 1045: Access denied for user 'wanda'@'localhost' (using password: YES) 10 | Test case 3 - show topology - bad format 11 | Usage: mysqlrplshow.py --master=root@localhost:3306 12 | 13 | mysqlrplshow.py: error: option --format: invalid choice: 'XXXXXX' (choose from 'grid', 'tab', 'csv', 'vertical') 14 | Test case 4a - show topology - not enough permissions 15 | # master on localhost: ... connected. 16 | ERROR: Not enough permissions. The user must have the REPLICATION SLAVE privilege. 17 | Test case 4b - show topology - not enough permissions 18 | # master on localhost: ... connected. 19 | # Finding slaves for master: localhost:PORT2 20 | # master on localhost: ... connected. 21 | # Finding slaves for master: localhost:PORT1 22 | 23 | # Replication Topology Graph 24 | localhost:PORT2 (MASTER) 25 | | 26 | +--- localhost:PORT1 - (SLAVE) 27 | 28 | +-----------------+-----------------+ 29 | | Master | Slave | 30 | +-----------------+-----------------+ 31 | | localhost:PORT2 | localhost:PORT1 | 32 | +-----------------+-----------------+ 33 | Test case 5 - show topology - bad max-depth 34 | Usage: mysqlrplshow.py --master=root@localhost:3306 35 | 36 | mysqlrplshow.py: error: The --max-depth option needs to be >= 0. 37 | Test case 6 - show topology - large max-depth 38 | # master on localhost: ... connected. 39 | # Finding slaves for master: localhost:PORT2 40 | # master on localhost: ... connected. 41 | # Finding slaves for master: localhost:PORT1 42 | 43 | # Replication Topology Graph 44 | localhost:PORT2 (MASTER) 45 | | 46 | +--- localhost:PORT1 - (SLAVE) 47 | 48 | +-----------------+-----------------+ 49 | | Master | Slave | 50 | +-----------------+-----------------+ 51 | | localhost:PORT2 | localhost:PORT1 | 52 | +-----------------+-----------------+ 53 | Test case 7 - show topology - discover-slaves-login missing 54 | Usage: mysqlrplshow.py --master=root@localhost:3306 55 | 56 | mysqlrplshow.py: error: The --discover-slaves-login is required to test slave connectivity. 57 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/suite/replication/r/show_rpl_warnings.result: -------------------------------------------------------------------------------- 1 | Test case 1 - warning for missing --report-host 2 | # master on localhost: ... connected. 3 | # Finding slaves for master: localhost:PORT1 4 | WARNING: There are slaves that have not been registered with --report-host or --report-port. 5 | 6 | # Replication Topology Graph 7 | localhost:PORT1 (MASTER) 8 | | 9 | +--- localhost:PORT2 - (SLAVE) 10 | | 11 | +--- localhost:PORT3 - (SLAVE) 12 | | 13 | +--- localhost:PORT4 - (SLAVE) 14 | 15 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/suite/replication/t/failover_parameters.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; version 2 of the License. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 16 | # 17 | import os 18 | import mutlib 19 | from mysql.utilities.exception import MUTLibError 20 | 21 | class test(mutlib.System_test): 22 | """test replication failover utility 23 | This test runs the mysqlfailover utility parameters on a known topology. 24 | """ 25 | 26 | def check_prerequisites(self): 27 | return self.check_num_servers(1) 28 | 29 | def setup(self): 30 | return True 31 | 32 | def run(self): 33 | self.res_fname = "result.txt" 34 | 35 | cmd_str = "mysqlfailover.py " 36 | 37 | comment = "Test case 1 - show help" 38 | cmd_opts = " --help" 39 | res = mutlib.System_test.run_test_case(self, 0, cmd_str+cmd_opts, 40 | comment) 41 | if not res: 42 | raise MUTLibError("%s: failed" % comment) 43 | 44 | return True 45 | 46 | def get_result(self): 47 | return self.compare(__name__, self.results) 48 | 49 | def record(self): 50 | return self.save_result_file(__name__, self.results) 51 | 52 | def cleanup(self): 53 | if self.res_fname: 54 | try: 55 | os.unlink(self.res_fname) 56 | except: 57 | pass 58 | return True 59 | 60 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql-test/t/__init__.py: -------------------------------------------------------------------------------- 1 | from mutlib.mutlib import Server_list 2 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mysqlTools/mysql_utilities/mysql/__init__.py -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mysqlTools/mysql_utilities/mysql/__init__.pyc -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql/utilities/__init__.py: -------------------------------------------------------------------------------- 1 | # Major, Minor, Patch, Status 2 | VERSION = (1, 2, 1, "", 5, 2, 47) 3 | VERSION_STRING = "%s.%s.%s%s - MySQL Workbench Distribution %s.%s.%s" % VERSION 4 | RELEASE_STRING = "%s.%s.%s%s - MySQL Workbench Distribution %s.%s.%s" % VERSION 5 | COPYRIGHT = "2010, 2013 Oracle and/or its affiliates. All rights reserved." 6 | COPYRIGHT_FULL = "Copyright (c) " + COPYRIGHT + """ 7 | This is a release of dual licensed MySQL Utilities. For the avoidance of 8 | doubt, this particular copy of the software is released 9 | under the version 2 of the GNU General Public License. 10 | MySQL Utilities is brought to you by Oracle. 11 | """ 12 | VERSION_FRM = ("MySQL Utilities {program} version " + RELEASE_STRING 13 | + "\n" + COPYRIGHT_FULL) 14 | PYTHON_MIN_VERSION = (2, 6, 0) 15 | PYTHON_MAX_VERSION = (3, 0, 0) 16 | -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql/utilities/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mysqlTools/mysql_utilities/mysql/utilities/__init__.pyc -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql/utilities/command/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mysqlTools/mysql_utilities/mysql/utilities/command/__init__.py -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql/utilities/common/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mysqlTools/mysql_utilities/mysql/utilities/common/__init__.py -------------------------------------------------------------------------------- /mysqlTools/mysql_utilities/mysql/utilities/common/pattern_matching.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; version 2 of the License. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 16 | # 17 | 18 | """ 19 | This file contains auxiliary functions to handle pattern matching. 20 | """ 21 | 22 | import re 23 | 24 | 25 | def convertSQL_LIKE2REGEXP(sql_like_pattern): 26 | """Convert a standard SQL LIKE pattern to a REGEXP pattern. 27 | 28 | Function that transforms a SQL LIKE pattern to a supported python 29 | regexp. Returns a python regular expression (i.e. regexp). 30 | 31 | sql_like_pattern[in] pattern in the SQL LIKE form to be converted. 32 | """ 33 | # Replace '_' by equivalent regexp, except when precede by '\' 34 | # (escape character) 35 | regexp = re.sub(r'(? 24 | 18:00:33 26749 1972 multilog 25 | 18:00:33 26749 1972 multilog 26 | 18:00:33 26751 ? mkdir 27 | 18:00:33 26749 1972 multilog 28 | 18:00:33 26752 ? chown 29 | 18:00:33 26750 1961 multilog 30 | 18:00:33 26750 1961 multilog 31 | 18:00:34 26753 1961 multilog 32 | 18:00:34 26754 1972 multilog 33 | [...] 34 | 35 | This will be fixed in a later version, but likely requires some kernel or 36 | tracer changes first (fetching cmdline as the probe fires). 37 | 38 | 39 | The previous examples were on Linux 3.14 and 3.16 kernels. Here's a 3.2 system 40 | I'm running: 41 | 42 | # ./execsnoop 43 | ERROR: enabling tracepoint "sched:sched_process_exec" (tracepoint missing in this kernel version?) at ./execsnoop line 78. 44 | 45 | This kernel version is missing the sched_process_exec probe, which is pretty 46 | annoying. 47 | -------------------------------------------------------------------------------- /osperftools/examples/opensnoop_example.txt: -------------------------------------------------------------------------------- 1 | Demonstrations of opensnoop, the Linux ftrace version. 2 | 3 | 4 | # ./opensnoop 5 | Tracing open()s. Ctrl-C to end. 6 | COMM PID FD FILE 7 | opensnoop 5334 0x3 8 | <...> 5343 0x3 /etc/ld.so.cache 9 | opensnoop 5342 0x3 /etc/ld.so.cache 10 | <...> 5343 0x3 /lib/x86_64-linux-gnu/libc.so.6 11 | opensnoop 5342 0x3 /lib/x86_64-linux-gnu/libm.so.6 12 | opensnoop 5342 0x3 /lib/x86_64-linux-gnu/libc.so.6 13 | <...> 5343 0x3 /usr/lib/locale/locale-archive 14 | <...> 5343 0x3 trace_pipe 15 | supervise 1684 0x9 supervise/status.new 16 | supervise 1684 0x9 supervise/status.new 17 | supervise 1688 0x9 supervise/status.new 18 | supervise 1688 0x9 supervise/status.new 19 | supervise 1686 0x9 supervise/status.new 20 | supervise 1685 0x9 supervise/status.new 21 | supervise 1685 0x9 supervise/status.new 22 | supervise 1686 0x9 supervise/status.new 23 | [...] 24 | 25 | The first several lines show opensnoop catching itself initializing. 26 | 27 | 28 | Use -h to print the USAGE message: 29 | 30 | # ./opensnoop -h 31 | USAGE: opensnoop [-htx] [-d secs] [-p PID] [-T TID] [-n name] [filename] 32 | -d seconds # trace duration, and use buffers 33 | -n name # process name to match on open 34 | -p PID # PID to match on open 35 | -L TID # thread id to match on open 36 | -t # include time (seconds) 37 | -x # only show failed opens 38 | -h # this usage message 39 | filename # match filename (partials, REs, ok) 40 | eg, 41 | opensnoop # watch open()s live (unbuffered) 42 | opensnoop -d 1 # trace 1 sec (buffered) 43 | opensnoop -p 181 # trace I/O issued by PID 181 only 44 | opensnoop conf # trace filenames containing "conf" 45 | opensnoop 'log$' # filenames ending in "log" 46 | 47 | See the man page and example file for more info. 48 | -------------------------------------------------------------------------------- /osperftools/images/perf-tools_2016.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/osperftools/images/perf-tools_2016.png -------------------------------------------------------------------------------- /osperftools/man/man8/funccount.8: -------------------------------------------------------------------------------- 1 | .TH funccount 8 "2014-07-19" "USER COMMANDS" 2 | .SH NAME 3 | funccount \- count kernel function calls matching specified wildcards. Uses Linux ftrace. 4 | .SH SYNOPSIS 5 | .B funccount 6 | [\-hT] [\-i secs] [\-d secs] [\-t top] funcstring 7 | .SH DESCRIPTION 8 | This tool is a quick way to determine which kernel functions are being called, 9 | and at what rate. It uses ftrace function profiling capabilities. 10 | 11 | WARNING: This uses dynamic tracing of (what can be many) kernel functions, 12 | and could cause kernel panics or freezes. Test, and know what you are doing, 13 | before use. 14 | 15 | Since this uses ftrace, only the root user can use this tool. 16 | .SH REQUIREMENTS 17 | CONFIG_FUNCTION_PROFILER, which you may already have enabled and available on 18 | recent kernels, and awk. 19 | .SH OPTIONS 20 | \-d seconds 21 | Total duration of the trace. 22 | .TP 23 | \-h 24 | Print usage message. 25 | .TP 26 | \-i seconds 27 | Print an interval summary every so many seconds. 28 | .TP 29 | \-t top 30 | Print top number of entries only. 31 | .TP 32 | \-T 33 | Include timestamp on each summary. 34 | .TP 35 | funcstring 36 | A function name to trace, which may include file glob style wildcards ("*") at 37 | the beginning or ending of a string only. Eg, "vfs*" means match "vfs" followed 38 | by anything. 39 | .SH EXAMPLES 40 | .TP 41 | Count every kernel function beginning with "bio_", until Ctrl-C is hit: 42 | # 43 | .B funccount 'bio_*' 44 | .TP 45 | Count every "tcp_*" kernel function, and print a summary every one second, five in total: 46 | # 47 | .B funccount \-i 1 \-d 5 'tcp_*' 48 | .TP 49 | Count every "ext4*" kernel function, and print the top 20 when Ctrl-C is hit: 50 | # 51 | .B funccount \-t 20 'ext4*' 52 | .SH FIELDS 53 | .TP 54 | FUNC 55 | Kernel function name. 56 | .TP 57 | COUNT 58 | Number of times this function was called during the tracing interval. 59 | .SH OVERHEAD 60 | This uses the ftrace profiling framework, which does in-kernel counts, 61 | lowering the overhead (compared to tracing each event). 62 | .SH SOURCE 63 | This is from the perf-tools collection: 64 | .IP 65 | https://github.com/brendangregg/perf-tools 66 | .PP 67 | Also look under the examples directory for a text file containing example 68 | usage, output, and commentary for this tool. 69 | .SH OS 70 | Linux 71 | .SH STABILITY 72 | Unstable - in development. 73 | .SH AUTHOR 74 | Brendan Gregg 75 | .SH SEE ALSO 76 | functrace(8) 77 | -------------------------------------------------------------------------------- /osperftools/man/man8/reset-ftrace.8: -------------------------------------------------------------------------------- 1 | .TH reset-ftrace 8 "2014-07-07" "USER COMMANDS" 2 | .SH NAME 3 | reset-ftrace \- reset state of ftrace, disabling all tracing. Written for Linux ftrace. 4 | .SH SYNOPSIS 5 | .B reset-ftrace 6 | [\-fhq] 7 | .SH DESCRIPTION 8 | This resets the state of various ftrace files, and shows the before and after 9 | state. 10 | 11 | This may only be of use to ftrace hackers who, in the process of developing 12 | ftrace software, often get the subsystem into a partially active state, and 13 | would like a quick way to reset state. Check the end of this script for the 14 | actually files reset, and add more if you need. 15 | 16 | WARNING: Only use this if and when you are sure that there are no other active 17 | ftrace sessions on your system, as otherwise it will kill them. 18 | .SH REQUIREMENTS 19 | FTRACE CONFIG. 20 | .SH OPTIONS 21 | .TP 22 | \-f 23 | Force. If the ftrace lock file exists (/var/tmp/.ftrace-lock), delete it. 24 | .TP 25 | \-h 26 | Print usage message. 27 | .TP 28 | \-q 29 | Quiet. Run, but don't print any output. 30 | .SH EXAMPLES 31 | .TP 32 | Reset various ftrace files: 33 | # 34 | .B reset-ftrace 35 | .SH SOURCE 36 | This is from the perf-tools collection. 37 | .IP 38 | https://github.com/brendangregg/perf-tools 39 | .PP 40 | Also look under the examples directory for a text file containing example 41 | usage, output, and commentary for this tool. 42 | .SH OS 43 | Linux 44 | .SH STABILITY 45 | Unstable - in development. 46 | .SH AUTHOR 47 | Brendan Gregg 48 | .SH SEE ALSO 49 | perf(1) 50 | -------------------------------------------------------------------------------- /redisTools/README.me: -------------------------------------------------------------------------------- 1 | ##大key分析 2 | ##流量分析 3 | ##热key分析 4 | ##key分布(类型分布,过期/永久存储) 5 | 6 | ## Key聚合分析 : 可以用来做redis key 的生命周期管理使用 : https://github.com/xiepaup/redis-key-partten 7 | -------------------------------------------------------------------------------- /redisTools/goopsrc/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Copyright © 2018 xiepaup, 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of 5 | this software and associated documentation files (the “Software”), to deal in 6 | the Software without restriction, including without limitation the rights to 7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 8 | the Software, and to permit persons to whom the Software is furnished to do so, 9 | subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | IN THE SOFTWARE. 21 | 22 | 23 | -------------------------------------------------------------------------------- /redisTools/goopsrc/aof/aof_test.go: -------------------------------------------------------------------------------- 1 | package aof 2 | 3 | import ( 4 | "testing" 5 | "fmt" 6 | ) 7 | 8 | /** 9 | * 10 | * Author : xiepaup 11 | * EMail : xiepaup@163.com 12 | * Date : 2018-06-02 13 | * Project : redisTools 14 | **/ 15 | 16 | 17 | func TestAOFContext_GetBigestTopKey(t *testing.T) { 18 | fmt.Println("this is unit test for aof of top n keys ...") 19 | aof,err := NewAOFContext("../test/redis-appendonly.aof") 20 | if err != nil{ 21 | panic(fmt.Sprintf("init error : %s",err)) 22 | } 23 | aof.SetStatTypeBySize(true) 24 | aof.GetBiggestTopKeys(10) 25 | //aof.GetBiggestTopKeys(10) 26 | } -------------------------------------------------------------------------------- /redisTools/goopsrc/aof/aof_tools.go: -------------------------------------------------------------------------------- 1 | package aof 2 | 3 | 4 | import ( 5 | "strings" 6 | ) 7 | /** 8 | * 9 | * Author : xiean 10 | * EMail : xiepaup@163.com 11 | * Date : 2018-06-02 12 | * Project : redisTools 13 | **/ 14 | 15 | 16 | 17 | 18 | 19 | 20 | func CommandsOpsAllTypes(cmd string) bool{ 21 | REDIS_UNIVERS_COMMANDS := [...]string{"DEL"} 22 | for _,c := range REDIS_UNIVERS_COMMANDS { 23 | if strings.Compare(c,cmd) == 0 { 24 | return true 25 | } 26 | } 27 | return false 28 | } 29 | 30 | func CommandOpsStringType(cmd string) bool { 31 | REDIS_STRING_COMMANDS := [...]string{"SET", "GETSET", 32 | "SETBIT", "SETEX", "SETNX", "SETRANGE", 33 | "MSET", "MSETNX", "PSETEX", "INCR", "INCRBY", "INCRBYFOLAT", "DECR", "DECRBY", "APPEND"} 34 | for _,c := range REDIS_STRING_COMMANDS { 35 | if strings.Compare(c,cmd) == 0 { 36 | return true 37 | } 38 | } 39 | return false 40 | } 41 | 42 | func CommandOpsListType(cmd string) bool { 43 | REDIS_LIST_COMMANDS := [...]string{"LPUSH", "RPUSH", "LPOP", "RPOP", "LREM", "LSET", 44 | "LTRIM", "RPOPLPUSH", "LINSERT", "LPUSHX", "RPUSHX"} 45 | 46 | for _,c := range REDIS_LIST_COMMANDS { 47 | if strings.Compare(c,cmd) == 0 { 48 | return true 49 | } 50 | } 51 | return false 52 | } 53 | 54 | func CommandOpsHashType(cmd string) bool { 55 | REDIS_HASH_COMMANDS := [...]string{"HDEL", "HSET", "HICRBY", "HINCRBYFLOAT", "HMSET", "HSETNX"} 56 | for _,c := range REDIS_HASH_COMMANDS { 57 | if strings.Compare(c,cmd) == 0 { 58 | return true 59 | } 60 | } 61 | return false 62 | } 63 | 64 | func CommandOpsSetType(cmd string) bool { 65 | REDIS_SET_COMMANDS := [...]string{"SADD", "SREM", "SDIFFSTROE", "SINTERSTROE", "SUNIONSTROE", "SPOP", "SMOVE", "SPOP"} 66 | for _,c := range REDIS_SET_COMMANDS { 67 | if strings.Compare(c,cmd) == 0 { 68 | return true 69 | } 70 | } 71 | return false 72 | } 73 | 74 | func CommandOpsZSetType(cmd string) bool { 75 | REDIS_ZSET_COMMANDS := [...]string{"ZADD", "ZINCRBY", "ZREM", "ZREMRANGEBYLEX", "ZREMRANGEBYRANK", "ZREMRANGEBYSCORE", "ZINTERSTORE"} 76 | 77 | for _,c := range REDIS_ZSET_COMMANDS { 78 | if strings.Compare(c,cmd) == 0 { 79 | return true 80 | } 81 | } 82 | return false 83 | } -------------------------------------------------------------------------------- /redisTools/goopsrc/aof/string_cmd_parse.go: -------------------------------------------------------------------------------- 1 | package aof 2 | 3 | import ( 4 | "fmt" 5 | "strconv" 6 | ) 7 | 8 | /** 9 | * 10 | * Author : xiean 11 | * EMail : xiepaup@163.com 12 | * Date : 2018-07-07 13 | * Project : OPS-Tools 14 | **/ 15 | 16 | 17 | func (this *AOFContext) cmdDoStringType(db string, baseCmd string, baseKey string, args []string) { 18 | stringMap := this.SimpleKeys[db].StringKeys 19 | strVal := args[1] 20 | klen := int64(len(baseKey)) 21 | vlen := int64(len(strVal)) 22 | 23 | // SETBIT key bits 0/1 24 | if baseCmd == "SETBIT" { 25 | setBitsN, _ := strconv.Atoi(strVal) 26 | if kv, ok := stringMap[baseKey]; ok { 27 | setBitsN64 := int64(setBitsN) 28 | vHasBits := kv.ValueLen * 8 29 | if setBitsN64 > vHasBits { 30 | tx := (setBitsN64 - vHasBits) / 8 31 | ty := (setBitsN64 - vHasBits) % 8 32 | if ty > 0 { 33 | vlen = tx + 1 + kv.ValueLen 34 | } else { 35 | vlen = tx + kv.ValueLen 36 | } 37 | } else { 38 | vlen = kv.ValueLen 39 | } 40 | } else { 41 | vlen = int64(setBitsN / 8) 42 | if setBitsN%8 != 0 { 43 | vlen += int64(1) 44 | } 45 | //fmt.Println(fmt.Sprintf("set k :%d,v:%d,%d,%s,%#v", klen, vlen, setBitsN, strVal, args)) 46 | stringMap[baseKey] = NewStringMap(klen, vlen) 47 | } 48 | } 49 | // SET ,SETEX,SETNX,GETSET, 50 | if kv, ok := stringMap[baseKey]; ok { 51 | kv.ValueLen = vlen 52 | kv.KeyLen = klen 53 | } else { 54 | stringMap[baseKey] = NewStringMap(klen, vlen) 55 | } 56 | 57 | //"INCR", "INCRBY", "INCRBYFOLAT", "DECR", "DECRBY" ---> valueLen to int64-->8 58 | if baseCmd == "INCR" || baseCmd == "INCRBY" || baseCmd == "INCRBYFOLAT" || baseCmd == "DECR" || baseCmd == "DECRBY" { 59 | vlen = 8 60 | } 61 | //MSET ,MSETNX 62 | if baseCmd == "MSET" || baseCmd == "MSETNX" { 63 | mkvLen := len(args) 64 | if mkvLen%2 != 0 { 65 | fmt.Println(fmt.Sprintf("bad MSET/MSETNX %v", args)) 66 | return 67 | } 68 | for i := 0; i < mkvLen; i += 2 { 69 | k := args[i] 70 | v := args[i+1] 71 | klen = int64(len(k)) 72 | vlen = int64(len(v)) 73 | if kv, ok := stringMap[baseKey]; ok { 74 | kv.ValueLen = vlen 75 | kv.KeyLen = klen 76 | } else { 77 | stringMap[baseKey] = NewStringMap(klen, vlen) 78 | } 79 | } 80 | } 81 | // APPEND 82 | if baseCmd == "APPEND" { 83 | if kv, ok := stringMap[baseKey]; ok { 84 | vlen += kv.ValueLen + vlen 85 | } 86 | } 87 | 88 | } 89 | 90 | -------------------------------------------------------------------------------- /redisTools/goopsrc/aof/zset_cmd_parse.go: -------------------------------------------------------------------------------- 1 | package aof 2 | 3 | import "fmt" 4 | 5 | /** 6 | * 7 | * Author : xiean 8 | * EMail : xiepaup@163.com 9 | * Date : 2018-07-07 10 | * Project : OPS-Tools 11 | **/ 12 | 13 | 14 | func (this *AOFContext) cmdDoZSetType(db string, baseCmd string, baseKey string, args []string) { 15 | if _, ok := this.SimpleKeys[db]; ok { 16 | //TODO 17 | fmt.Println(fmt.Sprintf("unsupport ZSET : %s,for %s %s %#v", db, baseCmd, baseKey, args)) 18 | } else { 19 | fmt.Println(fmt.Sprintf("unkonw db : %s,for %s %s %#v", db, baseCmd, baseKey, args)) 20 | } 21 | } -------------------------------------------------------------------------------- /redisTools/goopsrc/cmd/redisDBATools.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | /** 4 | * 5 | * Author : xiepaup 6 | * EMail : xiepaup@163.com 7 | * Date : 2018-06-02 8 | * Project : redisTools 9 | **/ 10 | 11 | 12 | -------------------------------------------------------------------------------- /redisTools/goopsrc/test/redis-appendonly.aof: -------------------------------------------------------------------------------- 1 | *2 2 | $6 3 | SELECT 4 | $1 5 | 0 6 | *3 7 | $3 8 | set 9 | $7 10 | vitodb1 11 | $11 12 | value|1|2|3 13 | *2 14 | $6 15 | SELECT 16 | $1 17 | 2 18 | *3 19 | $3 20 | set 21 | $7 22 | vitodb2 23 | $10 24 | value2|3|4 25 | *2 26 | $3 27 | del 28 | $7 29 | vitodb2 30 | *2 31 | $6 32 | SELECT 33 | $1 34 | 0 35 | *2 36 | $3 37 | del 38 | $7 39 | vitodb1 40 | *3 41 | $3 42 | set 43 | $11 44 | vitostrkey1 45 | $14 46 | valuestrvalue1 47 | *3 48 | $3 49 | set 50 | $11 51 | vitostrkey2 52 | $14 53 | valuestrvalue2 54 | *8 55 | $5 56 | hmset 57 | $9 58 | vitohash1 59 | $6 60 | shkey1 61 | $8 62 | shvalue1 63 | $6 64 | shkey2 65 | $8 66 | shvalue2 67 | $6 68 | shkey3 69 | $8 70 | shvalue3 71 | *2 72 | $3 73 | del 74 | $11 75 | vitostrkey2 76 | *2 77 | $3 78 | del 79 | $9 80 | vitohash1 81 | *2 82 | $3 83 | del 84 | $11 85 | vitostrkey1 86 | *6 87 | $5 88 | hmset 89 | $9 90 | vitohash1 91 | $6 92 | shkey1 93 | $8 94 | shvalue1 95 | $6 96 | shkey2 97 | $9 98 | shavelue2 99 | *3 100 | $3 101 | set 102 | $8 103 | vitostr1 104 | $9 105 | strvalue1 106 | *3 107 | $3 108 | set 109 | $8 110 | vitostr2 111 | $9 112 | strvalue2 113 | *4 114 | $4 115 | hset 116 | $9 117 | vitohash1 118 | $6 119 | shkey2 120 | $14 121 | xxmodifyvalue2 122 | *4 123 | $4 124 | hset 125 | $9 126 | vitohash1 127 | $6 128 | shkey3 129 | $12 130 | addmorevalue 131 | *4 132 | $6 133 | SETbit 134 | $7 135 | vitobit 136 | $2 137 | 10 138 | $1 139 | 1 140 | *2 141 | $6 142 | SELECT 143 | $1 144 | 5 145 | *4 146 | $4 147 | hset 148 | $9 149 | vitohashdb5_hash 150 | $6 151 | shkey1 152 | $12 153 | addmorevallllllue -------------------------------------------------------------------------------- /redisTools/goopsrc/test/redis-dump.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/redisTools/goopsrc/test/redis-dump.rdb -------------------------------------------------------------------------------- /redisTools/redis-cli-new: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiepaup/dbatools/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/redisTools/redis-cli-new -------------------------------------------------------------------------------- /redisTools/redisHealthy/README.me: -------------------------------------------------------------------------------- 1 | # TODO FUNC: 2 | 3 | 4 | ## Requirement: 5 | 1. can control 6 | -- 可以指定延迟启动时间,即多久以后启动 7 | -- 可以指定运行时长,即什么时候结束 8 | -- 监控 redis 内存增量情况,如果在运行monitor过程中发现redis内存暴涨,那么结束本次运行 9 | -- 监控 redis 负载 QPS ,超过一定阈值 ,结束本次运行? (感觉使用内存监控比较好) 10 | 2. 关注宏观层面 11 | -- 流量分析 12 | -- 总体概况, 写入流量(去掉查询流量); 读取流量(去slave查询?value值?) 13 | 14 | -- 请求类型分析 15 | -- 总体概况, 读写比例 16 | -- 各种类型KEY操作占比 17 | -- 请求类型 业务类型分析? (通过分隔符智能判断?) 18 | 3. 注意细节处理 19 | -- 特别注意 Append 指令 20 | -- 特别注意 value 超过 1k 的请求 21 | -- 特别注意 mget、hmget 这种 mutil 请求 数量超过 【 30 】个(放大30倍)? 22 | -- 特别注意 hgetall、lrange 0 N 、zrangebyscore 等 获取全部数据的key 23 | -- 如果hgetall 返回数据只是单个field ,这样存在优化空间, 建议转化成string类型存储 24 | 25 | 26 | ## Implement: 27 | 28 | 1. 1:N 生产消费模式 29 | 2. 3层 控制, 控制层,逻辑层,存储层 30 | 31 | 32 | 33 | # 34 | main.go 35 | -- time ctl ,input args parse , 36 | -- make(monitor chan ) ; make(stop chan) ; -------------------------------------------------------------------------------- /redisTools/redisHealthy/cmd/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | "os" 7 | "os/signal" 8 | "time" 9 | ) 10 | 11 | /** 12 | * 13 | * Author : xiean 14 | * EMail : xiepaup@163.com 15 | * GitHub : https://github.com/xiepaup 16 | * Date : 2018-08-03 17 | * Project : dbatools 18 | **/ 19 | 20 | const MAX_QUEUE_LEN = 100 21 | 22 | var ( 23 | RunSeconds int 24 | DelayRunSeconds int 25 | Addr string 26 | Paswd string 27 | 28 | monitorChan chan interface{} 29 | stopChan chan struct{} 30 | doneChan chan struct{} 31 | ) 32 | 33 | func init() { 34 | 35 | stopChan = make(chan struct{}, 0) 36 | monitorChan = make(chan interface{}, MAX_QUEUE_LEN) 37 | doneChan = make(chan struct{}, 0) 38 | 39 | flag.IntVar(&RunSeconds, "runsec", 60, "how long will be monitor") 40 | flag.IntVar(&DelayRunSeconds, "delaysec", 0, "if not 0, monitor will run N seconds later ") 41 | flag.StringVar(&Addr, "addr", "127.0.0.1:6379", "redis listen address") 42 | flag.StringVar(&Paswd, "password", "", "redis auth ,usually will be requirepass config item") 43 | flag.Parse() 44 | } 45 | 46 | func terminalProgram(terminalChan chan struct{}) { 47 | c := make(chan os.Signal, 0) 48 | signal.Notify(c) 49 | 50 | <-c 51 | 52 | terminalChan <- struct{}{} 53 | } 54 | 55 | func main() { 56 | 57 | terminalProgram(doneChan) 58 | 59 | //go time ctl 60 | //go redis ctl 61 | // 62 | 63 | mainLoop() 64 | 65 | } 66 | 67 | 68 | 69 | func mainLoop() { 70 | for { 71 | fmt.Println("todo Main Loop ..") 72 | 73 | select { 74 | case <-doneChan: 75 | break 76 | case <-stopChan: 77 | //TODO --> send stop chan to monitor , and consumer 78 | default: 79 | //TODO ---> run programs .. and sleep some time 80 | time.Sleep(time.Microsecond * 10) 81 | 82 | } 83 | 84 | time.Sleep(time.Millisecond * 10) 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /redisTools/redisHealthy/cmd/test/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "github.com/xiepaup/dbatools/redisTools/redisHealthy/lib/db" 4 | 5 | import ( 6 | "fmt" 7 | "os" 8 | "strings" 9 | "time" 10 | ) 11 | 12 | /** 13 | * 14 | * Author : xiean 15 | * EMail : xiepaup@163.com 16 | * GitHub : https://github.com/xiepaup 17 | * Date : 2018-08-03 18 | * Project : dbatools 19 | **/ 20 | 21 | 22 | const MAX_QUEUE_LEN = 1000 23 | 24 | func main() { 25 | stopChan := make(chan struct{}, 2) 26 | monitorChan := make(chan interface{}, MAX_QUEUE_LEN) 27 | r := db.NewRedis("127.0.0.1:31238", "redis@manage") 28 | 29 | redisBasicInfo(r) 30 | 31 | err := r.Monitor(monitorChan, stopChan) 32 | if err != nil { 33 | os.Exit(1) 34 | } 35 | go consumeCmds(monitorChan, stopChan) 36 | fmt.Println(fmt.Sprintf("do sleep ... wait queue done")) 37 | 38 | time.Sleep(time.Second * 1000) 39 | } 40 | 41 | func redisBasicInfo(r *db.RedisContext) { 42 | i, err := r.Info() 43 | if err != nil { 44 | fmt.Println(fmt.Sprintf("got an error from redis , %+v", err)) 45 | os.Exit(2) 46 | } 47 | info := strings.Split(string(i), "\r\n") 48 | if len(info) <= 0 { 49 | return 50 | } 51 | 52 | infoInfo := make(map[string]interface{}, 0) 53 | 54 | for _, l := range info { 55 | if !strings.Contains(l, ":") || strings.HasPrefix(l, "#") || len(l) == 0 { 56 | continue 57 | } 58 | //#redis_version:2.8.17-t-v0.2 59 | kv := strings.Split(l, ":") 60 | infoInfo[kv[0]] = kv[1] 61 | } 62 | 63 | //fmt.Println(infoInfo) 64 | showBasicInfo(infoInfo) 65 | } 66 | 67 | func showBasicInfo(info map[string]interface{}) { 68 | fmt.Println(fmt.Sprintf(` 69 | ------------------------------------------------- 70 | |version:%-40s|osversion:%-40s| 71 | |uptime:%10s|clients:%5s|role:%6s|cur_qps:%6s|used_memory:%8s|rss_memory:%8s| 72 | -------------------------------------------------`, 73 | info["redis_version"], info["os"], 74 | info["uptime_in_seconds"], info["connected_clients"], info["role"], 75 | info["instantaneous_ops_per_sec"], 76 | info["used_memory_human"], info["used_memory_peak_human"])) 77 | } 78 | 79 | func consumeCmds(mchan chan interface{}, schan chan struct{}) { 80 | for line := range mchan { 81 | //#1532945695.049181 [0 10.51.149.210:34992] "RPOP" "com.xiepaup.tendis.source.queue" 82 | if v, ok := line.(string); ok { 83 | fmt.Println(fmt.Sprintf("outer lib do parse cmd : %s", v)) 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /redisTools/redisHealthy/ctrl/redisctl.go: -------------------------------------------------------------------------------- 1 | package ctrl 2 | 3 | /** 4 | * 5 | * Author : xiean 6 | * EMail : xiepaup@163.com 7 | * GitHub : https://github.com/xiepaup 8 | * Date : 2018-08-03 9 | * Project : dbatools 10 | **/ -------------------------------------------------------------------------------- /redisTools/redisHealthy/ctrl/timectl.go: -------------------------------------------------------------------------------- 1 | package ctrl 2 | 3 | import "time" 4 | 5 | /** 6 | * 7 | * Author : xiean 8 | * EMail : xiepaup@163.com 9 | * GitHub : https://github.com/xiepaup 10 | * Date : 2018-08-03 11 | * Project : dbatools 12 | **/ 13 | 14 | type TimeCtl struct { 15 | StartTime time.Time 16 | RunSeconds int 17 | DelaySeconds int 18 | 19 | } 20 | 21 | func NewTimeCtl(r,d,int2 int) (*TimeCtl) { 22 | return &TimeCtl{ 23 | StartTime:time.Now(), 24 | RunSeconds:r, 25 | DelaySeconds:d, 26 | } 27 | } 28 | 29 | 30 | 31 | func (this *TimeCtl) GetRealStartTime() { 32 | 33 | } -------------------------------------------------------------------------------- /redisTools/redisHealthy/logic/cmds/rediscmds.go: -------------------------------------------------------------------------------- 1 | package cmds 2 | 3 | /** 4 | * Author : xiean 5 | * EMail : xiepaup@163.com 6 | * GitHub : https://github.com/xiepaup 7 | * Date : 2018-08-05 11:53 8 | * Project : dbatools 9 | **/ 10 | 11 | type RedisCMD struct { 12 | } 13 | 14 | const ( 15 | REDIS_DATA_TYPE_HASH_NAME = "hash" 16 | REDIS_DATA_TYPE_STRINGS_NAME = "string" 17 | REDIS_DATA_TYPE_LIST_NAME = "list" 18 | REDIS_DATA_TYPE_SET_NAME = "set" 19 | REDIS_DATA_TYPE_ZSET_NAME = "zset" 20 | REDIS_DATA_TYPE_OTHER_NAME = "unkonwn" 21 | ) 22 | 23 | const ( 24 | REDIS_DATA_TYPE_HAHS_CODE = iota 25 | REDIS_DATA_TYPE_STRINGS_CODE 26 | REDIS_DATA_TYPE_LIST_CODE 27 | REDIS_DATA_TYPE_SET_CODE 28 | REDIS_DATA_TYPE_ZSET_CODE 29 | REDIS_DATA_TYPE_OTHER_CODE 30 | ) 31 | 32 | 33 | const ( 34 | UNKOWN_CMD_TYPE = 8888 35 | 36 | HASH_CMD_TYPE_READ = 9101 37 | HASH_CMD_TYPE_WRITE = 9102 38 | 39 | STR_CMD_TYPE_READ = 9201 40 | STR_CMD_TYPE_WRITE = 9202 41 | 42 | LIST_CMD_TYPE_READ = 9301 43 | LIST_CMD_TYPE_WRITE = 9302 44 | 45 | ZSET_CMD_TYPE_READ = 9401 46 | ZSET_CMD_YTPE_WRITE = 9402 47 | 48 | SET_CMD_TYPE_READ = 9501 49 | SET_CMD_TYPE_WRITE = 9502 50 | ) 51 | 52 | 53 | 54 | func GetDataTypeByCmd(c string) { 55 | 56 | } -------------------------------------------------------------------------------- /redisTools/redisHealthy/logic/cmds/redishashcmds.go: -------------------------------------------------------------------------------- 1 | package cmds 2 | 3 | import "strings" 4 | 5 | /** 6 | * Author : xiean 7 | * EMail : xiepaup@163.com 8 | * GitHub : https://github.com/xiepaup 9 | * Date : 2018-08-05 12:06 10 | * Project : dbatools 11 | **/ 12 | 13 | var supportRedisHashCmds []string 14 | var supportRedisHashReadCmds [9]string 15 | var supportRedisHashWriteCmds [6]string 16 | 17 | func init() { 18 | 19 | //supportRedisHashCmds = []string{"HKEYS","HEXISTS","HGET","HGETALL","HLEN","HMGET","HVALS","HSCAN","HSTRLEN","HSET","HMSET","HDEL","HINCRBY","HINCRBYFLOAT","HSETNX"} 20 | supportRedisHashReadCmds = [...]string{"HKEYS", "HEXISTS", "HGET", "HGETALL", "HLEN", "HMGET", "HVALS", "HSCAN", "HSTRLEN"} 21 | supportRedisHashWriteCmds = [...]string{"HSET", "HMSET", "HDEL", "HINCRBY", "HINCRBYFLOAT", "HSETNX"} 22 | 23 | supportRedisHashCmds = supportRedisHashReadCmds[0:] 24 | for _, c := range supportRedisHashWriteCmds { 25 | supportRedisHashCmds = append(supportRedisHashCmds, c) 26 | } 27 | 28 | } 29 | 30 | func GetRedisHashCmds() ([]string) { 31 | return supportRedisHashCmds 32 | } 33 | 34 | func IsHashCmd(c string) (bool) { 35 | c = strings.ToUpper(c) 36 | for _, hc := range supportRedisHashCmds { 37 | if c == hc { 38 | return true 39 | } 40 | } 41 | return false 42 | } 43 | 44 | func GetHashCmdType(c string) (int) { 45 | if IsHashCmd(c) { 46 | if isHashReadCmd(c) { 47 | return HASH_CMD_TYPE_READ 48 | } 49 | 50 | if isHashWriteCmd(c) { 51 | return HASH_CMD_TYPE_WRITE 52 | } 53 | } 54 | return UNKOWN_CMD_TYPE 55 | } 56 | 57 | func isHashReadCmd(c string) bool { 58 | c = strings.ToUpper(c) 59 | for _, hc := range supportRedisHashReadCmds { 60 | if c == hc { 61 | return true 62 | } 63 | } 64 | return false 65 | } 66 | 67 | func isHashWriteCmd(c string) bool { 68 | c = strings.ToUpper(c) 69 | for _, hc := range supportRedisHashWriteCmds { 70 | if c == hc { 71 | return true 72 | } 73 | } 74 | return false 75 | } 76 | -------------------------------------------------------------------------------- /redisTools/redisHealthy/logic/cmds/redislistcmds.go: -------------------------------------------------------------------------------- 1 | package cmds 2 | 3 | import "strings" 4 | 5 | /** 6 | * Author : xiean 7 | * EMail : xiepaup@163.com 8 | * GitHub : https://github.com/xiepaup 9 | * Date : 2018-08-05 12:06 10 | * Project : dbatools 11 | **/ 12 | 13 | var supportRedisListCmds []string 14 | var supportRedisListReadCmds [3]string 15 | var supportRedisListWriteCmds [14]string 16 | 17 | 18 | func init() { 19 | supportRedisListReadCmds = [...]string{"LINDEX", "LLEN", "LRANGE"} 20 | supportRedisListWriteCmds = [...]string{"BLPOP", "BRPOP", "BRPOPLPUSH", "LINSERT", "LPOP", "LPUSH", "LPUSHX", "LREM", "LSET", "LTRIM", "RPOP", "RPOPLPUSH", "RPUSH", "RPUSHX"} 21 | 22 | supportRedisListCmds = supportRedisListReadCmds[0:] 23 | 24 | for _, c := range supportRedisListWriteCmds { 25 | supportRedisListCmds = append(supportRedisListCmds, c) 26 | } 27 | 28 | } 29 | 30 | func IsListCmd(c string) (bool) { 31 | c = strings.ToUpper(c) 32 | 33 | for _, lc := range supportRedisListCmds { 34 | if c == lc { 35 | return true 36 | } 37 | } 38 | return false 39 | } 40 | 41 | func GetListCmdType(c string) (int) { 42 | c = strings.ToUpper(c) 43 | if IsListCmd(c) { 44 | if isListReadCmd(c) { 45 | return LIST_CMD_TYPE_READ 46 | } 47 | if isListWriteCmd(c) { 48 | return LIST_CMD_TYPE_WRITE 49 | } 50 | } 51 | return UNKOWN_CMD_TYPE 52 | } 53 | 54 | func isListReadCmd(c string) (bool) { 55 | c = strings.ToUpper(c) 56 | 57 | for _, lc := range supportRedisListReadCmds { 58 | if c == lc { 59 | return true 60 | } 61 | } 62 | return false 63 | } 64 | 65 | func isListWriteCmd(c string) (bool) { 66 | c = strings.ToUpper(c) 67 | 68 | for _, lc := range supportRedisListWriteCmds { 69 | if c == lc { 70 | return true 71 | } 72 | } 73 | return false 74 | } 75 | -------------------------------------------------------------------------------- /redisTools/redisHealthy/logic/cmds/redissetcmds.go: -------------------------------------------------------------------------------- 1 | package cmds 2 | 3 | import "strings" 4 | 5 | /** 6 | * Author : xiean 7 | * EMail : xiepaup@163.com 8 | * GitHub : https://github.com/xiepaup 9 | * Date : 2018-08-05 12:58 10 | * Project : dbatools 11 | **/ 12 | 13 | var supportRedisSETCmds []string 14 | var supportRedisSETReadCmds [10]string 15 | var supportRedisSETWriteCmds [4]string 16 | 17 | 18 | func init() { 19 | supportRedisSETReadCmds = [...]string{"SCARD", "SDIFF", "SDIFFSTORE","SINTER","SINTERSTORE","SISMEMBER","SRANDMEMBER","SUNION","SUNIONSTORE","SSCAN"} 20 | supportRedisSETWriteCmds = [...]string{"SADD", "SMOVE", "SPOP", "SREM"} 21 | 22 | supportRedisSETCmds = supportRedisListReadCmds[0:] 23 | 24 | for _, c := range supportRedisSETWriteCmds { 25 | supportRedisSETCmds = append(supportRedisSETCmds, c) 26 | } 27 | 28 | } 29 | 30 | func IsSetCmd(c string) (bool) { 31 | c = strings.ToUpper(c) 32 | 33 | for _, lc := range supportRedisSETCmds { 34 | if c == lc { 35 | return true 36 | } 37 | } 38 | return false 39 | } 40 | 41 | func GetSetCmdType(c string) (int) { 42 | c = strings.ToUpper(c) 43 | if IsSetCmd(c) { 44 | if isSetReadCmd(c) { 45 | return SET_CMD_TYPE_READ 46 | } 47 | if isSetWriteCmd(c) { 48 | return SET_CMD_TYPE_WRITE 49 | } 50 | } 51 | return UNKOWN_CMD_TYPE 52 | } 53 | 54 | func isSetReadCmd(c string) (bool) { 55 | c = strings.ToUpper(c) 56 | 57 | for _, lc := range supportRedisSETReadCmds { 58 | if c == lc { 59 | return true 60 | } 61 | } 62 | return false 63 | } 64 | 65 | func isSetWriteCmd(c string) (bool) { 66 | c = strings.ToUpper(c) 67 | 68 | for _, lc := range supportRedisSETWriteCmds { 69 | if c == lc { 70 | return true 71 | } 72 | } 73 | return false 74 | } 75 | -------------------------------------------------------------------------------- /redisTools/redisHealthy/logic/cmds/redisstringcmds.go: -------------------------------------------------------------------------------- 1 | package cmds 2 | 3 | import "strings" 4 | 5 | /** 6 | * Author : xiean 7 | * EMail : xiepaup@163.com 8 | * GitHub : https://github.com/xiepaup 9 | * Date : 2018-08-05 12:06 10 | * Project : dbatools 11 | **/ 12 | 13 | var supportRedisStringCmds []string 14 | var supportRedisStringReadCmds [9]string 15 | var supportRedisStringWriteCmds [13]string 16 | 17 | //GETSET ===> treat as write . 18 | func init() { 19 | 20 | supportRedisStringReadCmds = [...]string{"APPEND", "BITCOUNT", "BITOP", "BITFIELD", "GET", "GETBIT", "GETRANGE", "MGET", "STRLEN"} 21 | supportRedisStringWriteCmds = [...]string{"DECRBY", "DECR", "GETSET", "INCR", "INCRBY", "INCRBYFLOAT", "MSET", "MSETNX", "PSETEX", "SET", "SETEX", "SETNX", "SETRANGE"} 22 | 23 | supportRedisStringCmds = supportRedisStringReadCmds[0:] 24 | for _, c := range supportRedisStringWriteCmds { 25 | supportRedisStringCmds = append(supportRedisStringCmds, c) 26 | } 27 | 28 | } 29 | 30 | func IsStringCmd(c string) (bool) { 31 | c = strings.ToUpper(c) 32 | for _, sc := range supportRedisStringCmds { 33 | if c == sc { 34 | return true 35 | } 36 | } 37 | return false 38 | } 39 | 40 | func GetStringCmdType(c string) (int) { 41 | 42 | if IsStringCmd(c) { 43 | if isStringReadCmd(c) { 44 | return STR_CMD_TYPE_READ 45 | } 46 | if isStringWriteCmd(c) { 47 | return STR_CMD_TYPE_WRITE 48 | } 49 | } 50 | return UNKOWN_CMD_TYPE 51 | } 52 | 53 | func isStringReadCmd(c string) (bool) { 54 | c = strings.ToUpper(c) 55 | 56 | for _, sc := range supportRedisStringReadCmds { 57 | if c == sc { 58 | return true 59 | } 60 | } 61 | 62 | return false 63 | } 64 | 65 | func isStringWriteCmd(c string) (bool) { 66 | c = strings.ToUpper(c) 67 | 68 | for _, sc := range supportRedisStringWriteCmds { 69 | if c == sc { 70 | return true 71 | } 72 | } 73 | return false 74 | } 75 | -------------------------------------------------------------------------------- /redisTools/redisHealthy/logic/cmds/rediszsetcmds.go: -------------------------------------------------------------------------------- 1 | package cmds 2 | 3 | import "strings" 4 | 5 | /** 6 | * Author : xiean 7 | * EMail : xiepaup@163.com 8 | * GitHub : https://github.com/xiepaup 9 | * Date : 2018-08-05 12:58 10 | * Project : dbatools 11 | **/ 12 | 13 | 14 | 15 | var supportRedisZSetCmds []string 16 | var supportRedisZSetReadCmds [16]string 17 | var supportRedisZSetWriteCmds [3]string 18 | 19 | 20 | func init() { 21 | supportRedisZSetReadCmds = [...]string{"ZCARD","ZCOUNT","ZRANGE","ZRANGEBYSCORE","ZRANK","ZREMRANGEBYRANK","ZREMRANGEBYSCORE", 22 | "ZREVRANGE","ZREVRANGEBYSCORE","ZREVRANK","ZSCORE","ZUNIONSTORE","ZSCAN","ZRANGEBYLEX","ZLEXCOUNT","ZREMRANGEBYLEX"} 23 | supportRedisZSetWriteCmds = [...]string{"ZINCRBY","ZREM","ZADD"} 24 | 25 | supportRedisZSetCmds = supportRedisZSetReadCmds[0:] 26 | 27 | for _, c := range supportRedisZSetWriteCmds { 28 | supportRedisZSetCmds = append(supportRedisZSetCmds, c) 29 | } 30 | 31 | } 32 | 33 | func IsZSetCmd(c string) (bool) { 34 | c = strings.ToUpper(c) 35 | 36 | for _, lc := range supportRedisZSetCmds { 37 | if c == lc { 38 | return true 39 | } 40 | } 41 | return false 42 | } 43 | 44 | func GetZSetCmdType(c string) (int) { 45 | c = strings.ToUpper(c) 46 | if IsZSetCmd(c) { 47 | if isZSetReadCmd(c) { 48 | return ZSET_CMD_TYPE_READ 49 | } 50 | if isZSetWriteCmd(c) { 51 | return ZSET_CMD_YTPE_WRITE 52 | } 53 | } 54 | return UNKOWN_CMD_TYPE 55 | } 56 | 57 | func isZSetReadCmd(c string) (bool) { 58 | c = strings.ToUpper(c) 59 | 60 | for _, lc := range supportRedisZSetReadCmds { 61 | if c == lc { 62 | return true 63 | } 64 | } 65 | return false 66 | } 67 | 68 | func isZSetWriteCmd(c string) (bool) { 69 | c = strings.ToUpper(c) 70 | 71 | for _, lc := range supportRedisZSetWriteCmds { 72 | if c == lc { 73 | return true 74 | } 75 | } 76 | return false 77 | } 78 | -------------------------------------------------------------------------------- /redisTools/redisHealthy/logic/macro/global.go: -------------------------------------------------------------------------------- 1 | package macro 2 | 3 | import ( 4 | "sync" 5 | "fmt" 6 | ) 7 | 8 | /** 9 | * 10 | * Author : xiean 11 | * EMail : xiepaup@163.com 12 | * GitHub : https://github.com/xiepaup 13 | * Date : 2018-08-03 14 | * Project : dbatools 15 | **/ 16 | 17 | type GlobalWatch struct { 18 | mutx sync.Mutex 19 | 20 | WriteBytes int64 21 | ReadBytes int64 22 | 23 | ReadOpsCnt int64 24 | WriteOpsCnt int64 25 | 26 | HashOpsCnt int64 27 | StrOpsCnt int64 28 | ListOpsCnt int64 29 | SetOpsCnt int64 30 | ZSetOpsCnt int64 31 | 32 | AllOpsCnt int64 33 | } 34 | 35 | func NewGlobalWatch() (*GlobalWatch) { 36 | return &GlobalWatch{} 37 | } 38 | 39 | func (this *GlobalWatch) Incr() { 40 | 41 | } 42 | 43 | 44 | 45 | func (this *GlobalWatch) ToString() { 46 | fmt.Println(fmt.Sprintf("%#v",this)) 47 | } -------------------------------------------------------------------------------- /redisTools/redisHealthy/logic/micro/details.go: -------------------------------------------------------------------------------- 1 | package micro 2 | 3 | /** 4 | * Author : xiean 5 | * EMail : xiepaup@163.com 6 | * GitHub : https://github.com/xiepaup 7 | * Date : 2018-08-05 11:46 8 | * Project : dbatools 9 | **/ 10 | 11 | -------------------------------------------------------------------------------- /redisTools/redis_key_delete.py: -------------------------------------------------------------------------------- 1 | import redis 2 | import time 3 | import sys 4 | ''' 5 | This Scripts is for Delete keys which miss used by dev 6 | 7 | Created by xiean@2016-04-20 Email xiepaup@163.com 8 | ''' 9 | 10 | 11 | 12 | def del_keys(rdbConn,keys_list): 13 | rdbPiple = rdbConn.pipeline() 14 | for key in keys_list: 15 | rdbPiple.delete(key) 16 | rdbPiple.execute() 17 | 18 | 19 | def main(fileName,rdbConn,delCounter): 20 | keys_file = open(fileName,'r') 21 | key_counter = 0 22 | key_list = [] 23 | for line in keys_file: 24 | line = line.strip() 25 | if line != '': 26 | #key = line.split(',')[1] 27 | key = line 28 | key_counter += 1 29 | key_list.append(key) 30 | if (key_counter % delCounter) == 0 : 31 | del_keys(rdbConn,key_list) 32 | key_list = [] 33 | print "%s : Deleted %12s Keys" % (time.ctime(),key_counter) 34 | time.sleep(0.1) 35 | 36 | def usage(): 37 | print ''' 38 | Function: This Scripts is used to delete keys which miss uesed by dev ! 39 | Args : 40 | -H,--help show usage 41 | -F,--file input keys will be deleted ! 42 | -h,--host redis ip or domain 43 | -p,--port redis port 44 | ''' 45 | 46 | if __name__ == "__main__": 47 | if len(sys.argv) < 4: 48 | print "please input argvs " 49 | usage() 50 | exit() 51 | fileName = "" 52 | host = "" 53 | port = "" 54 | 55 | try: 56 | opts,args = getopt.getopt(sys.argv[1:],"Hf:h:p:",["help","file=","host=","port="]) 57 | for op,value in opts: 58 | if op in ("-f","--file"): 59 | fileName = value 60 | elif op in ("-h","--host"): 61 | host = value 62 | elif op in ("-P","--port"): 63 | port = int(value) 64 | elif op in ("-H","--help"): 65 | usage() 66 | except Exception,e: 67 | print "Parse Args Error ,%s" % (e) 68 | 69 | beginTime = time.ctime() 70 | rdbConn = redis.Redis(host=host,port=port) 71 | main(fileName,rdbConn,300) 72 | 73 | endTime = time.ctime() 74 | print "Delete Key Done ! running through %s - %s " % (beginTime,endTime) 75 | --------------------------------------------------------------------------------