Centos7.6新建环境
打算从docker,python3,redis,mysql,nginx,部署服务
这个顺序开始安装
查看服务器整体情况
# 显示物理CPU个数
[root@hiddeninfo ~]# cat /proc/cpuinfo |grep "physical id"|sort|uniq|wc -l
16
# cpu cores
[root@hiddeninfo ~]# cat /proc/cpuinfo |grep "cpu cores"|uniq
cpu cores : 1
# 逻辑cpu个数
[root@hiddeninfo ~]# cat /proc/cpuinfo|grep "processor"|wc -l
16
# 配置应用时,以逻辑cpu个数为准
# 逻辑CPu个数=physical * cpu cores
# 内存使用情况
[root@hiddeninfo ~]# free -h
total used free shared buff/cache available
Mem: 31G 336M 26G 1.6G 4.5G 28G
Swap: 0B 0B 0B
# 磁盘使用情况
# vda高效云盘 tmpfs普通磁盘
[root@hiddeninfo ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 20G 3.2G 16G 17% /
devtmpfs 16G 0 16G 0% /dev
tmpfs 16G 0 16G 0% /dev/shm
tmpfs 16G 1.6G 15G 11% /run
tmpfs 16G 0 16G 0% /sys/fs/cgroup
tmpfs 3.2G 0 3.2G 0% /run/user/0
# pid:port对应查找
# port找pid
netstat -nap | grep PORT
lsof -i:PORT
# pid找port
lsof -i|grep PID
netstat -nap | grep PID
# 进程名找pid,port
ps -ef|grep ...
# 查看tcp,udp连接状态并显示进程pid
[root@service37 ~]# netstat -ntulp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 3191/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 9487/master
tcp6 0 0 :::22 :::* LISTEN 3191/sshd
tcp6 0 0 ::1:25 :::* LISTEN 9487/master
udp 0 0 127.0.0.1:323 0.0.0.0:* 602/chronyd
udp 0 0 0.0.0.0:68 0.0.0.0:* 704/dhclient
udp6 0 0 ::1:323 :::* 602/chronyd服务器资源情况
vmstat监控Linux系统的整体性能
参数:
procs:
r: 等待运行的进程数
b: 处于非中断睡眠状态的进程数
memory:
swpd: 虚拟内存使用情况(KB)
free: 空闲内存(KB)
swap:
si: 从磁盘交换到内存的交换页数量
so: 从内存交换到磁盘的交换页数量
io:
bi: 发送到设备的块数(块/s)
bo: 从块设备接收到的块数(块/s)
system:
in: 每秒中断数
cs: 每秒的环境上下文切换数
cpu:(cpu总使用的百分比)
us: cpu使用时间
sy: cpu系统使用时间
id: 闲置时间
wa: IO等待时间百分比 wa的值高时,说明IO等待比较严重,这可能由于磁盘大量作随机访问造成,也有可能磁盘出现瓶颈(块操作)。
安装docker
一开始尝试rpm安装总是报错:
还是按官网上yum安装吧= ='
出现这样的界面就代表安装完毕了,接下来换镜像源:
docker操作
Mysql操作
php环境配置
Last updated
Was this helpful?