服务器命令合集;
#1.sar命令:查看网卡流量【普通网口-sigtran转发去proto】
sar -n DEV 1 10
#2.查看服务器版本信息
uname -a
#3.操作系统信息
SUSE系统操作命令如下:
cat /etc/issue
Welcome to SUSE Linux Enterprise Server 11 SP2 (x86_64) - Kernel \r (\l).
centos系统操作命令如下:
cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)
#4.grep命令:
查找需要的信息,-v 去除不需要的字段,
ps -ef|grep redis
ps -ef|grep redis|grep -v grep
wc做统计:
ps -ef|grep redis|grep -v grep |wc -l
#5.服务器查看cpu使用率:
sar -u 1 5
#6.检查防火墙
SUSE服务器:
1.检查防火墙是否关闭 |
Centos服务器:
1.检查防火墙是否关闭 |
#7.释放caches
echo 3 > /proc/sys/vm/drop_caches
#8.crontab 定时任务
vi /etc/crontab
添加命令的格式:
* * * * * command
minute hour day month week command
minute 表示分钟,0-59
hour 表示小时,0-23
day 表示天数,1-31
month 表示月份,1-12
week 表示周几,0-7 0/7都代表周日
command 填写需要执行的命令
对应项,用,号分隔即指定多种情况:
#1.每周一 上午8点到11点 的第3分和第15分 执行command命令:
3,15 8-11 * * 1 command
#2.每隔两天
* * */2 * * command
#每分钟执行一次
* * * * * command
#每晚的21:30执行command
30 21 * * * command
Centos系统
vim /etc/crontab
启动crontab服务:
service crond restart
#9.查看硬件类是否启动正常
#查看专用网卡是否启动成功
dmesg |grep INAC
[512421.952602] [INFO] <INAC0> Device Memory Available @ 0x18800000 (134217728)
[512421.954253] [INFO] <INAC0> Device Memory Available @ 0x20880000 (8388608)
[512421.954259] [INFO] <INAC0> rx_streams:4 tx_streams:4.
[512421.954263] [INFO] <INAC0> Single rx buff size: 128M
[512421.954264] [INFO] <INAC0> Single tx buff size: 128M
[512449.096570] [INFO] <INAC0> Board type is board_type_auto_4.
[512449.584554] [INFO] <INAC0> Initializing the card successfully.
[527276.887185] [INFO] <INAC0> Device Memory Available @ 0x18800000 (134217728)
[527276.889298] [INFO] <INAC0> Device Memory Available @ 0x21100000 (8388608)
[527276.889306] [INFO] <INAC0> rx_streams:4 tx_streams:4.
[527276.889316] [INFO] <INAC0> Single rx buff size: 128M
[527276.889318] [INFO] <INAC0> Single tx buff size: 128M
[527300.865604] [INFO] <INAC0> Board type is board_type_auto_4.
[527301.355507] [INFO] <INAC0> Initializing the card successfully.
最后这里放一些很特别的可能一般不会接触到的,但是接触到的时候你又不怎么能搜索到处理方法的:
1.DPDK
1.1 DPDK网卡在某些现场能运行起来,但是接收不到报文(排除网线没连通,网口没插好等问题后。由于硬件IOMMU与linux内核存在兼容性问题导致的,所以需要给内核加入iommu=soft,启用软件iommu功能。
解决办法:
修改/etc/default/grub,编辑GRUB_CMDLINE_LINUX选项:增加iommu=soft
vi /etc/default/grub
执行update-grub命令
grub2-mkconfig -o /boot/grub2/grub.cfg
重启服务器
reboot
1.2 通过dmesg发现DPDK网卡:
“failed to load because an unsupported SFP+ module type was detected.”信息
解决办法:卸载驱动并以allow_unsupported_sfp=1参数重新加载。
rmmod ixgbe
modprobe -r ixgbe;
modprobe ixgbe allow_unsupported_sfp=1