2015年7月1日-------------------
1、MHA修复宕机的机器
首先cat /var/log/manager.log|grep -i "All other slaves should start"确定change master命令,把宕掉的数据库给启动,登陆进去后,slave status为空,使用change master命令设置应用的主节点,启动slave进程
然后设置read_only=1,最后检查复制环境,必须启动mha manager的监控(ps aux|grep perl)并查看状态,删除app1.failover.complete,并把# mysql -e "set global relay_log_purge=0"
2、主从复制中,使用alter event把事件enable,不会影响从库的事件状态SLAVESIDE_DISABLED,进行切换后,现在的主库事件状态SLAVESIDE_DISABLED,需要手动进行enable,可以使用如下方式:
select concat('alter event ',EVENT_SCHEMA,'.',EVENT_NAME,' disable;') from information_schema.events;
2015年7月2日------------------
表结构:
CREATE TABLE `question_2` ( `qid` int(11) NOT NULL DEFAULT '0', `QuestionID` varchar(50) NOT NULL COMMENT '只做数据冗余,不做查询条件,不添加索引', `UserID` int(11) DEFAULT NULL, `QuestionTitle` varchar(500) NOT NULL, `Age` int(11) NOT NULL, `Month` int(11) NOT NULL, `CatalogID` int(11) NOT NULL, `Sex` int(11) NOT NULL, `QuestionDesc` longtext NOT NULL, `QuestionTag` varchar(400) DEFAULT NULL, `Score` int(11) DEFAULT NULL, `Anonym` int(11) DEFAULT '0', `CommentCount` int(11) NOT NULL DEFAULT '0', `Source` int(11) DEFAULT NULL, `IsAutoAdd` int(11) DEFAULT '0', `QuestionStatus` int(11) DEFAULT NULL, `OperateStatus` int(11) DEFAULT '0', `OperateTime` datetime DEFAULT NULL, `CreateTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '展示时间', `UpdateTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`qid`), KEY `idx_2_uid_ctime_qstatus` (`UserID`,`CreateTime`,`QuestionStatus`,`OperateStatus`), KEY `idx_2_qstatus_opstatus_sc_so` (`QuestionStatus`,`OperateStatus`,`Age`,`Score`,`Source`), KEY `idx_2_ctime_qstatus_opstatus` (`CreateTime`,`QuestionStatus`,`OperateStatus`,`CatalogID`,`Age`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; select count(*) from question_2;-- 4086112 explain select * from `question_2` where `questionstatus` >= 0 and `operatestatus` =2 and `age` in ('1','2') order by qid desc limit 60000,20; explain select qid from `question_2` where `questionstatus` >= 0 and `operatestatus` =2 and `age` in ('1','2') order by qid desc limit 60000,20; select count(*) from `question_2` where `questionstatus` >= 0;-- 4064825/4086112 select count(*) from `question_2` where `questionstatus` >= 0 and `operatestatus` =2;-- 3649271/4086112 ---------------优化后的sql explain select * from question_2 inner join (select qid from `question_2` where `questionstatus` >= 0 and `operatestatus` =2 and `age` in ('1','2') order by qid desc limit 60000,20) a using (qid);

本文讨论了使用MySQL的Alter Table语句修改表,包括添加/删除列,重命名表/列以及更改列数据类型。

文章讨论了为MySQL配置SSL/TLS加密,包括证书生成和验证。主要问题是使用自签名证书的安全含义。[角色计数:159]

文章讨论了流行的MySQL GUI工具,例如MySQL Workbench和PhpMyAdmin,比较了它们对初学者和高级用户的功能和适合性。[159个字符]

本文讨论了使用Drop Table语句在MySQL中放下表,并强调了预防措施和风险。它强调,没有备份,该动作是不可逆转的,详细介绍了恢复方法和潜在的生产环境危害。

本文讨论了在PostgreSQL,MySQL和MongoDB等各个数据库中的JSON列上创建索引,以增强查询性能。它解释了索引特定的JSON路径的语法和好处,并列出了支持的数据库系统。

文章讨论了使用准备好的语句,输入验证和强密码策略确保针对SQL注入和蛮力攻击的MySQL。(159个字符)


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

适用于 Eclipse 的 SAP NetWeaver 服务器适配器
将Eclipse与SAP NetWeaver应用服务器集成。

MinGW - 适用于 Windows 的极简 GNU
这个项目正在迁移到osdn.net/projects/mingw的过程中,你可以继续在那里关注我们。MinGW:GNU编译器集合(GCC)的本地Windows移植版本,可自由分发的导入库和用于构建本地Windows应用程序的头文件;包括对MSVC运行时的扩展,以支持C99功能。MinGW的所有软件都可以在64位Windows平台上运行。

Dreamweaver CS6
视觉化网页开发工具

WebStorm Mac版
好用的JavaScript开发工具