• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

MySQL审计插件的测试(mcafee和mariadb版本)详情介绍

mysql 搞代码 4年前 (2022-01-09) 16次浏览 已收录 0个评论

测试用服务器配置:Dell R730; 24核; 64G内存; ssd磁盘。

Centos版本:6.4; MySQL版本:Community 5.6.12;测试数据库大小:24G。

sysbench 参数:64线程 10表,每个表预先初始化好一千万数据,读写混合OLTP模式。和mysql跑在同一台机器上。

测试时长:5分钟/场景。

未安装插件

OLTP test statistics:queries performed:read: 15377012write: 4393432other: 2196716total: 21967160transactions: 1098358 (3661.01 per sec.)read/write requests: 19770444 (65898.21 per sec.)other operations: 2196716 (7322.02 per sec.)ignored errors: 0 (0.00 per sec.)reconnects: 0 (0.00 per sec.)

Mcafee插件 官网地址:https://github.com/mcafee/mysql-audit/wiki

使用版本:v1.0.9

安装

INSTALL PLUGIN AUDIT SONAME 'libaudit_plugin.so';

启用

set global audit_json_fil<strong>本文来源gao@daima#com搞(%代@#码网</strong>e=1;

停用

set global audit_json_file=0;

重启mysql

插件不会卸载,不会启用记录日志。

卸载

直接执行UNINSTALL PLUGIN AUDIT;卸载会报错: Uninstall AUDIT plugin disabled。

同时发现 Variable 'audit_uninstall_plugin' is a read only variable

需要在my.cnf中添加audit_uninstall_plugin=1,重启mysql。

重启完毕后 执行两次 UNINSTALL PLUGIN AUDIT; 可以卸载。

卸载完成后需要从my.cnf中删除audit_uninstall_plugin=1 ,否则下次mysql启动会报错:[ERROR] /data/mysql/bin/mysqld: unknown variable 'audit_uninstall_plugin=1'

日志格式:json

{"msg-type":"activity","date":"1484795122970","thread-id":"557","query-id":"61687115","user":"root","priv_user":"root","ip":"127.0.0.1","cmd":"select","objects":[{"db":"sysbench_test","name":"sbtest7","obj_type":"TABLE"}],"query":"SELECT c FROM sbtest7 WHERE id=5015211"}

只会记录操作成功的日志

OLTP test statistics:queries performed:read: 8376872write: 2393392other: 1196696total: 11966960transactions: 598348 (1994.38 per sec.)read/write requests: 10770264 (35898.81 per sec.)other operations: 1196696 (3988.76 per sec.)ignored errors: 0 (0.00 per sec.)reconnects: 0 (0.00 per sec.)

Mariadb 插件 官网地址:https://mariadb.com/kb/en/mariadb/about-the-

使用版本:1.1.7

安装

INSTALL PLUGIN server_audit SONAME 'server_audit.so';

启用

set global server_audit_logging=1;set global server_audit_file_rotate_size=1073741824; set global server_audit_file_rotations=4;

停用

set global server_audit_logging=0;

重启mysql

插件不会卸载,不会启用记录日志。 但是所有参数会重置,再次启用的时候需要执行需要的参数配置。

卸载

UNINSTALL PLUGIN server_audit;

卸载插件无须重启mysql。

日志格式:固定格式文本

20170119 10:39:19,localhost.localdomain,root,127.0.0.1,375,8330400,QUERY,sysbench_test,'SELECT c FROM sbtest5 WHERE id=5037936',0

所有操作都会记录。可以记录SQL注入。

OLTP test statistics:queries performed:read: 9098362write: 2599532other: 1299766total: 12997660transactions: 649883 (2166.16 per sec.)read/write requests: 11697894 (38990.84 per sec.)other operations: 1299766 (4332.32 per sec.)ignored errors: 0 (0.00 per sec.)reconnects: 0 (0.00 per sec.)

小结:

mcafee的审计插件:

性能下降约46%,产生日志3.0G

卸载插件需要重启一次mysql。插件没有自动滚动,需要另外部署清理任务,会有清理任务失败导致的磁盘空间不够的风险,拉取日志到其他服务器分析与清理任务有协调困难,清理任务会有一定耦合性。

mariadb的审计插件:

性能下降约41%,产生1864M日志。

性能略好于mcafee的插件。 审计日志有自动滚动。卸载方便。 兼容性方面5.6.12的版本测试不适配1.1.7以上版本,使用的话MySQL守护进程会无限重启mysql,官方说是1.2.0以上版本要在MySQL5.6.17以上版本使用,使用前要先测试。

percona的审计插件:

没有适配5.6.17以前版本的,暂未做测试。

以上就是MySQL审计插件的测试(mcafee和mariadb版本)详情介绍的内容,更多相关内容请关注搞代码(www.gaodaima.com)!


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:MySQL审计插件的测试(mcafee和mariadb版本)详情介绍

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址