mysql的json处理

写在前面

需要注意,5.7以上版本才支持,但如果是生产环境需要使用的话,尽量使用8.0版本,因为8.0版本对json处理做了比较大的性能优化。你你可以使用select version();来查看版本信息。

本文看下MySQL的json处理。在正式开始让我们先来准备一些测试数据:

CREATE TABLE `dept` (
  `id` int(11) NOT NULL,
  `dept` varchar(255) DEFAULT NULL,
  `json_value` json DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

insert into dept VALUES(1,'部门1','{"deptName": "部门1", "deptId": "1", "deptLeaderId": "3"}');
insert into dept VALUES(2,'部门2','{"deptName": "部门2", "deptId": "2", "deptLeaderId": "4"}');
insert into dept VALUES(3,'部门3','{"deptName": "部门3", "deptId": "3", "deptLeaderId": "5"}');
insert into dept VALUES(4,'部门4','{"deptName": "部门4", "deptId": "4", "deptLeaderId": "5"}');
insert into dept VALUES(5,'部门5','{"deptName": "部门5", "deptId": "5", "deptLeaderId": "5"}');

1:json字段名->’$.json属性’

通过json字段名->’$.json属性’语法格式可以访问到json中某个key的值,以如下查询方式看下。

1.1:用在DQL查询结果中

mysql> select id,json_value->'$.deptLeaderId' from dept where id=2;
+----+------------------------------+
| id | json_value->'$.deptLeaderId' |
+----+------------------------------+
|  2 | "4"                          |
+----+------------------------------+
1 row in set (0.01 sec)

1.2:用在DQL条件中

  • 单条件
mysql> select id from dept where json_value->'$.deptLeaderId'='4';
+----+
| id |
+----+
|  2 |
+----+
1 row in set (0.01 sec)
  • 和普通字段组合查询
mysql> select id from dept where json_value->'$.deptLeaderId'='4' and id>1;
+----+
| id |
+----+
|  2 |
+----+
1 row in set (0.01 sec)
  • json多条件
mysql> select id from dept where json_value->'$.deptLeaderId'='4' and json_value->'$.deptName' like '%部门%';
+----+
| id |
+----+
|  2 |
+----+
1 row in set (0.00 sec)

1.3:用在DQL关联查询中

先准备数据:

CREATE TABLE `dept_leader` (
  `id` int(11) NOT NULL,
  `leaderName` varchar(255) DEFAULT NULL,
  `json_value` json DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

insert into dept_leader VALUES(1,'leader1','{"name": "王一", "id": "1", "leaderId": "1"}');
insert into dept_leader VALUES(2,'leader2','{"name": "王二", "id": "2", "leaderId": "3"}');
insert into dept_leader VALUES(3,'leader3','{"name": "王三", "id": "3", "leaderId": "4"}');
insert into dept_leader VALUES(4,'leader4','{"name": "王四", "id": "4", "leaderId": "5"}');
insert into dept_leader VALUES(5,'leader5','{"name": "王五", "id": "5", "leaderId": "5"}');
  • 关联查询
mysql> SELECT dept.id,dept_leader.id from dept,dept_leader WHERE dept.json_value->'$.deptLeaderId'=dept_leader.json_value->'$.id' ;
+----+----+
| id | id |
+----+----+
|  1 |  3 |
|  2 |  4 |
|  3 |  5 |
|  4 |  5 |
|  5 |  5 |
|  6 |  5 |
|  7 |  5 |
|  8 |  5 |
+----+----+
8 rows in set (0.00 sec)

2:json_extract

语法格式json_extract(字段名,$.json字段名),用来从json字段中提取值,如下:

mysql> select id,json_extract(json_value,'$.deptName') as deptName from dept;
+----+------------------------------+
| id | deptName                     |
+----+------------------------------+
|  1 | "部门1"                      |
...

mysql> SELECT * FROM dept WHERE JSON_EXTRACT(json_value,'$.deptName') like '%部门%'\G
*************************** 1. row ***************************
        id: 1
      dept: 部门1
json_value: {"deptId": "1", "deptName": "部门1", "deptLeaderId": "3"}
*************************** 2. row ***************************
        id: 2
      dept: 部门2
json_value: {"deptId": "2", "newData": "新增的数据", "deptName": "新增的部门1111", "deptLeaderId": "4"}
...cx 

3:JSON_OBJECT()

语法格式JSON_OBJECT(k,v[,k,v]),用来转换指定数据为json object,如下:

mysql> select json_object("name", "张三", "age", 99);
+------------------------------------------+
| json_object("name", "张三", "age", 99)   |
+------------------------------------------+
| {"age": 99, "name": "张三"}              |
+------------------------------------------+
1 row in set (0.01 sec)

4:JSON_CONTAINS()

语法JSON_CONTAINS(target, candidate[, path]),用来判断json格式中是否包含指定子对象,其中子对象需要通过json_object()生成,如下:

mysql> select * from dept WHERE JSON_CONTAINS(json_value, JSON_OBJECT("deptName","部门5"))
    -> ;
+----+---------+-------------------------------------------------------------+
| id | dept    | json_value                                                  |
+----+---------+-------------------------------------------------------------+
|  5 | 部门5   | {"deptId": "5", "deptName": "部门5", "deptLeaderId": "5"}   |
+----+---------+-------------------------------------------------------------+
1 row in set (0.01 sec)

注意需要使用json_object转换为object。

添加如下数据,看一个嵌套json对象的例子:

insert into dept VALUES(6,'部门9','{"deptName": {"dept":"de","depp":"dd"}, "deptId": "5", "deptLeaderId": "5"}');

判断嵌套对象是否存在:

mysql> SELECT * from dept WHERE JSON_CONTAINS(json_value->'$.deptName',JSON_OBJECT("depp","dd"));
+----+---------+--------------------------------------------------------------------------------+
| id | dept    | json_value                                                                     |
+----+---------+--------------------------------------------------------------------------------+
|  6 | 部门9   | {"deptId": "5", "deptName": {"depp": "dd", "dept": "de"}, "deptLeaderId": "5"} |
+----+---------+--------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> SELECT * from ( SELECT *,json_value->'$.deptName' as deptName FROM dept ) t WHERE JSON_CONTAINS(deptName,JSON_OBJECT("depp","dd"));
...

5:JSON_ARRAY()

创建json数组,如下:

mysql> select json_array("pingpong","羽毛球","篮球");
+---------------------------------------------+
| json_array("pingpong","羽毛球","篮球")      |
+---------------------------------------------+
| ["pingpong", "羽毛球", "篮球"]              |
+---------------------------------------------+

mysql> select json_array(json_object("name", "张三"), "篮球", json_object("name", "李四"));
+------------------------------------------------------------------------------------+
| json_array(json_object("name", "张三"), "篮球", json_object("name", "李四"))       |
+------------------------------------------------------------------------------------+
| [{"name": "张三"}, "篮球", {"name": "李四"}]                                       |
+------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

json格式化看下:
在这里插入图片描述

5.1:判断数组是否是否包含某子数组

准备数据:

insert into dept VALUES(7,'部门9','{"deptName": ["1","2","3"], "deptId": "5", "deptLeaderId": "5"}');
insert into dept VALUES(7,'部门9','{"deptName": ["5","6","7"], "deptId": "5", "deptLeaderId": "5"}');

mysql> SELECT * from dept WHERE JSON_CONTAINS(json_value->'$.deptName',JSON_ARRAY("1"));
+----+---------+-------------------------------------------------------------------+
| id | dept    | json_value                                                        |
+----+---------+-------------------------------------------------------------------+
|  7 | 部门9   | {"deptId": "5", "deptName": ["1", "2", "3"], "deptLeaderId": "5"} |
+----+---------+-------------------------------------------------------------------+
1 row in set (0.05 sec)

6:JSON_TYPE()

获取类型:

mysql> SELECT json_value->'$.deptName' ,JSON_TYPE(json_value->'$.deptName') as type from dept;  
+------------------------------+--------+
| json_value->'$.deptName'     | type   |
+------------------------------+--------+
| "部门1"                      | STRING |
| "新增的部门1111"             | STRING |
| "部门3"                      | STRING |
| "部门4"                      | STRING |
| "部门5"                      | STRING |
| {"depp": "dd", "dept": "de"} | OBJECT |
| ["1", "2", "3"]              | ARRAY  |
| ["5", "6", "7"]              | ARRAY  |
+------------------------------+--------+

7:JSON_KEYS()

获取文档中所有的key,如下:

mysql> SELECT JSON_KEYS(json_value),json_value FROM dept where id=2\G
*************************** 1. row ***************************
JSON_KEYS(json_value): ["deptId", "newData", "deptName", "deptLeaderId"]
           json_value: {"deptId": "2", "newData": "新增的数据", "deptName": "新增的部门1111", "deptLeaderId": "4"}
1 row in set (0.01 sec)

8:JSON_SET()

更新或者是添加kv,无责插入,有则更新,语法格式JSON_SET(json_doc, path, val[, path, val] …),如下:

  • key存在时更新
mysql> select * from dept where id=1;
+----+---------+-------------------------------------------------------------+
| id | dept    | json_value                                                  |
+----+---------+-------------------------------------------------------------+
|  1 | 部门1   | {"deptId": "1", "deptName": "部门1", "deptLeaderId": "3"}   |
+----+---------+-------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> update dept set json_value=JSON_SET(json_value, '$.deptName', '部门1_更新后') where id=1;
Query OK, 1 row affected (0.02 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select * from dept where id=1;
+----+---------+-----------------------------------------------------------------------+
| id | dept    | json_value                                                            |
+----+---------+-----------------------------------------------------------------------+
|  1 | 部门1   | {"deptId": "1", "deptName": "部门1_更新后", "deptLeaderId": "3"}      |
+----+---------+-----------------------------------------------------------------------+
1 row in set (0.00 sec)
  • key不存在时插入
mysql> select * from dept where id=1;
+----+---------+-----------------------------------------------------------------------+
| id | dept    | json_value                                                            |
+----+---------+-----------------------------------------------------------------------+
|  1 | 部门1   | {"deptId": "1", "deptName": "部门1_更新后", "deptLeaderId": "3"}      |
+----+---------+-----------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> update dept set json_value=JSON_SET(json_value, '$.deptAddr', '赢创动力4楼') where id=1;
Query OK, 1 row affected (0.03 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select * from dept where id=1;
+----+---------+-------------------------------------------------------------------------------------------------------+
| id | dept    | json_value                                                                                            |
+----+---------+-------------------------------------------------------------------------------------------------------+
|  1 | 部门1   | {"deptId": "1", "deptAddr": "赢创动力4楼", "deptName": "部门1_更新后", "deptLeaderId": "3"}           |
+----+---------+-------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
  • 一个key不存在,一个key存在
mysql> select * from dept where id=1;
+----+---------+-------------------------------------------------------------------------------------------------------+
| id | dept    | json_value                                                                                            |
+----+---------+-------------------------------------------------------------------------------------------------------+
|  1 | 部门1   | {"deptId": "1", "deptAddr": "赢创动力4楼", "deptName": "部门1_更新后", "deptLeaderId": "3"}           |
+----+---------+-------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> update dept set json_value=JSON_SET(json_value, '$.deptAddr', '八维学院', '$.newKey', 'newKey的value') where id=1;
Query OK, 1 row affected (0.04 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select * from dept where id=1;                                                                      +----+---------+-------------------------------------------------------------------------------------------------------------------------------+
| id | dept    | json_value                                                                                                                    |
+----+---------+-------------------------------------------------------------------------------------------------------------------------------+
|  1 | 部门1   | {"deptId": "1", "newKey": "newKey的value", "deptAddr": "八维学院", "deptName": "部门1_更新后", "deptLeaderId": "3"}           |
+----+---------+-------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

9:JSON_INSERT()

语法格式JSON_INSERT(json_doc, path, val[, path, val] …),插入文档,当值已经存在时忽略,如下:

mysql> select * from dept where id=2;
+----+---------+-------------------------------------------------------------+
| id | dept    | json_value                                                  |
+----+---------+-------------------------------------------------------------+
|  2 | 部门2   | {"deptId": "2", "deptName": "部门2", "deptLeaderId": "4"}   |
+----+---------+-------------------------------------------------------------+
1 row in set (0.01 sec)

mysql> update dept set json_value=JSON_INSERT(json_value, '$.deptId', '已存在不更新', '$.addr', '西二旗') where id=2;
Query OK, 1 row affected (0.02 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select * from dept where id=2;                                                                      +----+---------+----------------------------------------------------------------------------------+
| id | dept    | json_value                                                                       |
+----+---------+----------------------------------------------------------------------------------+
|  2 | 部门2   | {"addr": "西二旗", "deptId": "2", "deptName": "部门2", "deptLeaderId": "4"}      |
+----+---------+----------------------------------------------------------------------------------+
1 row in set (0.00 sec)

10:JSON_REPLACE()

语法格式JSON_REPLACE(json_doc, path, val[, path, val] …),更新而不新增文档,如下:

mysql> update dept set json_value=JSON_REPLACE(json_value, '$.deptName', '部门2_新名称', '$.notExitsKey', '不会替换,因为不存在') where id=2;
Query OK, 1 row affected (0.02 sec)
Rows matched: 1  Changed: 1  Warnings: 0
mysql> select * from dept where id=2;                                                                      +----+---------+--------------------------------------------------------------------------------------------+
| id | dept    | json_value                                                                                 |
+----+---------+--------------------------------------------------------------------------------------------+
|  2 | 部门2   | {"addr": "西二旗", "deptId": "2", "deptName": "部门2_新名称", "deptLeaderId": "4"}         |
+----+---------+--------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

11:JSON_REMOVE()

语法格式JSON_REMOVE(json_doc, path[, path] …),删除文档:

mysql> select * from dept where id=3;
+----+---------+-------------------------------------------------------------+
| id | dept    | json_value                                                  |
+----+---------+-------------------------------------------------------------+
|  3 | 部门3   | {"deptId": "3", "deptName": "部门3", "deptLeaderId": "5"}   |
+----+---------+-------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> update dept set json_value=JSON_REMOVE(json_value, '$.depeName', '$.deptLeaderId') where id=3;
Query OK, 1 row affected (0.04 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select * from dept where id=3;
+----+---------+----------------------------------------+
| id | dept    | json_value                             |
+----+---------+----------------------------------------+
|  3 | 部门3   | {"deptId": "3", "deptName": "部门3"}   |
+----+---------+----------------------------------------+
1 row in set (0.00 sec)

12:JSON_SEARCH

在这里插入图片描述
语法格式JSON_SEARCH(json_doc,one_or_all,search_str [,escape_char [,path] ...]),
获取指定文档出现的位置,如果没有则返回NULL。

12.1:官方例子

  • 准备数据
mysql> SET @j = '["abc", [{"k": "10"}, "def"], {"x":"abc"}, {"y":"bcd"}]';
Query OK, 0 rows affected (0.00 sec)

mysql> select @j;
+---------------------------------------------------------+
| @j                                                      |
+---------------------------------------------------------+
| ["abc", [{"k": "10"}, "def"], {"x":"abc"}, {"y":"bcd"}] |
+---------------------------------------------------------+
1 row in set (0.01 sec)
  • 查询
mysql> SELECT JSON_SEARCH(@j, 'one', 'abc'); // 第二参数查询终止条件,设置为one,即只查询一个
+-------------------------------+
| JSON_SEARCH(@j, 'one', 'abc') |
+-------------------------------+
| "$[0]"                        |
+-------------------------------+
1 row in set (0.01 sec)

mysql> SELECT JSON_SEARCH(@j, 'all', 'abc'); // 第二个参数查询终止条件,设置为all,即查询所有匹配的
+-------------------------------+
| JSON_SEARCH(@j, 'all', 'abc') |
+-------------------------------+
| ["$[0]", "$[2].x"]            |
+-------------------------------+
1 row in set (0.01 sec)

mysql> SELECT JSON_SEARCH(@j, 'all', 'ghi'); // 全局匹配不存在的,会返回NULL
+-------------------------------+
| JSON_SEARCH(@j, 'all', 'ghi') |
+-------------------------------+
| NULL                          |
+-------------------------------+
1 row in set (0.00 sec)

mysql> SELECT JSON_SEARCH(@j, 'all', '10'); // 全局匹配10,返回具体位置的具体key
+------------------------------+
| JSON_SEARCH(@j, 'all', '10') |
+------------------------------+
| "$[1][0].k"                  |
+------------------------------+
1 row in set (0.01 sec)
  • 指定路径搜索
mysql> SELECT JSON_SEARCH(@j, 'all', '10', NULL, '$');
+-----------------------------------------+
| JSON_SEARCH(@j, 'all', '10', NULL, '$') |
+-----------------------------------------+
| "$[1][0].k"                             |
+-----------------------------------------+

mysql> SELECT JSON_SEARCH(@j, 'all', '10', NULL, '$[*]');
+--------------------------------------------+
| JSON_SEARCH(@j, 'all', '10', NULL, '$[*]') |
+--------------------------------------------+
| "$[1][0].k"                                |
+--------------------------------------------+

mysql> SELECT JSON_SEARCH(@j, 'all', '10', NULL, '$**.k');
+---------------------------------------------+
| JSON_SEARCH(@j, 'all', '10', NULL, '$**.k') |
+---------------------------------------------+
| "$[1][0].k"                                 |
+---------------------------------------------+

mysql> SELECT JSON_SEARCH(@j, 'all', '10', NULL, '$[*][0].k');
+-------------------------------------------------+
| JSON_SEARCH(@j, 'all', '10', NULL, '$[*][0].k') |
+-------------------------------------------------+
| "$[1][0].k"                                     |
+-------------------------------------------------+

mysql> SELECT JSON_SEARCH(@j, 'all', '10', NULL, '$[1]');
+--------------------------------------------+
| JSON_SEARCH(@j, 'all', '10', NULL, '$[1]') |
+--------------------------------------------+
| "$[1][0].k"                                |
+--------------------------------------------+

#指定搜索路径为数组中第二个元素内的第一个元素
mysql> SELECT JSON_SEARCH(@j, 'all', '10', NULL, '$[1][0]');
+-----------------------------------------------+
| JSON_SEARCH(@j, 'all', '10', NULL, '$[1][0]') |
+-----------------------------------------------+
| "$[1][0].k"                                   |
+-----------------------------------------------+

mysql> SELECT JSON_SEARCH(@j, 'all', 'abc', NULL, '$[2]');
+---------------------------------------------+
| JSON_SEARCH(@j, 'all', 'abc', NULL, '$[2]') |
+---------------------------------------------+
| "$[2].x"                                    |
+---------------------------------------------+
  • 模糊匹配
mysql> SELECT JSON_SEARCH(@j, 'all', '%a%');
+-------------------------------+
| JSON_SEARCH(@j, 'all', '%a%') |
+-------------------------------+
| ["$[0]", "$[2].x"]            |
+-------------------------------+

mysql> SELECT JSON_SEARCH(@j, 'all', '%b%');
+-------------------------------+
| JSON_SEARCH(@j, 'all', '%b%') |
+-------------------------------+
| ["$[0]", "$[2].x", "$[3].y"]  |
+-------------------------------+

# 指定搜索路径,$[0] = "abc"
mysql> SELECT JSON_SEARCH(@j, 'all', '%b%', NULL, '$[0]');
+---------------------------------------------+
| JSON_SEARCH(@j, 'all', '%b%', NULL, '$[0]') |
+---------------------------------------------+
| "$[0]"                                      |
+---------------------------------------------+

# $[2] = {"x":"abc"}
mysql> SELECT JSON_SEARCH(@j, 'all', '%b%', NULL, '$[2]');
+---------------------------------------------+
| JSON_SEARCH(@j, 'all', '%b%', NULL, '$[2]') |
+---------------------------------------------+
| "$[2].x"                                    |
+---------------------------------------------+

# $[1] = [{"k": "10"}, "def"] 模糊匹配无结果
mysql> SELECT JSON_SEARCH(@j, 'all', '%b%', NULL, '$[1]');
+---------------------------------------------+
| JSON_SEARCH(@j, 'all', '%b%', NULL, '$[1]') |
+---------------------------------------------+
| NULL                                        |
+---------------------------------------------+

mysql> SELECT JSON_SEARCH(@j, 'all', '%b%', '', '$[1]');
+-------------------------------------------+
| JSON_SEARCH(@j, 'all', '%b%', '', '$[1]') |
+-------------------------------------------+
| NULL                                      |
+-------------------------------------------+

mysql> SELECT JSON_SEARCH(@j, 'all', '%b%', '', '$[3]');
+-------------------------------------------+
| JSON_SEARCH(@j, 'all', '%b%', '', '$[3]') |
+-------------------------------------------+
| "$[3].y"                                  |
+-------------------------------------------+

12.2:实际例子

在日常开发过程中如果需要使用JSON_SEARCH查询的话,需要搭配IS NOT NULL来获取符合条件的数据,如果是返回是NULL则说明不存在,反之存在,所以,对于返回的具体位置信息我们一般是使用不到的,准备数据如下:

Create Table: CREATE TABLE `user` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(64) NOT NULL COMMENT '名字',
  `age` int(4) unsigned NOT NULL COMMENT '年龄',
  `info` text COMMENT '补充信息',
  PRIMARY KEY (`id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户表'

INSERT INTO `user` (`name`, `age`, `info`) VALUES ('suhw', '23', '{"phone":"12312123434","language":["c++","java","go"]}');
INSERT INTO `user` (`name`, `age`, `info`) VALUES ('bob', '20', '{"phone":"18912123434","language":["c++","c","go","php"]}');

查询会java和go语言的数据:

mysql> select * from user where json_search(info, 'all', 'go') is not null and json_search(info, 'all', 'java') is not null;
+----+------+-----+--------------------------------------------------------+
| id | name | age | info                                                   |
+----+------+-----+--------------------------------------------------------+
|  1 | suhw |  23 | {"phone":"12312123434","language":["c++","java","go"]} |
+----+------+-----+--------------------------------------------------------+
1 row in set (0.00 sec)

写在后面

参考文章列表

【MySQL】对JSON数据操作(全网最全) 。

MySQL - json_search 小结 。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/55150.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

HarmonyOS 开发基础(四) 子父组件双向绑定

一、知识点在代码注释里 index.ets // 导出方式直接从文件夹 import MyInput from "../common/commons/myInput" Entry Component /* 组件可以基于struct实现,组件不能有继承关系,struct可以比class更加快速的创建和销毁。*/ struct Index {…

【hive】Install hive using mysql as hive metadata service

文章目录 一. Requirements二. Installing Hive from a Stable Release三. Running Hive四. Running Hive CLI五.Running HiveServer2 and Beeline1. 下载安装mysql2. 下载mysql驱动3. 配置hive-site.xml4. 初始化元数据库5. 通过beeline进行连接 一. Requirements Users are s…

BES 平台 SDK之LED的配置

本文章是基于BES2700 芯片,其他BESxxx 芯片可做参考,如有不当之处,欢迎评论区留言指出。仅供参考学习用! BES 平台 SDK之代码架构讲解二_谢文浩的博客-CSDN博客 关于SDK 系统框架简介可参考上一篇文章。链接如上所示&#xff01…

防火墙监控工具

防火墙监控是跟踪在高效防火墙性能中起着关键作用的重要防火墙指标,防火墙监控通常应包括: 防火墙日志监控防火墙规则监控防火墙配置监控防火墙警报监控 防火墙监控服务的一个重要方面是它应该是主动的。主动识别内部和外部安全威胁有助于在早期阶段识…

Devops系统中jira平台迁移

需求:把aws中的devops系统迁移到华为云中,其中主要是jira系统中的数据迁移,主要方法为在华为云中建立一套 与aws相同的devops平台,再把数据库和文件系统中的数据迁移,最后进行测试。 主要涉及到的服务集群CCE、数据库mysql、弹性文件服务SFS、数据复制DRS、弹性负载均衡ELB。 迁…

你知道HTTP与HTTPS有什么区别吗?

作者:Insist-- 个人主页:insist--个人主页 作者会持续更新网络知识和python基础知识,期待你的关注 目录 一、什么是HTTP? 二、什么是HTTPS? 三、HTTPS 的工作原理 1、客户端发起 HTTPS 请求 2、服务端的配置 3、…

2023年第四届“华数杯”数学建模思路 - 案例:异常检测

文章目录 赛题思路一、简介 -- 关于异常检测异常检测监督学习 二、异常检测算法2. 箱线图分析3. 基于距离/密度4. 基于划分思想 赛题思路 (赛题出来以后第一时间在CSDN分享) https://blog.csdn.net/dc_sinor?typeblog 一、简介 – 关于异常检测 异常…

Arcgis 分区统计majority参数统计问题

利用Arcgis 进行分区统计时,需要统计不同矢量区域中栅格数据的众数(majority),出现无法统计majority参数问题解决 解决:利用copy raster工具,将原始栅格数据 64bit转为16bit

大数据课程E1——Flume的概述

文章作者邮箱:yugongshiyesina.cn 地址:广东惠州 ▲ 本章节目的 ⚪ 了解Ganglia的概念; ⚪ 了解Ganglia的拓扑结构和执行流程; ⚪ 掌握Ganglia的安装操作; 一、简介 1. 概述 1. Flume原本是由Cloude…

MySQL处理客户端请求

文章目录 一、连接管理二、解析与优化1、查询缓存2、语法解析3、查询优化 简单来说 MySQL 主要分为 Server 层和存储引擎层: Server 层:主要包括连接器、查询缓存、分析器、优化器、执行器等,所有跨存储引擎的功能都在这一层实现&#xff0c…

吃透《西瓜书》第四章 决策树定义与构造、ID3决策树、C4.5决策树、CART决策树

目录 一、基本概念 1.1 什么是信息熵? 1.2 决策树的定义与构造 二、决策树算法 2.1 ID3 决策树 2.2 C4.5 决策树 2.3 CART 决策树 一、基本概念 1.1 什么是信息熵? 信息熵: 熵是度量样本集合纯度最常用的一种指标,代表一个系统中蕴…

Android性能优化—ANR问题分析

一、ANR是什么? ANR(Application Not responding),是指应用程序未响应,Android系统对于一些事件需要在一定的时间范围内完成,如果超过预定时间能未能得到有效响应或者响应时间过长,都会造成ANR。可以简单的理解为应用…

想写几个上位机,是选择学c#还是 c++ qt呢?

C#基本也就上位机开发开发,另外做做日常用的小工具很方便。 结合PLC,以太网做上位机,这个基本上控制这块都比较有需求。 另外我们用C#也做一些工具的二次开发,感觉还行。 C用qt框架其实学习起来可能稍微复杂些,但是…

Vue引入

1. vue引入 第一种方法&#xff1a;在线引入 <script src"https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> 第二种方法&#xff1a;本地引入 2. 语法学习 el用于绑定id&#xff0c;data用于定义数据如下例题 <!DOCTYPE html> <html…

springboot基础--springboot配置说明

一、springboot中的配置文件 1、springboot为什么还需要用配置文件 方便我们修改springboot默认的配置;我们有其他的信息需要保存在配置文件中; 2、springboot中的配置文件有哪些 properties配置文件;yml配置文件; 3、springboot中的配置文件使用中注意事项 文件放入在sr…

数据中台系列2:rabbitMQ 安装使用之 window 篇

RabbitMQ 是一个开源的消息队列系统&#xff0c;是高级消息队列协议&#xff08;AMQP&#xff09;的标准实现&#xff0c;用 erlang 语言开发。 因此安装 RabbitMQ 之前要先安装好 erlang。 1、安装 erlang 到 这里 下载本机能运行的最新版 erlang 安装包。如果本机没有装过 …

eclipse版本与jdk版本对应关系

官网&#xff1a;Eclipse/Installation - Eclipsepedia eclipse历史版本&#xff08;2007-&#xff09;&#xff1a;Older Versions Of Eclipse - Eclipsepedia Eclipse Packaging Project (EPP) Releases | Eclipse Packages

行云管家荣获CFS第十二届财经峰会 “2023产品科技创新奖”

7月26日至27日&#xff0c;CFS第十二届财经峰会暨2023可持续商业大会在京盛大召开。峰会主题为“激活高质量发展澎湃活力”&#xff0c;超1000位政商领袖、专家学者、企业及媒体代表出席了本次盛会&#xff0c;共同分享新技术新产品新趋势、研判全球新挑战与新变局下企业的机遇…

K线与形态基础知识

一、单根K线的涨跌形态 实体&#xff1a;代表当日的股价涨跌幅大小&#xff0c;即波动大小&#xff0c;实体大&#xff0c;波动大。上影线&#xff1a;从实体向上延伸的即为上影线&#xff0c;表示股价上涨的轨迹&#xff0c;也是多方拉升意图的最佳表现&#xff0c;但是最终实…

uniapp 实现滑动元素并下方有滚动条显示

用uniapp实现下图的样式 代码如下&#xff1a; <template><view class"content"><view class"data-box" ref"dataBox" touchend"handleEnd"><view class"data-list"><view class"data-ite…