首頁  >  文章  >  資料庫  >  MySQL稽核外掛的測試(mcafee和mariadb版本)詳情介紹

MySQL稽核外掛的測試(mcafee和mariadb版本)詳情介紹

黄舟
黄舟原創
2017-03-06 11:40:291938瀏覽

測試用伺服器設定: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: 15377012
write: 4393432
other: 2196716
total: 21967160
transactions: 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_file=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: 8376872
write: 2393392
other: 1196696
total: 11966960
transactions: 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: 9098362
write: 2599532
other: 1299766
total: 12997660
transactions: 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.0 G

卸載外掛程式需要重啟一次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版本)詳情介紹的內容,更多相關內容請關注PHP中文網(www.php.cn)!


陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn