Linux 环境查看命令

一、基础环境

1.服务器参数检查

(1)检查服务器版本及日期时间

cat /etc/redhat-release

[root@localhost ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.8 (Maipo)

date

(2)检查服务器cpu、内存、磁盘参数

lscpu

[root@localhost ~]# lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                8
On-line CPU(s) list:   0-7
Thread(s) per core:    1
Core(s) per socket:    1

free -g

[root@localhost ~]# free -g
              total        used        free      shared  buff/cache   available
Mem:             15           0          15           0           0          14
Swap:             0           0           0

df -h

[root@localhost ~]# df -h
文件系统               容量  已用  可用 已用% 挂载点
devtmpfs               7.8G     0  7.8G    0% /dev
tmpfs                  7.8G     0  7.8G    0% /dev/shm
tmpfs                  7.8G   12M  7.8G    1% /run
tmpfs                  7.8G     0  7.8G    0% /sys/fs/cgroup
/dev/mapper/rhel-root   29G  1.5G   28G    6% /
/dev/sda1              253M  131M  123M   52% /boot
tmpfs                  1.6G     0  1.6G    0% /run/user/0

(3)修改基本参数

修改主机名(每台)

[root@localhost ~]# vi /etc/hosts
10.150.5.184 DCPS_AFA184

[root@localhost ~]# vi /etc/hostname 
DCPS_AFA184

[root@localhost ~]# service network restart
[root@localhost ~]# reboot

关闭防火墙(每台)

[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl status firewalld

修改字符集

vi /etc/locale.conf
LANG=zh_CN.UTF-8

2.检查并修改内核参数

(1)检查内核参数

ulimit -a

[root@localhost ~]# ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 63373
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 63373
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

(2)修改内核参数

vi /etc/security/limits.conf

[root@localhost ~]# vi /etc/security/limits.conf
*    soft    nproc    65535
*    hard    nproc    65535
*    soft    nofile    65535
*    hard    nofile    65535
*    hard    fsize    2097152
*    hard    stack    256000
*    hard    rss    -1
*    hard    data    640000
test     soft    nproc   2048
test     hard    nproc   16384
test     soft    nofile  10240
test     hard    nofile  10240
test     hard    fsize   2097152
test     hard    stack   256000
test     hard    rss     -1
test     hard    data    640000

vi /etc/sysctl.conf

添加以下内容
#(8G*1024*1024/4)*4/10=838860
fs.file-max = 838860
fs.aio-max-nr = 1048576
 
kernel.core_uses_pid = 0
kernel.core_pattern = corefile/core-%e
kernel.sysrq = 1
#kernel.sem = 250 32000 100 128
#kernel.shmmax = 75474
#kernel.shmmni = 4096

#ESB参数
kernel.sem = 40960 5120000 40960 409600 
kernel.shmall = 26843545600 
kernel.shmmax = 429496729500
 
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_fin_timeout = 2
#net.ipv4.ip_conntrack_max = 20000
net.ipv4.ip_local_port_range = 3000 65500

注意:

net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_timestamps = 1

这两个参数在某些情况不可同时打开,生产环境建议

net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_timestamps = 0
  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

忙碌的菠萝

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值