試驗筆記:配置各種內核轉儲dump_第1頁
試驗筆記:配置各種內核轉儲dump_第2頁
試驗筆記:配置各種內核轉儲dump_第3頁
試驗筆記:配置各種內核轉儲dump_第4頁
試驗筆記:配置各種內核轉儲dump_第5頁
已閱讀5頁,還剩7頁未讀, 繼續免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、配置各種內核轉儲 dump撰寫者信息:Alin Fang (Fang YunlinMSN:G Talk:Blog:修改日期:22 Sep, 2008第一次修改版權:GNU聲明:本人實驗筆記,非權威文檔。如有錯誤請告知作者。十分感謝!實驗筆記:netdumpnetdump 需要兩臺機器配合。如果 client 端死機,則會把內存里面的信息 dump 到 server 。client:OS:Red Hat Enterprise Linux 4 update 7server:OS: Red Hat Enterprise Linux 4 update 7client 網絡環境 :rootstation

2、1 # ifconfigeth0 Link encap:Ethernet HWaddr 00:0C:29:22:61:B5inet addr:192.168.0.1 Bcast:192.168.255.255 Mask:255.255.0.0 inet6 addr: fe80:20c:29ff:fe22:61b5/64 Scope:LinkUP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1RX packets:4 errors:0 dropped:0 overruns:0 frame:0TX packets:9 errors:0 dropped:0

3、 overruns:0 carrier:0collisions:0 txqueuelen:1000RX bytes:240 (240.0 b TX bytes:546 (546.0 bInterrupt:185 Base address:0x2000eth1 Link encap:Ethernet HWaddr 00:0C:29:22:61:BFinet6 addr: fe80:20c:29ff:fe22:61bf/64 Scope:LinkUP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1RX packets:68 errors:0 droppe

4、d:0 overruns:0 frame:0TX packets:57 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000RX bytes:9962 (9.7 KiB TX bytes:7759 (7.5 KiBInterrupt:177 Base address:0x2080lo Link encap:Local Loopbackinet6 addr: :1/128 Scope:HostUP LOOPBACK RUNNING MTU:16436 Metric:1RX packets:8 errors:0 dr

5、opped:0 overruns:0 frame:0TX packets:8 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:0RX bytes:560 (560.0 b TX bytes:560 (560.0 brootstation1 # routeKernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Iface 10.66.0.0 * 255.255.254.0 U 0 0 0 eth1 169.254.0.0 * 255

6、.255.0.0 U 0 0 0 eth1 192.168.0.0 * 255.255.0.0 U 0 0 0 eth0 default 10.66.1.254 0.0.0.0 UG 0 0 0 eth1 rootstation1 #server 網絡環境:rootstation2 # ifconfigeth0 Link encap:Ethernet HWaddr 00:0C:29:32:64:A0inet6 addr: fe80:20c:29ff:fe32:64a0/64 Scope:LinkUP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1RX

7、 packets:0 errors:0 dropped:0 overruns:0 frame:0TX packets:9 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000RX bytes:0 (0.0 b TX bytes:546 (546.0 bInterrupt:185 Base address:0x2000eth1 Link encap:Ethernet HWaddr 00:0C:29:32:64:AAinet6 addr: fe80:20c:29ff:fe32:64aa/64 Scope:LinkUP

8、 BROADCAST RUNNING MULTICAST MTU:1500 Metric:1RX packets:126 errors:0 dropped:0 overruns:0 frame:0TX packets:55 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000RX bytes:16122 (15.7 KiB TX bytes:7651 (7.4 KiBInterrupt:177 Base address:0x2080lo Link encap:Local Loopbackinet6 addr: :

9、1/128 Scope:HostUP LOOPBACK RUNNING MTU:16436 Metric:1RX packets:8 errors:0 dropped:0 overruns:0 frame:0TX packets:8 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:0RX bytes:560 (560.0 b TX bytes:560 (560.0 brootstation2 # routeKernel IP routing tableDestination Gateway Genmask Flags

10、 Metric Ref Use Iface 10.66.0.0 * 255.255.254.0 U 0 0 0 eth1 169.254.0.0 * 255.255.0.0 U 0 0 0 eth1 192.168.0.0 * 255.255.0.0 U 0 0 0 eth0 default 10.66.1.254 0.0.0.0 UG 0 0 0 eth1 rootstation2 #配置 serverrootstation2 # rpm -q netdump-serverpackage netdump-server is not installedrootstation2 # mount

11、/dev/cdrom /media/mount: block device /dev/cdrom is write-protected, mounting read-onlyrootstation2 # cd /media/RedHat/RPMS/warning: netdump-server-0.7.16-14.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60ePreparing. # 100% 1:netdump-server # 100% rootstation2 RPMS# service netdump-serverUsage: ne

12、tdump-server start|stop|status|restart|condrestartrootstation2 RPMS# service netdump-server startStarting netdump server: OK rootstation2 RPMS# chkconfig -level 35 netdump-server onrootstation2 RPMS# passwd netdumpChanging password for user netdump.New UNIX password:BAD PASSWORD: it is based on a di

13、ctionary wordRetype new UNIX password:passwd: all authentication tokens updated successfully.rootstation2 RPMS#安裝 netdump-server 會在系統里面添加 netdump 這個用戶。作為 netdump 時候傳輸數據之用。 但是并不會給這個用戶創建密碼。所以這個用戶默認是給鎖住的。因此記得給 netdump 這個 用戶分配密碼!配置 clientrootstation1 # rpm -q netdumprootstation1 # vi /etc/sysconfig/netd

14、ump指定 netdump-server 的 IP 地址rootstation1 # service netdump startnetdump10.66.0.114's password:initializing netdump OK initializing netconsole OK Message from syslogdstation1 at Mon Sep 22 17:47:38 2008 .station1 kernel: work console startup.rootstation1 #然后在 client 上模擬 crashrootstation1 # echo 1

15、 > /proc/sys/kernel/sysrqrootstation1 # echo c > /proc/sysrq-trigger然后 netdump 就給激活了。當 dump 完數據,機器自動重啟。在 server 上檢驗數據rootstation2 # cd /var/crash/rootstation2 crash# lltotal 16drwx- 2 netdump netdump 4096 Sep 22 18:05 192.168.0.1-2008-09-22-18:04 drwx- 2 netdump netdump 4096 Sep 22 17:48 magic

16、drwxr-xr-x 2 netdump netdump 4096 Aug 4 2007 scriptsrootstation2 crash# cd 192.168.0.1-2008-09-22-18:04/rootstation2 192.168.0.1-2008-09-22-18:04# lltotal 81656-rw- 1 netdump netdump 30592 Sep 22 18:05 log-rw- 1 netdump netdump 268439552 Sep 22 18:05 vmcorerootstation2 192.168.0.1-2008-09-22-18:04#

17、ll -htotal 80M-rw- 1 netdump netdump 30K Sep 22 18:05 log-rw- 1 netdump netdump 257M Sep 22 18:05 vmcorerootstation2 192.168.0.1-2008-09-22-18:04#vmcore 就是發生 crash 的時候內存里的數據。diskdumpdiskdump 在 Red Hat Enterprise Linux 4 update 4之前需要一塊單獨的硬盤。在 Red Hat Enterprise Linux 4 update 4以及之后,只需要一塊單獨的磁盤分區。試驗環境:

18、Red Hat Enterprise Linux 4 update 7原本采用 Red Hat Enterprise Linux 5 update 2,但是發現 diskdump 在 RHEL5以及更高版本上 被 kdump 所替代。試驗步驟先劃分一塊分區給 diskdump 。rootdhcp-0-084 # fdisk /dev/sdbDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabelBuilding a new DOS disklabel. Changes will rema

19、in in memory only,until you decide to write them. After that, of course, the previouscontent won't be recoverable.Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite Command (m for help: pDisk /dev/sdb: 4294 MB, 4294967296 bytes255 heads, 63 sectors/track, 522 cylinders

20、Units = cylinders of 16065 * 512 = 8225280 bytesDevice Boot Start End Blocks Id SystemCommand (m for help: nCommand actione extendedp primary partition (1-4pPartition number (1-4: 1First cylinder (1-522, default 1:Using default value 1Last cylinder or +size or +sizeM or +sizeK (1-522, default 522:Us

21、ing default value 522Command (m for help: wThe partition table has been altered!Calling ioctl( to re-read partition table.Syncing disks.partproberootdhcp-0-084 # partprobeWarning: Unable to open /dev/hdc read-write (Read-only file system. /dev/hdc has been opened read-only.No changes made to disk, e

22、xiting partprobe.rootdhcp-0-084 #我們用 /dev/sdb1作為 diskdump 的數據臨時存放點。編輯 diskdump 配置文件。rootdhcp-0-084 RPMS# rpm -qa | grep diskdump diskdumputils-1.4.1-5 rootdhcp-0-084 RPMS# vi /etc/sysconfig/diskdump DEVICE=/dev/sdb1 初始化并啟動 diskdump 服務. rootdhcp-0-084 # service diskdump initialformat Formatting dump

23、device: Do you want to format /dev/sdb1 (yes/NO? yes /dev/sdb1: 100.0% rootdhcp-0-084 # service diskdump restart Starting diskdump: OK rootdhcp-0-084 # chkconfig -level 35 diskdump on rootdhcp-0-084 # 然后模擬死機. rootdhcp-0-084 RPMS# echo 1 > /proc/sys/kernel/sysrq rootdhcp-0-084 RPMS# echo c > /p

24、roc/sysrq-trigger 此時 diskdump 開始工作.把內存中的數據 dump 到/dev/sdb1 中. diskdump 之后必須手動重啟機器. 重啟機器后,diskdump 會把/dev/sdb1 里面的數據拷到/var/crash 文件夾下. 檢查 diskdump 數據. rootdhcp-0-084 # cd /var/crash/ rootdhcp-0-084 crash# ll total 12 drwx- 2 root root 4096 Sep 22 19:52 127.0.0.1-2008-09-22-19:49 drwxr-xr-x 2 netdump

25、netdump 4096 Mar 25 23:33 scripts rootdhcp-0-084 crash# cd 127.0.0.1-2008-09-22-19:49/ rootdhcp-0-084 127.0.0.1-2008-09-22-19:49# ll -h total 86M -rw- 1 root root 513M Sep 22 19:52 vmcore rootdhcp-0-084 127.0.0.1-2008-09-22-19:49# kdump 實驗環境: client OS: Red Hat Enterprise Linux 5 update 2 client IP:

26、 10.66.0.157 server OS: Red Hat Enterprise Linux 4 update 7 server IP: 10.66.0.84 kdump 屬于 kexec-tools-1.102pre-21.el5 這個包.一般裝系統都有裝上. kdump 支持 N 種方式存儲內存數據,包括裸設備,文件系統,nfs,ssh.并且能設定 dump 前和 dump 后運行腳本以及執行其他動作.正所謂很好很強大. kdump 的 dump 機制是:預先生成一個 crashkernel,在內核 crash 的時候,激活這個 crashkernel,用這個 crashkernel

27、載入的小型系統 dump 處于 crash 狀態的內核. 實驗步驟: 這次我會配置 kdump 把內存數據 scp 到備份服務器上. 在 client 上: 安裝 kdump rootdhcp-0-157 # cat /etc/redhat-release Red Hat Enterprise Linux Server release 5.2 (Tikanga rootdhcp-0-157 # cd /misc/cd/Server rootdhcp-0-157 Server# rpm -ivh busybox-1.2.0-4.el5.i386.rpm warning: busybox-1.2.

28、0-4.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 Preparing. # 100% 1:busybox # 100% rootdhcp-0-157 Server# rpm -ivh kexec-tools-1.102pre-21.el5.i386.rpm warning: kexec-tools-1.102pre-21.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 Preparing. # 100% 1:kexec-tools roo

29、tdhcp-0-157 Server# # 100% 配置 kdump rootdhcp-0-157 # vim /etc/kdump.conf net root10.66.0.84 對 kernel 開啟 kdump 支持 rootdhcp-0-157 # vim /boot/grub/grub.conf 在 kernel 選項上添加 crashkernel 參數. 參數格式是: crashkernel=nnKMGssKMG nn 表示要為 crashkernel 預留多少內存 ss 表示為 crashkernel 預留內存的起始位置 default=0 timeout=5 splashimage=(hd0,0/grub/splash.xpm.gz hiddenmenu title Red Hat Enterprise Linux Server (2.6.18-92.el5 root (hd0,0 kernel /vmlinuz-2.6.18-92.el5 ro root=LABEL=/ crashkernel=256M16M initrd /initrd-2.6.18-92.el5.img 重啟電腦使新參數生效. 然后啟用 kdu

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論