您好,登錄后才能下訂單哦!
這篇文章給大家分享的是有關怎么快速排查Linux硬件問題的內容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。
故障排查的第一步通常是顯示Linux服務器上安裝的硬件列表。你可以使用ls命令獲取硬件的詳細信息,比如lspci、lsblk、lscpu和lsscsi。比如說,這是lsblk命令的輸出結果:
# lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda 202:0 0 50G 0 disk ├─xvda1 202:1 0 1M 0 part └─xvda2 202:2 0 50G 0 part / xvdb 202:16 0 20G 0 disk └─xvdb1 202:17 0 20G 0 part
如果ls命令沒有顯示任何錯誤,使用初始化進程(比如systemd)查看Linux服務器的運行狀況。systemd是啟動用戶空間、控制多個系統進程的最流行的初始化進程。比如說,這是systemctl status命令的輸出結果:
# systemctl status● bastion.f347.internal State: running Jobs: 0 queued Failed: 0 units Since: Wed 2018-11-28 01:29:05 UTC; 2 days ago CGroup: / ├─1 /usr/lib/systemd/systemd --switched-root --system --deserialize 21 ├─kubepods.slice │ ├─kubepods-pod3881728a_f2af_11e8_af77_06af52f87498.slice │ │ ├─docker-88b27385f4bae77bba834fbd60a61d19026bae13d18eb147783ae27819c34967.scope │ │ │ └─23860 /opt/bridge/bin/bridge --public-dir=/opt/bridge/static --config=/var/console-config/console-c │ │ └─docker-a4433f0d523c7e5bc772ee4db1861e4fa56c4e63a2d48f6bc831458c2ce9fd2d.scope │ │ └─23639 /usr/bin/pod
dmesg讓你可以搞清楚內核的最新信息中的錯誤和警示內容。比如說,這是dmesg | more命令的輸出結果:
# dmesg | more.... [ 1539.027419] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready [ 1539.042726] IPv6: ADDRCONF(NETDEV_UP): veth71f37018: link is not ready [ 1539.048706] IPv6: ADDRCONF(NETDEV_CHANGE): veth71f37018: link becomes ready [ 1539.055034] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready [ 1539.098550] device veth71f37018 entered promiscuous mode [ 1541.450207] device veth71f37018 left promiscuous mode [ 1542.493266] SELinux: mount invalid. Same superblock, different security settings for (dev mqueue, type mqueue) [ 9965.292788] SELinux: mount invalid. Same superblock, different security settings for (dev mqueue, type mqueue) [ 9965.449401] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready [ 9965.462738] IPv6: ADDRCONF(NETDEV_UP): vetheacc333c: link is not ready [ 9965.468942] IPv6: ADDRCONF(NETDEV_CHANGE): vetheacc333c: link becomes ready ....
你還可以查看/var/log/messages文件中的所有Linux系統日志,在這里找到與特定問題有關的錯誤。如果你對硬件進行改動,比如掛載額外磁盤或添加以太網網卡,有必要通過tail命令實時密切關注信息。比如說,這是tail -f /var/log/messages命令的輸出結果:
# tail -f /var/log/messagesDec 1 13:20:33 bastion dnsmasq[30201]: using nameserver 127.0.0.1#53 for domain in-addr.arpaDec 1 13:20:33 bastion dnsmasq[30201]: using nameserver 127.0.0.1#53 for domain cluster.localDec 1 13:21:03 bastion dnsmasq[30201]: setting upstream servers from DBus Dec 1 13:21:03 bastion dnsmasq[30201]: using nameserver 192.199.0.2#53Dec 1 13:21:03 bastion dnsmasq[30201]: using nameserver 127.0.0.1#53 for domain in-addr.arpaDec 1 13:21:03 bastion dnsmasq[30201]: using nameserver 127.0.0.1#53 for domain cluster.localDec 1 13:21:33 bastion dnsmasq[30201]: setting upstream servers from DBus Dec 1 13:21:33 bastion dnsmasq[30201]: using nameserver 192.199.0.2#53Dec 1 13:21:33 bastion dnsmasq[30201]: using nameserver 127.0.0.1#53 for domain in-addr.arpaDec 1 13:21:33 bastion dnsmasq[30201]: using nameserver 127.0.0.1#53 for domain cluster.local
你可能在復雜的網絡環境中有成千上萬個云原生應用程序為業務服務提供服務;這些可能包括虛擬化、多云和混合云。這意味著你應該分析網絡連接是否正常運行,這是故障排查的一部分。分析Linux服務器中網絡功能的實用命令包括ip addr、traceroute、nslookup、dig和ping等。比如說,這是ip addr show命令的輸出結果:
# ip addr show1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: mtu 9001 qdisc mq state UP group default qlen 1000 link/ether 06:af:52:f8:74:98 brd ff:ff:ff:ff:ff:ff inet 192.199.0.169/24 brd 192.199.0.255 scope global noprefixroute dynamic eth0 valid_lft 3096sec preferred_lft 3096sec inet6 fe80::4af:52ff:fef8:7498/64 scope link valid_lft forever preferred_lft forever 3: docker0: mtu 1500 qdisc noqueue state DOWN group default link/ether 02:42:67:fb:1a:a2 brd ff:ff:ff:ff:ff:ff inet 172.17.0.1/16 scope global docker0 valid_lft forever preferred_lft forever inet6 fe80::42:67ff:fefb:1aa2/64 scope link valid_lft forever preferred_lft forever ....
感謝各位的閱讀!關于“怎么快速排查Linux硬件問題”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,讓大家可以學到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。