查看cpu信息
lscpu
cpu 型号
cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
物理cpu
cat /proc/cpuinfo | grep "physical id" | sort | uniq|wc -l
逻辑cpu
cat /proc/cpuinfo | grep "processor" |wc -l
cpu 核数
cat /proc/cpuinfo | grep "cores"|uniq
查看linux内核版本
uname -a
查看linux系统版本
cat /etc/redhat-release
查询端口80被占用的连接
netstat -anpt | grep 80
查询端口3000被占用的进程
lsof -i:3000
查看云端支持安装的openjdk版本
yum search java|grep openjdk
查询java安装的绝对路径
which java
查看当前目下所有文件夹及文件的大小
du -sh *
按时间升序显示当前目录文件
ll -hrt
查看java日志
less *.log |grep '要查的关键字'
shfit+G 移动到日志结尾
less 1.log然后/关键字 回车, 小写n下翻,大写N上翻
配置非22端口
1. vi /etc/ssh/sshd_config
# Port 22 更改端口,并打开注释
2.如果是集群间免密登录,配置如下
[root@yy1 ~]# cat .ssh/config
Host yy1
Hostname yy1
port 端口
User root
Host yy2
Hostname yy2
port 端口
User root
Host yy3
Hostname yy3
port 端口
User root
查看hadoop的yarn日志
yarn logs -applicationId application_1656991740104_0001
linux定时任务crontab -e
位数 | 每位的含义 |
---|---|
5位:* * * * * | 分、时、天、月、周 |
6位:* * * * * * | 秒、分、时、天、月、周 |
7位:* * * * * * * | 秒、分、时、天、月、周、年 |
表达式举例:
0 1 * * * 每天的凌晨1点执行任务
0 0-12 * * * 每天0-12点每小时执行一次任务
0 0-12/2 * * * 每天0-12点每2小时执行一次任务
0 0,2 * * * 每天0点和2点执行一次任务
定时任务举例:
0 1 * * * sh /home/test.sh >> /home/test/log/log_`date '+\%Y\%m\%d'`.log 2>&1
FIO测试硬盘读写性能(建议ssd设置size=500G,hhd设置size=300G)
随机写
fio -filename=/data/file.txt -direct=1 -iodepth 1 -thread -rw=randwrite -ioengine=psync -bs=8k -size=500G -numjobs=10 -runtime=60 -group_reporting -name=mytest
随机读
fio -filename=/data/file.txt -direct=1 -iodepth 1 -thread -rw=randread -ioengine=psync -bs=8k -size=500G -numjobs=10 -runtime=60 -group_reporting -name=mytest
顺序写
fio -filename=/data/file1.txt -direct=1 -iodepth 1 -thread -rw=write -ioengine=psync -bs=8k -size=500G -numjobs=10 -runtime=60 -group_reporting -name=mytest
顺序读
fio -filename=/data/file1.txt -direct=1 -iodepth 1 -thread -rw=read -ioengine=psync -bs=8k -size=500G -numjobs=10 -runtime=60 -group_reporting -name=mytest
查看系统日志
journalctl --since "2023-10-01 20:00:00" --until "2023-10-01 20:20:00"