基礎知識、伺服器搭建、系統管理、性能調優、叢集應用
1、swap實體記憶體兩倍
2、根分區5G
3、/boot 100M
4、檢視系統硬體資訊:
cat /proc/meminfo
cat /proc/cpuinfo
檢視磁盤資訊: fdisk -l
軟碟:/dev/fdx
U盤:/dev/sdax
光驅:/dev/cdrom
挂載軟碟、U盤、CD光牒:mount -t vfat /dev/sda1 /mnt/usb
umount
5、etc :passwd shadow group gshadow fstab inittab
6、dev裝置
7、proc裝置
8、系統模式
9、修改預設:/etc/inittab id:3:initdefault:
10、shutdown -r now shutdown -h now shutdown +5 "close"
halt reboot
11、通配符
12、時間
修改時間
前兩天時間:date -d "2 days ago" +%Y-%m-%d
13、轉超級使用者:su -
clear
14、who
who -bu顯示登入資訊
15、顯示登入資訊:w
16、uname -a
uptime
dmesg
last
17、free -m
18、ps -ef
19、mkdir -p
more -c 10 xxx.txt
cat
diff -c x1.txt x2.txt
grep -i 忽略大小寫
touch
20、硬連結、軟連結ln -s
file 顯示檔案類型
21、find / -path "\usr\sbin" -prune -o -name "main.c" -user ixdba -type f -mtime +2 -print -exec rm {} \;
find / \(-path /var/log -o -path /usr/bin\) -prune -o -name "main.c" -print
find / -size 0 -type f -exec ls -al {} \;
22、split -b 10M access accessbak
split -b 10M -d -a 3 acc accbak
23、zip -9r /opt/xx.zip /etc
unzip xx.zip -d /etc
gzip
bzip
24、tar zcvf xx.tar.gz /etc
tar jcvf xx
tar zxvf
tar zxvf 解壓 tar cxvf 壓縮
25、分區備份和還原:dd
cpio一種備份形式
26、df -h
df -hT
df -hiT
27、du -sh
fsck 修複磁盤
sync
eject
28、挂載磁盤鏡像
mount -o loop -t iso9660 xx.iso /dix
mount -t nfs -o ro ip:/xx /mt
29、配置網卡資訊
ifconfig eth0 down
ifconfig eth0 up
30、scp
31、netstat -rn
netstat -tnlup
traceroute
32、vi指令
lsmod:檢視加載的子產品
modprobe 裝載子產品
33、開啟路由轉發功能:/etc/sysctl.conf
net.ipv4.ip_forward=1
sysctl -p
34、route
35、yum 正常用法
使用者端口1024以後
36、chkconfig --list sshd
chkconfig --level 35 xx off
37、不響應ping
禁止組合鍵重新開機
限制曆史記錄:/etc/profile HISTSIZE=30
38、iptables
iptables -L -n 列出規則
iptables -t nat -L -n
清除規則:iptables -F iptables -X iptables -Z
39、ssh配置詳解
chkconfig --level 345 sshd on
40、vsftp搭建
41、修改系統核心值:/etc/sysctl.conf
kernel.shmall=2097152
kernel.shmmax=4294967295
fs.file-max=6553600
kernel.shmmni=4096
kernel.sem=250 32000 100 128
net.ipv4.ip_local_port_range=1024 65000
net.core.rmem_default=4194304
net.core.rmem_max=4194304
net.core.wmem_default=262144
net.core.wmem_max=262144
42、修改使用者的檔案限制?????
rc.local
43、/etc/passwd解讀
44、/etc/shadow
45、/etc/group /etc/gshadow
46、/etc/login.defs 使用者定義預設配置:
/etc/default/useradd
.bash_profile
47、groupadd
useradd -g group1 -G g2,g3,g4
su - xxx
groupdel
useradd
48、usermod
49、useradd -g xx -G xxxx -d /xx/xxxx llll
useradd -u 888 -s /bin/bash -G xx,xx -c "sdfsdf"
chmod u=rwx,g+x,o+r xx.log
chmod u-r,g-r,o-r xx.log
50、ext3檔案誤删除恢複:e2fsprogs\ext3grep
51、pstree -c -p mysql 顯示父程序、子程序
>/dev/null 2>&1
52、raid
sar
52、vmstat 2 3 系統性能分析
53、cpu性能分析:sar -u 2 3
sar -P ALL 2 3
54、iostat -c
uptime的三個值不要大于CPU個數
55、free -m
free -m -s 5
watch -n 2 -d free :高亮顯示變動,每兩秒
si so不用太高
sar -r 2 3
56、sar -d 2 3 磁盤IO分析
vmstat -d 2 3
57、sar -n DEV 2 3 目前網卡運作狀況
RS232心跳
heartbeat
ha主配置檔案
群集檔案系統:GFS、OCFS2
LVS:NAT TUN DR