too many open files 的终极解决办法

1、首先,得定位问题,查,到底是哪些进程或线程打开了大量的连接(scoket)没有关闭

lsof -n | awk ‘{print $2}’ | sort | uniq -c | sort -nr | more

3、查看当前进程相关的连接

lsof | grep pid

4、jps查看当前java进程的状态

jps

5、查看当前进程属于哪个应用

ps -ef | grep pid

6、杀掉对应的pid

kill -9 pid

READ MORE

ubuntu源

查看版本 lsb_release -a

Distributor ID: Ubuntu
Description:    Ubuntu 22.04.3 LTS
Release:        22.04
Codename:       jammy

备份 sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

需要修改bionic为codename

deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

更新源 sudo apt-get update

READ MORE

vim

行末:$     

行首:^

空格:\s

行末空格:\s+$

行首空格:^\s+

删除行尾多个空格 : %s/\s+$//g

删除行首多个空格 : %s/^ +//g

删除空行::g/^$/d

set fenc=utf-8

set fencs=utf-8,usc-bom,euc-jp,gb18030,gbk,gb2312,cp936

set nocompatible

set history=50

set tabstop=4

set number

syntax on

set showmatch

set matchtime=5

set expandtab

READ MORE

virtual box修改硬盘大小

CentOS7,LVM根分区扩容步骤:

1.查看现有分区大小

df -TH

0

LVM分区,磁盘总大小为20G,根分区总容量为17G

2.关机增加大小为30G(测试环境使用的Vmware Workstation)

0

扩展分区到30G

3.查看扩容后磁盘大小

df -TH lsblk

0

磁盘总大小为30G,根分区为17G

4.创建分区

fdisk /dev/sda

0

将sda剩余空间全部给sda3

5.刷新分区并创建物理卷

partprobe /dev/sda pvcreate /dev/sda3

0

6.查看卷组名称,以及卷组使用情况

vgdisplay

0

VG Name为centos

7.将物理卷扩展到卷组

vgextend centos /dev/sda3

0

使用sda3扩展VG  centos 

8.查看当前逻辑卷的空间状态

lvdisplay

0

需要扩展LV  /dev/centos/root

9.将卷组中的空闲空间扩展到根分区逻辑卷

lvextend -l +100%FREE /dev/centos/root

0

10.刷新根分区

xfs_growfs /dev/centos/root

0

11.查看磁盘使用情况,扩展之前和之后是不一样的

0

根分区已经变成27G

CentOS7,非LVM根分区扩容步骤:

1.查看现有的分区大小

0

非LVM分区,目前磁盘大小为20G,根分区总容量为17G

2.关机增加磁盘大小为30G

0

3.查看磁盘扩容后状态

lsblk dh -TH

0

现在磁盘总大小为30G,根分区为17G

4.进行分区扩展磁盘,记住根分区起始位置和结束位置

READ MORE

virtualbox

host-only主机可以连接虚拟机,但是虚拟机不能联网 nat虚拟机可以联网,但是不能和主机互通 使用两个网卡实现既能虚拟机联网又能和主机互通

READ MORE