企业实战_22_MyCatSQL拦截
生活随笔
收集整理的這篇文章主要介紹了
企业实战_22_MyCatSQL拦截
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
接上一篇:企業(yè)實(shí)戰(zhàn)_21_MyCat_keepalived 安裝配置驗(yàn)證
https://gblfy.blog.csdn.net/article/details/100073474
Mycat SQL攔截應(yīng)用場(chǎng)景,可以指定監(jiān)控的sql類型
文章目錄
- 1. 在server.xml文件中添加sql攔截屬性標(biāo)簽
- 2. 測(cè)試驗(yàn)證
- 3. 查看sql攔截監(jiān)控日志
1. 在server.xml文件中添加sql攔截屬性標(biāo)簽
cd /app/mycat/conf/ vim server.xml# 添加<property name="sqlInterceptor">io.mycat.server.interceptor.impl.StatisticsSqlInterceptor</property><property name="sqlInterceptorType">UPDATE,DELETE,INSERT</property><property name="sqlInterceptorFile">/app/sql.txt</property>2. 測(cè)試驗(yàn)證
# 重啟mycat mycat restart# 使用mysql客戶端連接登錄mycat mysql -uapp_imooc -p -h192.168.92.101 -P8066# 使用邏輯數(shù)據(jù)庫(kù) use imooc_db;# 隨機(jī)查詢一條數(shù)據(jù) select * from order_master limit 1 \G# 插入一條數(shù)據(jù) INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,district_money,shipping_money,payment_money,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_time) VALUES (1, 1, '雨昕', 1, 1, 1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, NULL, '2021-07-11 20:20:25');#對(duì)這一條數(shù)據(jù)進(jìn)行更新操作 update order_master set shipping_user = 'yuze' where order_id =2;更新前:
進(jìn)行更新操作后:
3. 查看sql攔截監(jiān)控日志
#進(jìn)入設(shè)置的sql攔截指定的日志儲(chǔ)存目錄 cd /app#查看日志內(nèi)容 more /app/sql2021-07-13.txt INSERT:INSERT INTO `order_master` (ORDER_ID,order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,district_money,shipping_money,payment_money,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_time) VALUES ( 2,1, 1, '雨昕', 1, 1, 1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, NULL, '2021-07-11 20:20:25') UPDATE:update order_master set shipping_user = “yuze” where order_id =2 UPDATE:update order_master set shipping_user = 'yuze' where order_id =2下一篇:企業(yè)實(shí)戰(zhàn)_23_MyCat SQL防火墻
https://gblfy.blog.csdn.net/article/details/100074335
總結(jié)
以上是生活随笔為你收集整理的企业实战_22_MyCatSQL拦截的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 企业实战_01_Redis下载/安装/运
- 下一篇: git 提交报错