当前位置: 首页 > news >正文

记一次postgres导致cpu100%

周末想打两把训练赛,没想到朋友发来一个截图
在这里插入图片描述
我:嗯??wtf
于是我上服务器看了一下日志,诶我超,还真的
在这里插入图片描述
在这里插入图片描述

查看进程详情

[root@iZ7xv7q4im4c48qen2do2bZ project]# pstree -tp postgres
memory(904475)─┬─{memory}(904476)├─{memory}(904477)├─{memory}(904478)├─{memory}(904479)├─{memory}(904480)├─{memory}(904856)└─{memory}(904857)pg_mem(904437)─┬─{pg_mem}(904440)├─{pg_mem}(904441)├─{pg_mem}(904442)└─{pg_mem}(904444)psql(61378)systemd(61206)───(sd-pam)(61208)
[root@iZ7xv7q4im4c48qen2do2bZ project]# ps -aux
postgres  904437  0.1  2.3 730512 40128 ?        Ssl  12:09   0:01 postgres
postgres  904475 23.6 15.6 310828 265260 ?       Sl   12:09   3:32 postgres: autovacuum reader

查看是否有人ssh登录

[root@iZ7xv7q4im4c48qen2do2bZ project]# w12:26:20 up 8 days,  1:26,  0 users,  load average: 0.03, 0.15, 0.33
USER     TTY        LOGIN@   IDLE   JCPU   PCPU WHAT

查看登录记录

[root@iZ7xv7q4im4c48qen2do2bZ project]# last
root     pts/3        127.0.0.1        Sat Sep  2 12:08 - 12:08  (00:00)
root     pts/1        127.0.0.1        Mon Aug 28 10:09 - 12:02  (01:53)
root     pts/1        127.0.0.1        Fri Aug 25 17:41 - 17:41  (00:00)
root     pts/0        127.0.0.1        Fri Aug 25 11:50 - 14:04  (02:13)
root     pts/0        127.0.0.1        Fri Aug 25 11:01 - 11:50  (00:49)
reboot   system boot  5.14.0-350.el9.x Fri Aug 25 10:59   still running
root     pts/0        127.0.0.1        Fri Aug 25 09:54 - 10:59  (01:05)
admin    pts/0        100.104.200.30   Fri Aug 25 09:53 - 09:53  (00:00)
admin    pts/0        100.104.200.30   Fri Aug 25 09:53 - 09:53  (00:00)
reboot   system boot  5.14.0-350.el9.x Fri Aug 25 09:49 - 10:59  (01:10)
root     pts/0        127.0.0.1        Fri Aug 25 01:28 - 01:28  (00:00)
root     pts/0        127.0.0.1        Fri Aug 25 01:01 - 01:19  (00:17)
root     pts/1        127.0.0.1        Fri Aug 25 00:03 - 00:04  (00:01)
root     pts/0        127.0.0.1        Thu Aug 24 21:13 - 21:15  (00:01)
root     pts/0        127.0.0.1        Thu Aug 24 20:54 - 21:12  (00:18)
root     pts/0        127.0.0.1        Thu Aug 24 20:52 - 20:53  (00:01)
root     pts/0        127.0.0.1        Thu Aug 24 20:41 - 20:51  (00:10)
root     pts/0        127.0.0.1        Thu Aug 24 00:31 - 08:16  (07:44)
root     pts/2        127.0.0.1        Wed Aug 23 17:46 - 17:46  (00:00)
root     pts/2        127.0.0.1        Wed Aug 23 17:38 - 17:38  (00:00)
root     pts/2        127.0.0.1        Wed Aug 23 17:16 - 17:16  (00:00)
root     pts/2        127.0.0.1        Wed Aug 23 16:08 - 16:08  (00:00)
root     pts/2        127.0.0.1        Wed Aug 23 16:07 - 16:07  (00:00)
root     pts/2        127.0.0.1        Wed Aug 23 15:46 - 15:47  (00:00)
root     pts/1        127.0.0.1        Wed Aug 23 15:10 - 17:50  (02:39)
root     pts/1        127.0.0.1        Wed Aug 23 12:58 - 12:58  (00:00)
root     pts/1        127.0.0.1        Wed Aug 23 12:58 - 12:58  (00:00)
root     pts/1        127.0.0.1        Wed Aug 23 12:56 - 12:56  (00:00)
root     pts/1        127.0.0.1        Wed Aug 23 11:51 - 11:51  (00:00)
root     pts/1        127.0.0.1        Wed Aug 23 11:49 - 11:49  (00:00)
admin    pts/0        100.104.200.36   Wed Aug 23 11:41 - 17:57  (06:15)
admin    pts/0        100.104.200.36   Wed Aug 23 11:41 - 11:41  (00:00)
root     pts/0        127.0.0.1        Wed Aug 23 01:32 - 07:29  (05:57)
root     pts/0        127.0.0.1        Wed Aug 23 01:26 - 01:32  (00:05)
root     pts/0        127.0.0.1        Wed Aug 23 01:16 - 01:17  (00:01)
reboot   system boot  5.14.0-350.el9.x Wed Aug 23 01:06 - 10:59 (2+09:53)
admin    pts/0        100.104.200.27   Wed Aug 23 00:35 - crash  (00:30)
admin    pts/0        100.104.200.27   Wed Aug 23 00:35 - 00:35  (00:00)
reboot   system boot  5.14.0-350.el9.x Wed Aug 23 00:33 - 10:59 (2+10:26)
admin    pts/0        100.104.200.41   Wed Aug 23 00:08 - 00:32  (00:23)
admin    pts/0        100.104.200.41   Wed Aug 23 00:08 - 00:08  (00:00)
reboot   system boot  5.14.0-350.el9.x Wed Aug 23 00:08 - 10:59 (2+10:51)
admin    pts/0        100.104.200.30   Tue Aug 22 23:04 - 23:38  (00:33)
admin    pts/0        100.104.200.30   Tue Aug 22 23:04 - 23:04  (00:00)
reboot   system boot  5.14.0-350.el9.x Tue Aug 22 23:03 - 10:59 (2+11:56)
root     pts/1        127.0.0.1        Tue Aug 22 22:29 - 22:29  (00:00)
root     pts/1        127.0.0.1        Tue Aug 22 22:26 - 22:26  (00:00)
admin    pts/0        100.104.200.23   Tue Aug 22 21:50 - crash  (01:12)
admin    pts/0        100.104.200.23   Tue Aug 22 21:50 - 21:50  (00:00)
reboot   system boot  5.14.0-134.el9.x Tue Aug 22 21:45 - 10:59 (2+13:13)
reboot   system boot  5.14.0-134.el9.x Tue Aug  9 15:38 - 15:39  (00:00)wtmp begins Wed Jul 27 14:03:31 2022

查看进程详情

 [root@iZ7xv7q4im4c48qen2do2bZ project]top -p 904475
top - 12:34:17 up 8 days,  1:34,  0 users,  load average: 2.27, 1.78, 1.04
Tasks:   1 total,   0 running,   1 sleeping,   0 stopped,   0 zombie
%Cpu(s): 97.0 us,  1.8 sy,  0.0 ni,  0.2 id,  0.0 wa,  0.8 hi,  0.2 si,  0.0 st
MiB Mem :   1660.5 total,     74.1 free,   1510.4 used,    239.6 buff/cache
MiB Swap:   1025.0 total,   1025.0 free,      0.0 used.    150.1 avail Mem PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                             904475 postgres  20   0  325500 273364      0 S 189.0  16.1  15:46.91 memory    [root@iZ7xv7q4im4c48qen2do2bZ project]# ll /proc/904475
total 0
-r--r--r--  1 postgres postgres 0 Sep  2 12:34 arch_status
dr-xr-xr-x  2 postgres postgres 0 Sep  2 12:34 attr
-rw-r--r--  1 postgres postgres 0 Sep  2 12:34 autogroup
-r--------  1 postgres postgres 0 Sep  2 12:34 auxv
-r--r--r--  1 postgres postgres 0 Sep  2 12:32 cgroup
--w-------  1 postgres postgres 0 Sep  2 12:34 clear_refs
-r--r--r--  1 postgres postgres 0 Sep  2 12:09 cmdline
-rw-r--r--  1 postgres postgres 0 Sep  2 12:09 comm
-rw-r--r--  1 postgres postgres 0 Sep  2 12:34 coredump_filter
-r--r--r--  1 postgres postgres 0 Sep  2 12:34 cpu_resctrl_groups
-r--r--r--  1 postgres postgres 0 Sep  2 12:34 cpuset
lrwxrwxrwx  1 postgres postgres 0 Sep  2 12:09 cwd -> /tmp
-r--------  1 postgres postgres 0 Sep  2 12:34 environ
lrwxrwxrwx  1 postgres postgres 0 Sep  2 12:09 exe -> /var/tmp/other_project/memory
dr-x------  2 postgres postgres 0 Sep  2 12:09 fd
dr-xr-xr-x  2 postgres postgres 0 Sep  2 12:34 fdinfo
-rw-r--r--  1 postgres postgres 0 Sep  2 12:34 gid_map
-r--------  1 postgres postgres 0 Sep  2 12:09 io
-r--------  1 postgres postgres 0 Sep  2 12:34 ksm_merging_pages
-r--r--r--  1 postgres postgres 0 Sep  2 12:34 limits
-rw-r--r--  1 postgres postgres 0 Sep  2 12:34 loginuid
dr-x------  2 postgres postgres 0 Sep  2 12:34 map_files
-r--r--r--  1 postgres postgres 0 Sep  2 12:34 maps
-rw-------  1 postgres postgres 0 Sep  2 12:34 mem
-r--r--r--  1 postgres postgres 0 Sep  2 12:34 mountinfo
-r--r--r--  1 postgres postgres 0 Sep  2 12:34 mounts
-r--------  1 postgres postgres 0 Sep  2 12:34 mountstats
dr-xr-xr-x 56 postgres postgres 0 Sep  2 12:34 net
dr-x--x--x  2 postgres postgres 0 Sep  2 12:34 ns
-r--r--r--  1 postgres postgres 0 Sep  2 12:34 numa_maps
-rw-r--r--  1 postgres postgres 0 Sep  2 12:34 oom_adj
-r--r--r--  1 postgres postgres 0 Sep  2 12:34 oom_score
-rw-r--r--  1 postgres postgres 0 Sep  2 12:34 oom_score_adj
-r--------  1 postgres postgres 0 Sep  2 12:34 pagemap
-r--------  1 postgres postgres 0 Sep  2 12:34 patch_state
-r--------  1 postgres postgres 0 Sep  2 12:34 personality
-rw-r--r--  1 postgres postgres 0 Sep  2 12:34 projid_map
lrwxrwxrwx  1 postgres postgres 0 Sep  2 12:34 root -> /
-rw-r--r--  1 postgres postgres 0 Sep  2 12:34 sched
-r--r--r--  1 postgres postgres 0 Sep  2 12:34 schedstat
-r--r--r--  1 postgres postgres 0 Sep  2 12:34 sessionid
-rw-r--r--  1 postgres postgres 0 Sep  2 12:34 setgroups
-r--r--r--  1 postgres postgres 0 Sep  2 12:34 smaps
-r--r--r--  1 postgres postgres 0 Sep  2 12:34 smaps_rollup
-r--------  1 postgres postgres 0 Sep  2 12:34 stack
-r--r--r--  1 postgres postgres 0 Sep  2 12:09 stat
-r--r--r--  1 postgres postgres 0 Sep  2 12:09 statm
-r--r--r--  1 postgres postgres 0 Sep  2 12:09 status
-r--------  1 postgres postgres 0 Sep  2 12:34 syscall
dr-xr-xr-x 10 postgres postgres 0 Sep  2 12:34 task
-rw-r--r--  1 postgres postgres 0 Sep  2 12:34 timens_offsets
-r--r--r--  1 postgres postgres 0 Sep  2 12:34 timers
-rw-rw-rw-  1 postgres postgres 0 Sep  2 12:34 timerslack_ns
-rw-r--r--  1 postgres postgres 0 Sep  2 12:34 uid_map
-r--r--r--  1 postgres postgres 0 Sep  2 12:34 wchan

这postgres在干啥,用了99%的cpu

查看系统服务

[root@iZ7xv7q4im4c48qen2do2bZ project]#systemctl  status └─user-26.slice├─session-5922.scope│ ├─904437 postgres│ └─904475 "postgres: autovacuum reader"├─session-c7.scope│ └─61378 psql└─user@26.service└─init.scope├─61206 /usr/lib/systemd/systemd --user└─61208 "(sd-pam)"
[root@iZ7xv7q4im4c48qen2do2bZ project]# systemctl -t sliceUNIT                                 LOAD   ACTIVE SUB    DESCRIPTION                    -.slice                              loaded active active Root Slicesystem-code\x2dserver.slice          loaded active active Slice /system/code-serverUNIT                                 LOAD   ACTIVE SUB    DESCRIPTION                    -.slice                              loaded active active Root Slicesystem-code\x2dserver.slice          loaded active active Slice /system/code-serversystem-code\x2dserver\x2dafter.slice loaded active active Slice /system/code-server-aftersystem-getty.slice                   loaded active active Slice /system/gettysystem-modprobe.slice                loaded active active Slice /system/modprobesystem-serial\x2dgetty.slice         loaded active active Slice /system/serial-gettysystem-sshd\x2dkeygen.slice          loaded active active Slice /system/sshd-keygensystem-systemd\x2dcoredump.slice     loaded active active Slice /system/systemd-coredumpsystem-systemd\x2dfsck.slice         loaded active active Slice /system/systemd-fscksystem.slice                         loaded active active System Sliceuser-26.slice                        loaded active active User Slice of UID 26user.slice                           loaded active active User and Session SliceLOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.[root@iZ7xv7q4im4c48qen2do2bZ project]# systemctl status user-26.slice 
● user-26.slice - User Slice of UID 26Loaded: loadedDrop-In: /usr/lib/systemd/system/user-.slice.d└─10-defaults.confActive: active since Fri 2023-08-25 17:32:40 CST; 1 week 0 days agoUntil: Fri 2023-08-25 17:32:40 CST; 1 week 0 days agoDocs: man:user@.service(5)Tasks: 17 (limit: 4281)Memory: 337.6MCPU: 36min 34.062sCGroup: /user.slice/user-26.slice├─session-5922.scope│ ├─904437 postgres│ └─904475 "postgres: autovacuum reader"├─session-c7.scope│ └─61378 psql
Sep 02 12:50:40 iZ7xv7q4im4c48qen2do2bZ systemd[910257]: Created slice User Background Tasks Slice.
Sep 02 12:50:40 iZ7xv7q4im4c48qen2do2bZ systemd[910257]: Starting Cleanup of User's Temporary Files and Directories...
Sep 02 12:50:40 iZ7xv7q4im4c48qen2do2bZ systemd[910257]: Finished Cleanup of User's Temporary Files and Directories.
Sep 02 12:51:01 iZ7xv7q4im4c48qen2do2bZ CROND[911181]: (postgres) CMD (/var/lib/pgsql/data/pg_mem nLTlZMOfS1ekfDPMUgBASqHkjsz1bMc/WqOiBI8v>
Sep 02 12:52:01 iZ7xv7q4im4c48qen2do2bZ CROND[911305]: (postgres) CMD (/var/lib/pgsql/data/pg_mem nLTlZMOfS1ekfDPMUgBASqHkjsz1bMc/WqOiBI8v>
Sep 02 12:53:01 iZ7xv7q4im4c48qen2do2bZ CROND[911380]: (postgres) CMD (/var/lib/pgsql/data/pg_mem nLTlZMOfS1ekfDPMUgBASqHkjsz1bMc/WqOiBI8v>
Sep 02 12:54:01 iZ7xv7q4im4c48qen2do2bZ CROND[911454]: (postgres) CMD (/var/lib/pgsql/data/pg_mem nLTlZMOfS1ekfDPMUgBASqHkjsz1bMc/WqOiBI8v>
Sep 02 12:55:02 iZ7xv7q4im4c48qen2do2bZ CROND[911537]: (postgres) CMD (/var/lib/pgsql/data/pg_mem nLTlZMOfS1ekfDPMUgBASqHkjsz1bMc/WqOiBI8v>
Sep 02 12:56:01 iZ7xv7q4im4c48qen2do2bZ CROND[911877]: (postgres) CMD (/var/lib/pgsql/data/pg_mem nLTlZMOfS1ekfDPMUgBASqHkjsz1bMc/WqOiBI8v>
Sep 02 12:57:01 iZ7xv7q4im4c48qen2do2bZ CROND[912045]: (postgres) CMD (/var/lib/pgsql/data/pg_mem nLTlZMOfS1ekfDPMUgBASqHkjsz1bMc/WqOiBI8v>[root@iZ7xv7q4im4c48qen2do2bZ project]# systemctl cat user-26.slice 
# /usr/lib/systemd/system/user-.slice.d/10-defaults.conf
#  SPDX-License-Identifier: LGPL-2.1-or-later
#
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.[Unit]
Description=User Slice of UID %j
Documentation=man:user@.service(5)
StopWhenUnneeded=yes[Slice]
TasksMax=33%[root@iZ7xv7q4im4c48qen2do2bZ project]#find /usr/lib/systemd/system -name *user-26*[root@iZ7xv7q4im4c48qen2do2bZ project]# find / -name *user-26*
/sys/fs/cgroup/user.slice/user-26.slice# 查看网络访问
[root@iZ7xv7q4im4c48qen2do2bZ user-26.slice]# netstat -antpu |grep post
tcp        0      1 172.18.42.125:35246     157.240.8.36:13333      SYN_SENT    10084/postgres: aut systemd-cgtop
[root@iZ7xv7q4im4c48qen2do2bZ cgroup]# find / -name *session-122.scope*
/run/systemd/transient/session-122.scope
/run/systemd/units/invocation:session-122.scope
/sys/fs/cgroup/user.slice/user-26.slice/session-122.scope[root@iZ7xv7q4im4c48qen2do2bZ cgroup]# systemd-cgls
├─user.slice (#1213)
│ → user.invocation_id: 3c49f5127e624ba4865bad4633078564
│ → trusted.invocation_id: 3c49f5127e624ba4865bad4633078564
│ └─user-26.slice (#15590)
│   → user.invocation_id: ffc42d8b229c438a9bde46d2ca97e78b
│   → trusted.invocation_id: ffc42d8b229c438a9bde46d2ca97e78b
│   ├─user@26.service … (#15660)
│   │ → user.delegate: 1
│   │ → trusted.delegate: 1
│   │ → user.invocation_id: 1178a7bb2d6c47d7b00ccc2d8e13776a
│   │ → trusted.invocation_id: 1178a7bb2d6c47d7b00ccc2d8e13776a
│   │ └─init.scope (#15695)
│   │   ├─18728 /usr/lib/systemd/systemd --user
│   │   └─18729 (sd-pam)
│   └─session-170.scope (#15835)
│     → user.invocation_id: 09dfca512d4e4535a23c270e4ce2df41
│     → trusted.invocation_id: 09dfca512d4e4535a23c270e4ce2df41
│     ├─18740 postgres
│     └─18776 postgres: autovacuum reader

确定了是利用了user-26.slice进行自启动user@26.service,user@26.service又启动了18776 postgres: autovacuum reader

#终止session又会自启动
systemctl kill session-122.scope

有知道怎么终止user-26.slice的跟我说下,网上找一圈没找到方法,去redhat也搜不到。

最终解决方案

# 因为这个账户是dnf install postgresql 创建的,目前postgresql服务已经停了就直接删除这个用户,阻止他自启动
userdel postgres -f

其实锁定用户应该也行,至于问题的原因是postgresql的bug还是被入侵了后面有空再看

相关文章:

记一次postgres导致cpu100%

周末想打两把训练赛,没想到朋友发来一个截图 我:嗯??wtf 于是我上服务器看了一下日志,诶我超,还真的 查看进程详情 [rootiZ7xv7q4im4c48qen2do2bZ project]# pstree -tp postgres memory(904475)─┬─…...

详谈SpringBoot启动项目后执行自定义方法的方式

在 main 启动函数中调用 这个是在所有启动后执行,也是常用之一。 SpringBootApplication public class ListenerApplication {public static void main(String[] args) {SpringApplication.run(ListenerApplication.class, args);System.out.println("启动成…...

KubeAdmin方式搭建K8S(1.26.0)

本次安装K8S版本为1.26.0 服务器环境配置 ip描述配置192.168.233.221master节点CPU(2C) 内存(2G) 硬盘(50G)192.168.233.222node1节点CPU(2C) 内存(2G) 硬盘…...

代码随想录打卡—day57—【编辑距离】— 9.2+9.3 编辑距离系列

1 647. 回文子串 647. 回文子串 纯暴力解法&#xff0c;应该是O&#xff08;n^3&#xff09;&#xff0c;居然AC了&#xff1a; class Solution { public:int countSubstrings(string s) {// 暴力int cnt 0;cout << s.substr(1,1);for(int i 0; i < s.size();i){…...

Blender界面学习03 原点、鼠标所在位置的缩放与旋转

物体的坐标原点可以移动 放大缩小时默认是屏幕中央&#xff0c;修改为鼠标在哪儿就缩放哪儿 默认旋转时围绕屏幕的中心 可以修改为指定对象旋转...

指针结构体题

目录 初阶指针_指针的概念 1.使用指针打印数组内容 2.字符串逆序 3.整形数组和字符串数组 4.打印菱形 5.打印水仙花数 6.计算求和 结构体 7.喝汽水问题 8.程序死循环解释 9.选择题总结tips 今天是重点是指针&结构体题题目。&#x1f197;&#x1f197;&#x…...

【力扣每日一题02】数组篇--删除有序数组中的重复项

一、题目 给你一个 升序排列 的数组 nums &#xff0c; 请你原地删除重复出现的元素&#xff0c;使每个元素 只出现一次 返回删除后数组的新长度。 元素的 相对顺序 应该保持 一致 。 然后返回 nums 中唯一元素的个数。 二、思路解析 这道题要用到 “双指针” 的概念&…...

Vue在表格中拿到该行信息的方式(作用域插槽-#default-scope-解决按钮与行点击的顺序问题)

遇到的问题 在做表格的时候&#xff0c;表格是封装好了的&#xff0c;用于展示数据。如果想给单行增加按钮&#xff0c;可以单独写一列存放按钮&#xff0c;最基本的需求是&#xff0c;点击按钮后要拿到数据然后发起请求。 且Vue的element-plus&#xff0c;当我们点击按钮之后…...

OJ练习第158题——单词拆分 II

单词拆分 II 力扣链接&#xff1a;140. 单词拆分 II 题目描述 给定一个字符串 s 和一个字符串字典 wordDict &#xff0c;在字符串 s 中增加空格来构建一个句子&#xff0c;使得句子中所有的单词都在词典中。以任意顺序 返回所有这些可能的句子。 注意&#xff1a;词典中的…...

ArcGIS地块面积分割调整工具插件

地块分割调整工具可以实现将选定的图斑按照面积比例或者指定的面积&#xff0c;分割成多个图斑。 各个图斑的面积用逗号分隔&#xff0c;比例分割设置时&#xff0c;用整数表示。 面积分割时&#xff0c;最后一个图斑的面积可以不写&#xff0c;插件可以自动计算图斑的面积&a…...

基于Matlab实现多个图像增强案例(附上源码+数据集)

图像增强是数字图像处理中的一个重要步骤&#xff0c;它通过一系列的算法和技术&#xff0c;使图像在视觉上更加清晰、明亮、对比度更强等&#xff0c;以便更好地满足人们的需求。在本文中&#xff0c;我们将介绍如何使用Matlab实现图像增强。 文章目录 部分源码源码数据集下载…...

计算机网络 概述部分

目录 计算机网络在信息时代的作用 计算机网络的重要特征 网络&#xff0c;internet,Internet的区别 局域网 广域网的区别 网络协议的分层 计算机网络在信息时代的作用 计算机网络的重要特征 连通性&#xff1a;彼此联通&#xff0c;交换信息 共享性&#xff1a;信息共享…...

使用DOSBOX运行TurboC2,TC2使用graphics库绘图

Turbo C是由美国Borland公司开发的一套C语言程序开发工具&#xff0c;Borland公司是一家专门从事软件开发、研制的大公司。该公司相继推出了一套Turbo系列软件&#xff0c;如Turbo BASIC、Turbo Pascal、Turbo Prolog&#xff0c;这些软件很受用户欢迎 [1] 。 Turbo C集成了程序…...

OpenCV(二):认识Mat容器

目录 1.什么是Mat类 2.Mat类能存储的数据 整数类型&#xff08;有符号和无符号&#xff09;&#xff1a; 浮点数类型&#xff1a; 布尔类型&#xff1a; 3.Mat类的创建 1.利用矩阵宽、高和类型参数创建Mat类 2.利用矩陈Size(结构和数据类型参数创建Mat类 3.利用已有Mat…...

springboot整合Excel填充数据

填充一组数据 准备模板 封装数据 import java.util.ArrayList; import java.util.List;/*** 使用实体类封装填充数据** 实体中成员变量名称需要和Excel表各种{}包裹的变量名匹配*/ Data public class FillData {private String name;private int age;// 生成多组数据代码pub…...

c语言技术面试记录 ---- 纲要、题目、分析及给分标准

纲要 作为一个面试官&#xff0c;除了编程类的问题&#xff0c;你还可以考虑问一些关于技术知识、项目经验、解决问题能力和团队合作等方面的问题&#xff0c;以全面评估应聘者的能力和适应性。以下是一个可能的提问逻辑和大纲&#xff0c;供你参考&#xff1a; 技术知识和基…...

前端进阶之——模块化

在做项目的时候越来越发现模块化的重要性&#xff0c;做好模块化开发不仅给后期的维护带来不少好处而且大大提升项目开发效率&#xff0c;接下来整理一下模块化相关知识吧。 模块化开发的优点 封装方法、提高代码的复用性、可维护性和可读性隔离作用域&#xff0c;避免污染全…...

Python爬虫抓取表情包制作个性化聊天机器人

在现代社交媒体和即时通讯应用中&#xff0c;使用表情包已经成为一种流行的沟通方。本文将介绍如何利用Python编写一个简单而有趣的聊天机器人&#xff0c;并通过爬虫技术来抓取各类表情包&#xff0c;使其具备个性化特点。   1.确定需求与功能   -定义聊天机器人需要实现哪…...

使用pip命令安装库,装到其他环境中的问题。

问题描述&#xff1a;我们在pycharm中创建了新的虚拟环境&#xff0c;但是在其终端使用Pip命令安装库时&#xff0c;发现库却安装到了其他conda创建的环境中。图示安装gym库&#xff0c;刚开始安装到了其他地方&#xff0c;第二次正确安装。 原因分析&#xff1a;安装库时&…...

如何使用CSS实现一个带有动画效果的进度条?

聚沙成塔每天进步一点点 ⭐ 专栏简介⭐ HTML 结构&#xff1a;⭐ CSS 样式&#xff1a;⭐ 写在最后 ⭐ 专栏简介 前端入门之旅&#xff1a;探索Web开发的奇妙世界 记得点击上方或者右侧链接订阅本专栏哦 几何带你启航前端之旅 欢迎来到前端入门之旅&#xff01;这个专栏是为那…...

网络六边形受到攻击

大家读完觉得有帮助记得关注和点赞&#xff01;&#xff01;&#xff01; 抽象 现代智能交通系统 &#xff08;ITS&#xff09; 的一个关键要求是能够以安全、可靠和匿名的方式从互联车辆和移动设备收集地理参考数据。Nexagon 协议建立在 IETF 定位器/ID 分离协议 &#xff08;…...

java_网络服务相关_gateway_nacos_feign区别联系

1. spring-cloud-starter-gateway 作用&#xff1a;作为微服务架构的网关&#xff0c;统一入口&#xff0c;处理所有外部请求。 核心能力&#xff1a; 路由转发&#xff08;基于路径、服务名等&#xff09;过滤器&#xff08;鉴权、限流、日志、Header 处理&#xff09;支持负…...

大话软工笔记—需求分析概述

需求分析&#xff0c;就是要对需求调研收集到的资料信息逐个地进行拆分、研究&#xff0c;从大量的不确定“需求”中确定出哪些需求最终要转换为确定的“功能需求”。 需求分析的作用非常重要&#xff0c;后续设计的依据主要来自于需求分析的成果&#xff0c;包括: 项目的目的…...

Java如何权衡是使用无序的数组还是有序的数组

在 Java 中,选择有序数组还是无序数组取决于具体场景的性能需求与操作特点。以下是关键权衡因素及决策指南: ⚖️ 核心权衡维度 维度有序数组无序数组查询性能二分查找 O(log n) ✅线性扫描 O(n) ❌插入/删除需移位维护顺序 O(n) ❌直接操作尾部 O(1) ✅内存开销与无序数组相…...

系统设计 --- MongoDB亿级数据查询优化策略

系统设计 --- MongoDB亿级数据查询分表策略 背景Solution --- 分表 背景 使用audit log实现Audi Trail功能 Audit Trail范围: 六个月数据量: 每秒5-7条audi log&#xff0c;共计7千万 – 1亿条数据需要实现全文检索按照时间倒序因为license问题&#xff0c;不能使用ELK只能使用…...

渲染学进阶内容——模型

最近在写模组的时候发现渲染器里面离不开模型的定义,在渲染的第二篇文章中简单的讲解了一下关于模型部分的内容,其实不管是方块还是方块实体,都离不开模型的内容 🧱 一、CubeListBuilder 功能解析 CubeListBuilder 是 Minecraft Java 版模型系统的核心构建器,用于动态创…...

大数据学习(132)-HIve数据分析

​​​​&#x1f34b;&#x1f34b;大数据学习&#x1f34b;&#x1f34b; &#x1f525;系列专栏&#xff1a; &#x1f451;哲学语录: 用力所能及&#xff0c;改变世界。 &#x1f496;如果觉得博主的文章还不错的话&#xff0c;请点赞&#x1f44d;收藏⭐️留言&#x1f4…...

Rapidio门铃消息FIFO溢出机制

关于RapidIO门铃消息FIFO的溢出机制及其与中断抖动的关系&#xff0c;以下是深入解析&#xff1a; 门铃FIFO溢出的本质 在RapidIO系统中&#xff0c;门铃消息FIFO是硬件控制器内部的缓冲区&#xff0c;用于临时存储接收到的门铃消息&#xff08;Doorbell Message&#xff09;。…...

Unsafe Fileupload篇补充-木马的详细教程与木马分享(中国蚁剑方式)

在之前的皮卡丘靶场第九期Unsafe Fileupload篇中我们学习了木马的原理并且学了一个简单的木马文件 本期内容是为了更好的为大家解释木马&#xff08;服务器方面的&#xff09;的原理&#xff0c;连接&#xff0c;以及各种木马及连接工具的分享 文件木马&#xff1a;https://w…...

用机器学习破解新能源领域的“弃风”难题

音乐发烧友深有体会&#xff0c;玩音乐的本质就是玩电网。火电声音偏暖&#xff0c;水电偏冷&#xff0c;风电偏空旷。至于太阳能发的电&#xff0c;则略显朦胧和单薄。 不知你是否有感觉&#xff0c;近两年家里的音响声音越来越冷&#xff0c;听起来越来越单薄&#xff1f; —…...