惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Blog of Author Tim Ferriss
Know Your Adversary
Know Your Adversary
P
Palo Alto Networks Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
K
Kaspersky official blog
L
LINUX DO - 热门话题
P
Proofpoint News Feed
P
Privacy & Cybersecurity Law Blog
Google DeepMind News
Google DeepMind News
Attack and Defense Labs
Attack and Defense Labs
Cisco Talos Blog
Cisco Talos Blog
AI
AI
L
LINUX DO - 最新话题
H
Heimdal Security Blog
Hacker News: Ask HN
Hacker News: Ask HN
Webroot Blog
Webroot Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The GitHub Blog
The GitHub Blog
I
Intezer
Blog — PlanetScale
Blog — PlanetScale
有赞技术团队
有赞技术团队
S
Securelist
博客园_首页
IT之家
IT之家
Schneier on Security
Schneier on Security
博客园 - 叶小钗
罗磊的独立博客
WordPress大学
WordPress大学
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
MongoDB | Blog
MongoDB | Blog
P
Proofpoint News Feed
阮一峰的网络日志
阮一峰的网络日志
A
Arctic Wolf
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
W
WeLiveSecurity
The Register - Security
The Register - Security
D
DataBreaches.Net
S
Security @ Cisco Blogs
Security Archives - TechRepublic
Security Archives - TechRepublic
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
腾讯CDC
Recorded Future
Recorded Future
NISL@THU
NISL@THU
N
News and Events Feed by Topic
T
Tailwind CSS Blog
N
News and Events Feed by Topic
Cyberwarzone
Cyberwarzone
T
Tor Project blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com

博客园 - 问天何必

网文小说应该怎么从零开始设计故事情节呢? 拒绝花里胡哨,这次来真的,又做了一个导航+超级搜索, 50+功能自定义调整。 一个优秀的导航站。 1个能顶100个 Redis 挂了自动重启的shell 脚本。 苹果cms自动采集,重复执行遇到“上次执行时间: --跳过”的解决办法 苹果cms, 后台设置保存不了的解决办法 c# 【电影搜索引擎】采集电影站源码 解决 C:\WINDOWS\system32\inetsrv\rewrite.dll 未能加载。返回的数据为错误. - 问天何必 安利一个聚合搜索导航站,及怎么样设置成默认的搜索引擎 img error 图片加载失败的最佳方案 百度站长平台HTTPS认证所遇到的坑 百度Sitemap生成器 女朋友经常问影视剧, 答不上来怎么办? fiddler抓取手机上https数据配置和失败的解决办法 STSDB 一 windows2012 IIS部署GeoTrust证书踩过的坑。 百度编辑器解决span被过滤, 自动加P标签 jquery ajax GET POST 跨域请求实现 代码记录:使用Aforge.net让视频图像反转180度
宝塔linux面板, 服务器日志分析与流量统计这款插件的mysql版优化。
问天何必 · 2020-05-25 · via 博客园 - 问天何必

 在花1块钱,购买了那个《服务器日志分析与流量统计》这个插件, 用来分析日志和流量, 当www.wxtv.net流量巨大, 短短几天就产生了8百万条网站日志,  使用的是mysql存储日志的方式,   该插件的作者几乎没有优化过mysql存储方式(我也不知道sqlite方式有没有优化),  大几百万的日志, 查询几乎打不开, 还把整个mysql拖死。 打开mysql的慢日志查询, 发现全是统计的语句超时了。 

慢日志记录:

SET timestamp=1590377705;
select website,ip,CAST(time AS CHAR) AS time,httpstatus,size,httpmothed,pageurl,shebieinfo from weblogs where website='www.wxtv.net' and time>='2020-05-2100:00:01' and time<='2020-05-2123:59:59' and shebieinfo like '%baidus%' order by time desc limit 0,100;
# Time: 200525 11:35:10
# User@Host: wlog[wlog] ******  Id: 1230472
# Query_time: 4.893739  Lock_time: 0.000176 Rows_sent: 1  Rows_examined: 2227923
SET timestamp=1590377710;
select count(ip) from weblogs where website='www.wxtv.net' and time>='2020-05-2100:00:01' and time<='2020-05-2123:59:59' and shebieinfo like '%baidus%' order by time desc;

解决办法:

增加weblogs表的time字段的索引。 操作步骤如下:

1. 点击左边菜单“数据库”。

2. 选择当时日志配置的mysql数据库, 点击管理,打开phpMyAdmin。 

3.  在phpMyAdmin中, 选择日志的数据库。  点击结构。 

4. 点击time字段操作列中的索引, 给time字段新建索引。  

建好索引后, 再打开《服务器日志分析与流量统计》这个插件, 查询速度变成了秒级。 

PS: 该款插件只卖1块钱, 所谓1分钱一分货, 作者在mysql方式上, 几乎都没有测试。  买过来, 可以打开它的源码, 修改代码, 在服务器上进行优化。