AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[centos7](server)

Martin Hope
SaHu
Asked: 2024-04-22 18:12:48 +0800 CST

为什么 OOM Killer 没有捕获明显的行为不当的进程?

  • 5

在 CentOS 7(带有 3.10 内核)服务器上,我惊讶地发现 mysqld 进程被“oomkilled”。原因很明显,我有时会运行一个非常消耗内存的进程(WebTorrent),有时会变得令人厌恶(看起来像内存泄漏)。对我来说没关系,只要发生这种情况时它就会被杀死。在另一个系统(Debian 11)上,这是实际行为,但在较旧的 CentOS 7 上,其他进程被杀死,我不明白为什么不是最明显的一个?

从日志(仅选定的行):

Apr 20 09:12:57 vps001 kernel: mysqld invoked oom-killer: gfp_mask=0x201da, order=0, oom_score_adj=0
Apr 20 09:12:58 vps001 kernel: Out of memory (oom_kill_allocating_task): Kill process 996 (mysqld) score 0 or sacrifice child
Apr 20 09:12:58 vps001 kernel: Killed process 918 (mysqld), UID 27, total-vm:2184052kB, anon-rss:18492kB, file-rss:0kB, shmem-rss:0kB
--
Apr 20 09:26:40 vps001 kernel: in:imjournal invoked oom-killer: gfp_mask=0x201da, order=0, oom_score_adj=0
Apr 20 09:26:40 vps001 kernel: Out of memory (oom_kill_allocating_task): Kill process 663 (in:imjournal) score 0 or sacrifice child
Apr 20 09:26:40 vps001 kernel: Killed process 653 (rsyslogd), UID 0, total-vm:308640kB, anon-rss:340kB, file-rss:0kB, shmem-rss:156kB
--
Apr 20 09:26:40 vps001 kernel: tmux invoked oom-killer: gfp_mask=0x201da, order=0, oom_score_adj=0
Apr 20 09:26:41 vps001 kernel: Out of memory (oom_kill_allocating_task): Kill process 23040 (tmux) score 0 or sacrifice child
Apr 20 09:26:41 vps001 kernel: Killed process 23041 (bash), UID 0, total-vm:115680kB, anon-rss:0kB, file-rss:4kB, shmem-rss:0kB
--
Apr 20 09:26:41 vps001 kernel: node invoked oom-killer: gfp_mask=0x200da, order=0, oom_score_adj=0
Apr 20 09:26:41 vps001 kernel: Out of memory (oom_kill_allocating_task): Kill process 23241 (node) score 0 or sacrifice child
Apr 20 09:26:41 vps001 kernel: Killed process 23239 (WebTorrent), UID 1000, total-vm:14750096kB, anon-rss:1618448kB, file-rss:0kB, shmem-rss:0kB

3 个进程在好的进程之前被杀死,原因我无法理解。

我期望的事情:

  • 消耗内存最多的进程被杀死
  • UID 0 的进程不会在其他 UID 之前被杀死
  • UID 27 比 UID 1000 更“重要”

我想更好地理解 OOM 行为,特别是为什么我所有的假设都是错误的。

centos7
  • 1 个回答
  • 35 Views
Martin Hope
OsakaWebbie
Asked: 2023-11-30 11:03:05 +0800 CST

MariaDB 重新安装并升级到新版本后,Monit 抱怨校验和失败

  • 5

我有一个运行 CentOS 7 的 Linode VPS 和一些旧版本的 Web 相关服务(因为我编写的代码还没有准备好用于新版本 - 我计划使用新的一切和更新的代码构建一个新的 VPS,但是那需要时间)。

最近,VPS 迁移到了新硬件。重新启动后,MariaDB 10.2 将不会重新启动。经过两天的绞尽脑汁,我通过删除并重新安装 mariadb-server 让它工作起来,再加上仔细的文件管理让它识别我的 InnoDB 数据文件。

MariaDB 10.2 已结束生命周期,自 2022 年 5 月起不再受支持,因此不再位于http://yum.mariadb.org中,因此我必须安装 10.4(我只将 中的一位数字MariaDB.repo从更改baseurl=http://yum.mariadb.org/10.2/centos7-amd64为baseurl=http://yum.mariadb.org/10.4/centos7-amd64)。

据我所知,一切都运行良好。但是,每当我尝试让 Monit 再次开始监视该服务时,它都会拒绝,并且我收到两封通知电子邮件,内容为“Checksum failed Service mariadb_bin”和“Checksum failed Service mariadb_init”。

我用的是最权威的镜子吧?那么为什么会出现校验和问题呢?

这是 MariaDB 的 Monit 文件:

## Mariadb monitoring.

## Test the mariadb service.
check process mariadb with pidfile /run/mariadb/mariadb.pid
  group database
  start program = "/usr/bin/systemctl start mariadb"
  stop  program = "/usr/bin/systemctl stop mariadb"
  restart program  = "/usr/bin/systemctl restart mariadb"
  if failed port 3306 protocol mysql then restart
  if 3 restarts within 5 cycles then timeout
  # This process check depends on checking the binary if the mariadb
  # daemon and the init script.
  depends on mariadb_bin
  depends on mariadb_init
  alert [my email address] only on {timeout}

## Test the process binary.
check file mariadb_bin with path /usr/bin/mysqld_safe
  group database
  if failed checksum then unmonitor
  if failed permission 755 then unmonitor
  if failed uid root then unmonitor
  if failed gid root then unmonitor

## Test the init scripts.
check file mariadb_init with path /usr/lib/systemd/system/mariadb.service
  group database
  if failed checksum then unmonitor
  if failed permission 644 then unmonitor
  if failed uid root then unmonitor
  if failed gid root then unmonitor

所以显然 Monit 说 的校验和mariadb_bin与 的校验/usr/bin/mysqld_safe和不匹配,并且 的校验和与 的校验mariadb_init和不匹配/usr/lib/systemd/system/mariadb.service,尽管我不知道什么是“组数据库”。

centos7
  • 2 个回答
  • 65 Views
Martin Hope
stevland
Asked: 2023-07-01 04:34:32 +0800 CST

CentOS 网络服务器上无法解析域名

  • 6

我有一个运行 CentOS Linux 7.9.2009(核心)的小型虚拟主机 VPS。

我还运行 Plesk Obsidian 版本 18.0.52

这是我的 /etc/resolv.conf 文件:

nameserver 1.1.1.1
nameserver 8.8.4.4
nameserver 71.19.155.120
nameserver 71.19.155.215

(最后 2 个名称服务器由我的 VPS 主机提供)

从 CLI 中我无法挖掘、ping、traceroute 等...甚至我自己的主机名。

我昨天注意到了这一点,现在我的客户报告了我认为相关的各种问题(电子邮件滞留在队列中、无法登录本地 WordPress 安装、WooCommerce 问题)。

# ping google.ca
ping: google.ca: Name or service not known

和

# dig www.Google.com @8.8.8.8

; <<>> DiG 9.11.4-P2-RedHat-9.11.4-26.P2.el7_9.8 <<>> www.Google.com @8.8.8.8
;; global options: +cmd
;; connection timed out; no servers could be reached

到底他妈发生了什么?

centos7
  • 1 个回答
  • 43 Views
Martin Hope
chris-j
Asked: 2023-06-18 05:21:08 +0800 CST

我有一个本地 Amazon Linux 2 (EC2) AMI 实例;如何对磁盘重新分区并扩展文件系统?

  • 5

我已经扩展了虚拟机的磁盘。
现在如何在来宾上重新分区磁盘并扩展文件系统?
x86_64 上的 Amazon Linux 2 内核 4.14.252-195.483.amzn2.x86_64

$> sudo lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 52G 0 磁盘
├─sda1 8:1 0 25G 0 部分 /
└─sda128 259:0 0 1M 0 部分
sr0 11:0 1 1024M 0 rom

$> sudo fdisk -l
GPT PMBR 大小不匹配 (52428799 != 109051903) 将由 w(rite) 纠正。
磁盘 /dev/sda:52 GiB、55834574848 字节、109051904 个扇区
单位:1 * 512 = 512 字节的扇区
扇区大小(逻辑/物理):512 字节/512 字节
I/O 大小(最小/最佳):512 字节/ 512 字节
磁盘标签类型:gpt
磁盘标识符:B5D4B016-37AF-4CFE-A37B-2B3B6F23154F

设备起始结束扇区大小类型
/dev/sda1 4096 52428766 52424671 25G Linux 文件系统
/dev/sda128 2048 4095 2048 1M BIOS 启动

分区表条目不按磁盘顺序排列。

sudo cfdisk(已排序)给出;

                            Disk: /dev/sda
                            Size: 52 GiB, 55834574848 bytes, 109051904 sectors
                            Label: gpt, identifier: B5D4B016-37AF-4CFE-A37B-2B3B6F23154F

设备起始结束扇区大小类型
/dev/sda1 2048 4095 2048 1M BIOS 启动
/dev/sda2 4096 52428766 52424671 25G Linux 文件系统
可用空间 52428800 109051870 56623071 27G


根据 cfdisk 输出,我猜我需要

  1. 从“可用空间”创建一个新分区 sda3
  2. 将 sda1、sda2 和新的 sda3 添加到同一 LVM

有人可以确认这些步骤并让我知道如何从 CLI 完成此操作吗?我将不胜感激?
干杯克里斯

centos7
  • 1 个回答
  • 44 Views
Martin Hope
exudong
Asked: 2023-06-17 00:12:21 +0800 CST

TCP接收方只一一确认MSS的最小字节

  • 5

客户端和服务器节点为CentOS7.9/X86_64。如果HTTP POST请求直接发送到服务器,大约有0.2%的情况可能会超时。如果HTTP POST请求是通过客户端节点上的NGINX代理发送的,大约有20%的情况会超时。我已经确认只有一个后端节点有这个问题。即使吞吐量较高,所有其他节点也 100% 成功。

在后端节点上进行 tcpdump 并使用 Wireshark 进行分析后。请求成功,正常接收tcp包。如下:

在此输入图像描述

也就是说,TCP 接收方向每个大的 tcp 有效负载发送 ACK。

对于失败的请求,tcp 接收器仅确认每个 tcp 数据包的 1398 大小。1398 是 MSS 减去 TCP/IP 标头后的最小 tcp 有效负载。(1410 - 66 = 1398),如下:

在此输入图像描述

TCP 发送方在 60 秒内发送 TCP 重传 8 次,但 TCP 接收方再也没有发回 ack。HTTP 服务器在读取超时 60 秒后关闭了连接。

看起来数据包是在内核 TCP 堆栈中丢失的,而不是在网络方式中丢失的,因为数据包是在服务器端节点上捕获的。在客户端节点上,通过 tcpdump 观察到客户端很快收到了来自服务器的每个 ack。

有人能帮忙吗?提前致谢。

centos7
  • 1 个回答
  • 31 Views
Martin Hope
dc09
Asked: 2023-03-26 16:30:39 +0800 CST

为什么 getent 将域名附加到所有 .org 查找?

  • 5

在 CentOS 7 中运行以下命令时,getent仅将我的域名附加到 .org 域:

[root@panel ~]# getent hosts ballotpedia.org
2606:4700:3031::6815:241e ballotpedia.org.mydomain.com
2606:4700:3032::ac43:b854 ballotpedia.org.mydomain.com

当我查找不包含 .org 扩展名的任何其他域时,不会发生这种情况,如下所示:

[root@panel ~]# getent hosts google.com
2404:6800:4007:805::200e google.com

停止nscd服务后,问题不会发生。我也尝试nscd使用以下命令清除缓存,但这并没有解决问题:

for db in `ls /var/db/nscd`;do /usr/sbin/nscd -i $db;done && /scripts/restartsrv_nscd

如何解决此问题以及可能导致此问题的原因是什么?

centos7
  • 1 个回答
  • 64 Views
Martin Hope
andrew
Asked: 2022-10-27 10:28:46 +0800 CST

没有为 centos 7 找到 python38 pkg

  • 6

我有 CentOS 7,是否有任何选项如何在 CentOS 7 上安装 python 3.8?看起来在所有 repos 中都没有找到 pkg。所以唯一的选择是从源代码编译?为什么 EPEL 不支持...?

yum install python38
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: bay.uchicago.edu
 * centos-sclo-rh: centos-distro.1gservers.com
 * epel: fedora.westmancom.com
 * extras: abqix.mm.fcix.net
 * updates: centos.mirrors.hoobly.com
No package python38 available.
centos7
  • 1 个回答
  • 31 Views
Martin Hope
ChaosSpeeder
Asked: 2022-03-18 03:49:41 +0800 CST

对我的虚拟服务器的可能攻击 - 传出 tcp/ip 连接

  • 0

我的 vServer (Centos 7) 出现可疑情况。未知的 bash 脚本正在消耗服务器的所有内存。与“外部”有明显的联系。

不幸的是,我的 Unix 知识有限。

如何禁止用户 git 与外部的连接?

我怎样才能弄清楚这个 bash 脚本驻留在哪里,脚本的内容是什么?

lsof -p 1577
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
bash 1577 git cwd DIR 182,395665 4096 2 /
bash 1577 git rtd DIR 182,395665 4096 2 /
bash 1577 git txt unknown /proc/1577/exe (readlink: No such file or directory)
bash 1577 git mem REG 182,395665 795648 (deleted)/var/tmp/.ICE-unix/.bash/.bash/bash (stat: No such file or directory)
bash 1577 git 0r FIFO 0,8 0t0 3801753555 pipe
bash 1577 git 1w FIFO 0,8 0t0 3801753556 pipe
bash 1577 git 2w FIFO 0,8 0t0 3801753556 pipe
bash 1577 git 3u REG 182.395665 0 5390 /tmp/.lock
bash 1577 git 4u 0000 0,9 0 4145 [eventpoll]
bash 1577 git 5r FIFO 0,8 0t0 3801755403 pipe
bash 1577 git 6w FIFO 0,8 0t0 3801755403 pipe
bash 1577 git 7r FIFO 0,8 0t0 3801755399 pipe
bash 1577 git 8w FIFO 0,8 0t0 3801755399 pipe
bash 1577 git 9u 0000 0,9 0 4145 [eventfd]
bash 1577 git 10r CHR 1,3 0t0 3801397120 /dev/null
bash 1577 git 11u IPv4 3801755495 0t0 TCP <my server IP>:56542->**blackcat.ro:http** (ESTABLISHED)
bash centos7 systemctl
  • 1 个回答
  • 46 Views
Martin Hope
Steffen
Asked: 2022-03-06 10:54:50 +0800 CST

firewalld:记录被阻止的传出连接

  • 0

我已经配置了firewalld,这样防火墙也会阻止传出连接。我需要通过添加特定规则将传出流量列入白名单。这工作正常。

但现在我想知道,是否有传出连接当前仍被防火墙阻止。要检查这一点,我已设置并LogDenied重新all启动/重新加载 firewalld。现在我可以看到许多防火墙消息,/var/log/messages用于REJECT接收消息,例如

Mar  5 19:45:29 kvm011 kernel: FINAL_REJECT: IN=br0-enp3s0 OUT= MAC=80:ee:73:9d:59:09:98:9b:cb:bf:c3:7e:08:00 SRC=192.168.1.254 DST=192.168.1.3 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=55873 DF PROTO=TCP SPT=41047 DPT=80 WINDOW=29200 RES=0x00 SYN URGP=0 

但似乎不会记录被阻止的传出流量。我已经对其进行了测试: SMTP 端口 25 未针对传出流量列入白名单。因此,如果我尝试发送电子邮件,该电子邮件被标记为“延迟”,并且我在邮件日志中看到该电子邮件无法发送:

Mar  5 19:46:21 kvm011 postfix/smtp[3240]: connect to xxx.xxx.org[193.111.xxx.xxx]:25: Connection timed out

但是/var/log/messages文件中没有防火墙消息(对于端口 25 上的阻塞连接)。我必须在firewalld中激活这些消息吗?如果是这样,我该怎么做?

logging centos7 firewalld
  • 1 个回答
  • 399 Views
Martin Hope
noname
Asked: 2022-02-26 05:36:45 +0800 CST

如何在 centos 上更新 memcached 到 1.4.33?百胜说没有更新

  • 0

我需要将 centos7 上的 memcached 从 1.4.15 更新到 1.4.33 但是 yum update 说没有要更新的东西,显然有更新的版本。我在谷歌上找不到任何解释如何更新它的东西,只是用 yum install memcached 安装它——它不会安装最新的!

yum update memcached
Loaded plugins: fastestmirror, universal-hooks
Loading mirror speeds from cached hostfile
 * EA4: 93.115.203.100
 * cpanel-addons-production-feed: 93.115.203.100
 * cpanel-plugins: 93.115.203.100
No packages marked for update
centos memcached centos7
  • 1 个回答
  • 57 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve