记一次postgres导致cpu100%

news2024/10/5 16:21:50

周末想打两把训练赛,没想到朋友发来一个截图
在这里插入图片描述
我:嗯??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]# w
 12: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 slice
  UNIT                                 LOAD   ACTIVE SUB    DESCRIPTION                    
  -.slice                              loaded active active Root Slice
  system-code\x2dserver.slice          loaded active active Slice /system/code-server
  UNIT                                 LOAD   ACTIVE SUB    DESCRIPTION                    
  -.slice                              loaded active active Root Slice
  system-code\x2dserver.slice          loaded active active Slice /system/code-server
  system-code\x2dserver\x2dafter.slice loaded active active Slice /system/code-server-after
  system-getty.slice                   loaded active active Slice /system/getty
  system-modprobe.slice                loaded active active Slice /system/modprobe
  system-serial\x2dgetty.slice         loaded active active Slice /system/serial-getty
  system-sshd\x2dkeygen.slice          loaded active active Slice /system/sshd-keygen
  system-systemd\x2dcoredump.slice     loaded active active Slice /system/systemd-coredump
  system-systemd\x2dfsck.slice         loaded active active Slice /system/systemd-fsck
  system.slice                         loaded active active System Slice
  user-26.slice                        loaded active active User Slice of UID 26
  user.slice                           loaded active active User and Session Slice

LOAD   = 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 26
     Loaded: loaded
    Drop-In: /usr/lib/systemd/system/user-.slice.d
             └─10-defaults.conf
     Active: active since Fri 2023-08-25 17:32:40 CST; 1 week 0 days ago
      Until: Fri 2023-08-25 17:32:40 CST; 1 week 0 days ago
       Docs: man:user@.service(5)
      Tasks: 17 (limit: 4281)
     Memory: 337.6M
        CPU: 36min 34.062s
     CGroup: /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还是被入侵了后面有空再看

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

分布式锁实现二. memcached分布式锁

文章目录 memcached分布式锁实现原理:优缺点 开发准备安装memcached服务端安装jar到maven本地仓库 代码开发初始化Memcached客户端锁相关操作核心代码本地运行效果docker运行效果 memcached分布式锁 实现原理: memcached带有add函数,利用ad…

【半监督医学图像分割】2022-MedIA-UWI

【半监督医学图像分割】2022-MedIA-UWI 论文题目:Semi-supervise d me dical image segmentation via a triple d-uncertainty guided mean teacher model with contrastive learning 中文题目:基于对比学习的三维不确定性指导平均教师模型的半监督图像分…

Linux编程--进程--fork使用,创建父子进程

1.使用fork函数创建一个进程 #include <unistd.h>pid_t fork(void); 返回值为0&#xff0c;代表当前进程是子进程 返回值为非负数&#xff0c;代表当前进程为父进程 调用失败&#xff0c;返回-1 代码&#xff1a; #include <stdio.h> #include <sys/types.h&g…

锁( ReentrantLock,Synchronized)

1.lock和synchronized 语法层面 synchronized 是关键字&#xff0c;源码在 jvm 中&#xff0c;用 c 语言实现&#xff1b; Lock 是接口&#xff0c;源码由 jdk 提供&#xff0c;用 java 语言实现&#xff1b; 使用 synchronized 时&#xff0c;退出同步代码块锁会自动释放&…

idea中设置指定图片为项目站标

前提是准备好一张图片 在idea中创建imgs文件夹&#xff0c;放入图片 创建一个HTML文件 建立链接link标签&#xff0c;链接照片即可 <link href"../02css/imgs/2.jpg" rel"shortcut icon" type"image/x-icon"> 执行效果如下图所示&…

音频——I2S 左对齐模式(三)

I2S 基本概念飞利浦(I2S)标准模式左(MSB)对齐标准模式右(LSB)对齐标准模式DSP 模式TDM 模式 文章目录 I2S left波形图逻辑分析仪抓包 I2S left I2S 左对齐标准 标准左对齐格式的数据的 MSB 没有相对于 BCLK 延迟一个时钟。左对齐格式的左右声道数据的 MSB 在 LRCLK 边沿变化后…

斐波那契数【动态规划】

斐波那契数 斐波那契数 &#xff08;通常用 F(n) 表示&#xff09;形成的序列称为 斐波那契数列 。该数列由 0 和 1 开始&#xff0c;后面的每一项数字都是前面两项数字的和。也就是&#xff1a; F(0) 0&#xff0c;F(1) 1 F(n) F(n - 1) F(n - 2)&#xff0c;其中 n >…

Golang:微服务常用代码分层结构

1.代码结构 代码分层结构是一个老生常谈的话题&#xff0c;好的代码结构能够使得系统易于理解、开发及维护&#xff0c;如果代码结构很混乱就会使得不同层级的代码块耦合&#xff0c;导致难以维护和拓展。 比较经典的代码结构&#xff08;宏观&#xff09;有Web的MVC模式分层结…

SpringBoot整合websockt实现消息对话

文章目录 前言websockt什么是websockt&#xff1f;websockt和Socket区别代码部分实战应用 前言 websockt 什么是websockt&#xff1f; WebSocket是一种在Web应用程序中实现实时双向通信的技术。Web应用程序通常是基于HTTP协议的&#xff0c;HTTP是一种请求/响应式的协议&…

【服务器使用基础】---华为云云耀云服务器实例使用实践

&#x1f996;我是Sam9029&#xff0c;一个前端 Sam9029的CSDN博客主页:Sam9029的博客_CSDN博客-JS学习,CSS学习,Vue-2领域博主 **&#x1f431;‍&#x1f409;&#x1f431;‍&#x1f409;恭喜你&#xff0c;若此文你认为写的不错&#xff0c;不要吝啬你的赞扬&#xff0c;求…

肖sir__linux详解__003(vim命令)

linux 文本编辑命令 作用&#xff1a;用于编辑一个文件 用法&#xff1a;vim 文件名称 或者vi &#xff08;1&#xff09;编辑一个存在的文档 例子&#xff1a;编辑一个file1文件 vim aa &#xff08;2&#xff09;编辑一个文件不存在&#xff0c;会先创建文件&#xff0c;再…

Python-图像拼接神器-stitching

多幅图像的拼接 采用这个包&#xff0c;图像拼接结果很好~ 代码只需要三四行 import stitching import cv2imgs ["data/test02/1Hill.jpg","data/test02/2Hill.jpg","data/test02/3Hill.jpg",] stitcher stitching.Stitcher() panorma stit…

postgresql-多表连接

postgresql-多表连接 内连接查询左外连接查询右外连接查询全外连接查询交叉连接查询简写 总结 内连接查询 内连接用于返回两个表中匹配的数据行&#xff0c;使用关键字INNER JOIN表示&#xff0c;也可以简写成JOIN&#xff1b; selecte.first_name ,d.department_id fromcps…

无涯教程-JavaScript - POISSON函数

POISSON函数取代了Excel 2010中的POISSON.DIST函数。 描述 该函数返回泊松分布。泊松分布的常见应用是预测特定时间的事件数。 语法 POISSON(x,mean,cumulative)争论 Argument描述Required/OptionalXThe number of events.RequiredMeanThe expected numeric value.Require…

leecode学习(1)

一、题目 给定一个数组nums和一个目标值target,请你再该数组中找出和为目标值的那两个数&#xff0c;并返回数组的下标&#xff0c;你可以假设输入只会对应一个答案&#xff0c;但是数组的同一个元素不能使用两次。 二、解题思路 目的就是要求出两数之和等于目标值嘛。 就是…

探索树堆Treap和红黑树的优势和劣势

探索树堆Treap和红黑树的优势和劣势 一、背景知识二、树堆&#xff08;Treap&#xff09;的介绍三、红黑树&#xff08;RB-Tree&#xff09;的介绍四、树堆&#xff08;Treap&#xff09;与红黑树&#xff08;RB-Tree&#xff09;的比较总结 博主简介 &#x1f4a1;一个热爱分享…

王道考研数据结构

文章目录 C 环境准备官方文档环境准备在线运行VSCode 环境报错解决 绪论线性表顺序表链表错题 栈、队列和数组栈队列栈的应用之中缀转后缀特殊矩阵用数组压缩存储错题 串模式匹配之暴力和KMP 树与二叉树二叉树树和森林哈夫曼树和哈夫曼编码并查集错题 图图的基本概念图的存储及…

LeetCode494. 目标和

494. 目标和 文章目录 [494. 目标和](https://leetcode.cn/problems/target-sum/)一、题目二、题解方法一&#xff1a;目标和路径计数算法方法二&#xff1a;01背包方法三&#xff1a;01背包一维数组 一、题目 给你一个非负整数数组 nums 和一个整数 target 。 向数组中的每个…

IPC进程间通信及示例代码

一. 什么是进程通信 进程通信&#xff08; InterProcess Communication&#xff0c;IPC&#xff09;就是指进程之间的信息交换。实际上&#xff0c;进程的同步与互斥本质上也是一种进程通信&#xff08;这也就是待会我们会在进程通信机制中看见信号量和 PV 操作的原因了&#x…

Ubuntu18.04使用Systemback制作系统镜像并还原

系列文章目录 文章目录 系列文章目录前言一、下载Systemback工具二、制作系统镜像到U盘三、安装制作系统 前言 在Ubuntu系统中开发项目时&#xff0c;有时会希望将项目移植到另外一台计算机&#xff08;如工控机等&#xff09;上进行部署&#xff0c;通常会在新计算机中安装Ub…