最新消息:

洞悉Linux系统软硬件配置

Linux admin 2856浏览 0评论

我们在做服务器的时候,老大扔给你一台机器,要你在上面开发。通常服务器软件是非常依赖于系统的软硬件的,软件通常是要紧贴硬件的特性,如果我们不能了解机器的硬件,我们就无法高效的开发。

比如说想知道Linux的系统的版本,CPU有几个,内存多少大, 机器什么型号,Raid卡什么型号,硬盘有几个,文件系统是什么样子的,网卡什么型号,文件句柄设置什么的,用到虚拟化技术了吗,网络配置什么样的,目前资源使用是如何?

当然如果你足够有经验的话,这些问题难不倒你,但是你获取完全的这些信息是很麻烦的。

这时候Percona 来救助了。他提供了一整套工具来协助定位MySQL服务器的问题。这套工具适合于大部分的IO服务器。

Aspersa is a collection of open-source system utilities primarily designed to ease the work of Percona consultants. This manual is the primary documentation for Aspersa tools. Please contribute your improvements.

项目地址: http://code.google.com/p/aspersa/
summary的使用文档: http://aspersa.googlecode.com/svn/html/summary.html

我们来参观下效果:

$ sudo ./summary
# Aspersa System Summary Report ##############################
Date | 2011-01-06 12:11:03 UTC (local TZ: CST +0800)
Hostname | test.flashcache.sqa.cm4
Uptime | 6 days,  2:55, 10 users,  load average: 29.97, 27.25, 27.44
System | HP; ProLiant DL380 G7; vNot Specified (Rack Mount Chassis)
Service Tag | CNG035SF71
Release | Red Hat Enterprise Linux Server release 5.4 (Tikanga)
Kernel | 2.6.18-164.el5
Architecture | CPU = 64-bit, OS = 64-bit
Threading | NPTL 2.5
Compiler | GNU CC version 4.1.2 20080704 (Red Hat 4.1.2-44).
SELinux | Disabled
# Processor ##################################################
Processors | physical = 2, cores = 8, virtual = 16, hyperthreading = yes
Speeds | 16×2399.382
Models | 16xIntel(R) Xeon(R) CPU E5620 @ 2.40GHz
Caches | 16×12288 KB
# Memory #####################################################
Total | 70.74G
Free | 185.99M
Used | physical = 70.56G, swap = 180.00k, virtual = 70.56G
Buffers | 930.25M
Caches | 6.84G
Used | 60.64G
Swappiness | vm.swappiness = 0
DirtyPolicy | vm.dirty_ratio = 80, vm.dirty_background_ratio = 10
Locator   Size     Speed             Form Factor   Type          Type Detail
========= ======== ================= ============= ============= ===========
PROC 1 DIMM 1G 4096 MB  1333 MHz (0.8 ns) DIMM          {OUT OF SPEC} Synchronous
PROC 1 DIMM 2D 4096 MB  1333 MHz (0.8 ns) DIMM          {OUT OF SPEC} Synchronous
PROC 1 DIMM 3A 4096 MB  1333 MHz (0.8 ns) DIMM          {OUT OF SPEC} Synchronous
PROC 1 DIMM 4H 4096 MB  1333 MHz (0.8 ns) DIMM          {OUT OF SPEC} Synchronous
PROC 1 DIMM 5E 4096 MB  1333 MHz (0.8 ns) DIMM          {OUT OF SPEC} Synchronous
PROC 1 DIMM 6B 4096 MB  1333 MHz (0.8 ns) DIMM          {OUT OF SPEC} Synchronous
PROC 1 DIMM 7I 4096 MB  1333 MHz (0.8 ns) DIMM          {OUT OF SPEC} Synchronous
PROC 1 DIMM 8F 4096 MB  1333 MHz (0.8 ns) DIMM          {OUT OF SPEC} Synchronous
PROC 1 DIMM 9C 4096 MB  1333 MHz (0.8 ns) DIMM          {OUT OF SPEC} Synchronous
PROC 2 DIMM 1G 4096 MB  1333 MHz (0.8 ns) DIMM          {OUT OF SPEC} Synchronous
PROC 2 DIMM 2D 4096 MB  1333 MHz (0.8 ns) DIMM          {OUT OF SPEC} Synchronous
PROC 2 DIMM 3A 4096 MB  1333 MHz (0.8 ns) DIMM          {OUT OF SPEC} Synchronous
PROC 2 DIMM 4H 4096 MB  1333 MHz (0.8 ns) DIMM          {OUT OF SPEC} Synchronous
PROC 2 DIMM 5E 4096 MB  1333 MHz (0.8 ns) DIMM          {OUT OF SPEC} Synchronous
PROC 2 DIMM 6B 4096 MB  1333 MHz (0.8 ns) DIMM          {OUT OF SPEC} Synchronous
PROC 2 DIMM 7I 4096 MB  1333 MHz (0.8 ns) DIMM          {OUT OF SPEC} Synchronous
PROC 2 DIMM 8F 4096 MB  1333 MHz (0.8 ns) DIMM          {OUT OF SPEC} Synchronous
PROC 2 DIMM 9C 4096 MB  1333 MHz (0.8 ns) DIMM          {OUT OF SPEC} Synchronous
# Mounted Filesystems ########################################
Filesystem            Size Used Type  Opts                              Mountpoint
/dev/cciss/c0d0p1     122M  10% ext3  (rw)                              /boot
/dev/cciss/c0d0p2      15G   4% ext3  (rw)                              /
/dev/cciss/c0d0p3      15G   3% ext3  (rw)                              /var
/dev/cciss/c0d0p5      15G  21% ext3  (rw)                              /usr
/dev/cciss/c0d0p6     9.5G   5% ext3  (rw)                              /home
/dev/cciss/c0d0p7     8.6G  31% ext3  (rw)                              /tmp
/dev/mapper/cachedev  1.6T  55% ext3  (rw,noatime,nodiratime,barrier=0) /u01
tmpfs                  36G   0% tmpfs (rw)                              /dev/shm
# Disk Schedulers And Queue Size #############################
cciss!c0d0 | [deadline] 512
# Disk Partioning ############################################
Device       Type      Start        End               Size
============ ==== ========== ========== ==================
# Kernel Inode State #########################################
dentry-state | 144452   138117  45      0       0       0
file-nr | 3060     0       131072
inode-nr | 130370   52
# LVM Volumes ################################################
# RAID Controller ############################################
Controller | HP Smart Array
logicaldrive 1 (1.6 TB, RAID 1+0, OK)
physicaldrive 2C:1:1 (port 2C:box 1:bay 1, SAS, 300 GB, OK)
physicaldrive 2C:1:2 (port 2C:box 1:bay 2, SAS, 300 GB, OK)
physicaldrive 2C:1:3 (port 2C:box 1:bay 3, SAS, 300 GB, OK)
physicaldrive 2C:1:4 (port 2C:box 1:bay 4, SAS, 300 GB, OK)
physicaldrive 3C:1:5 (port 3C:box 1:bay 5, SAS, 300 GB, OK)
physicaldrive 3C:1:6 (port 3C:box 1:bay 6, SAS, 300 GB, OK)
physicaldrive 3C:1:7 (port 3C:box 1:bay 7, SAS, 300 GB, OK)
physicaldrive 3C:1:8 (port 3C:box 1:bay 8, SAS, 300 GB, OK)
physicaldrive 4C:2:1 (port 4C:box 2:bay 1, SAS, 300 GB, OK)
physicaldrive 4C:2:2 (port 4C:box 2:bay 2, SAS, 300 GB, OK)
physicaldrive 4C:2:3 (port 4C:box 2:bay 3, SAS, 300 GB, OK)
physicaldrive 4C:2:4 (port 4C:box 2:bay 4, SAS, 300 GB, OK)
# Virtualization #############################################
Technology | No virtualization detected
# Network Config #############################################
Controller | Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet (rev 20)
Controller | Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet (rev 20)
Controller | Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet (rev 20)
Controller | Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet (rev 20)
FIN Timeout | net.ipv4.tcp_fin_timeout = 60
Port Range | net.ipv4.ip_local_port_range = 1024      65000
# Interface Statistics #######################################
interface  rx_bytes rx_packets  rx_errors   tx_bytes tx_packets  tx_errors
========= ========= ========== ========== ========== ========== ==========
lo        751283431    1763251          0  751283431    1763251          0
eth0     2320706371 3237499907          0 1816207099 3507868329          0
eth1       69748430     918193          0          0          0          0
eth2              0          0          0          0          0          0
eth3              0          0          0          0          0          0
sit0              0          0          0          0          0          0
bond0    2390454801 3238418100          0 1816207099 3507868329          0
# Network Connections ########################################
Connections from remote IP addresses
10.232.21.113      38
10.232.21.114      33
10.232.21.115      43
10.232.21.116      38
10.232.21.117      38
10.232.21.118      39
10.232.21.119      37
10.232.21.120      37
10.232.21.121      40
10.232.21.122      42
10.232.21.138      13
10.232.21.139       9
10.232.21.140       9
10.232.21.151       9
10.232.21.152       7
10.232.21.153       7
10.232.21.154       7
10.232.21.155       7
10.232.21.156       7
10.232.21.157       8
10.232.31.221      11
10.232.31.228      10
Connections to local IP addresses
10.232.31.228     489
Connections to top 10 local ports
3306              474
45744               1
45750               1
45751               1
45757               1
45758               1
45764               1
45765               1
45771               1
45772               1
States of connections
ESTABLISHED       478
LISTEN              4
TIME_WAIT          21
# Top Processes ##############################################
PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
12820 mysql     15   0 61.3g  60g 5204 S 930.4 85.5   1727:21 mysqld
3501 root      18   0  163m 5064 4424 S 29.6  0.0 382:44.05 tcprstat
2578 root      10  -5     0    0    0 R 25.7  0.0   1657:52 fct0-worker
22031 root      11  -5     0    0    0 S  4.0  0.0  27:22.33 kcopyd
50 root      10  -5     0    0    0 S  2.0  0.0 191:31.85 events/0
52 root      10  -5     0    0    0 S  2.0  0.0  90:51.61 events/2
58 root      10  -5     0    0    0 S  2.0  0.0  96:40.09 events/8
65 root      10  -5     0    0    0 S  2.0  0.0  18:32.29 events/15
22258 root      10  -5     0    0    0 S  2.0  0.0  11:14.77 kjournald
# Simplified vmstat (wait please) ############################
procs  —swap– —–io—- —system—- ——–cpu——–
r  b    si   so    bi    bo     in     cs  us  sy  id  wa  st
24  7     0    0  8120  4418      4      2  29  12  33  27   0
29  3     0    0 100116 123105  67859 171497  47  17  23  12   0
18  7     0    0 84488 101152  67062 172806  43  15  26  16   0
15  9     0    0 95212 86349  62940 166373  47  16  26  11   0
24  6     0    0 97220 134367  68987 174163  47  18  24  11   0
# The End ####################################################

转载请注明:爱开源 » 洞悉Linux系统软硬件配置

您必须 登录 才能发表评论!