Solaris 10 系统维护经验谈.docx

上传人:b****5 文档编号:7289786 上传时间:2023-01-22 格式:DOCX 页数:11 大小:21.85KB
下载 相关 举报
Solaris 10 系统维护经验谈.docx_第1页
第1页 / 共11页
Solaris 10 系统维护经验谈.docx_第2页
第2页 / 共11页
Solaris 10 系统维护经验谈.docx_第3页
第3页 / 共11页
Solaris 10 系统维护经验谈.docx_第4页
第4页 / 共11页
Solaris 10 系统维护经验谈.docx_第5页
第5页 / 共11页
点击查看更多>>
下载资源
资源描述

Solaris 10 系统维护经验谈.docx

《Solaris 10 系统维护经验谈.docx》由会员分享,可在线阅读,更多相关《Solaris 10 系统维护经验谈.docx(11页珍藏版)》请在冰豆网上搜索。

Solaris 10 系统维护经验谈.docx

Solaris10系统维护经验谈

Solaris10系统维护经验谈

相信很多人和我有类似的想法:

要是solaris10安装配置完以后把它扔到某个位置再也不用管它,那该有多好。

当然,这只是我们的一厢情愿而已!

尽管solaris10的功能已经异常强大、性能超级稳定,但还是需要我们经常性的看管和维护。

维护的主要内容包括监控、配置/设置修改以及故障处理这几个方面,下面我们分别以一些实例来讨论这些情形。

  系统监控

  监控最主要的目的是了解和掌握系统的负载和性能。

  

(一)     了解系统的状况。

  1、查看正在运行的solaris10的版本,使用不带参数的命令showrev,此命令加选项-r则是另外一个功能:

查看目前系统所需要安装的补丁程序。

  root@zsc#showrev

  Hostname:

zsc

  Hostid:

841e69f3

  Release:

5.10

  Kernelarchitecture:

sun4u  //intel架构的服务器输出不一样

  Applicationarchitecture:

sparc

  Hardwareprovider:

Sun_Microsystems

  Domain:

  Kernelversion:

SunOS5.10Generic_118833-18//内核版本号

  2、查看硬件设备的某些情况,使用命令prtconfig.

  root@zsc#prtconf

  SystemConfiguration:

SunMicrosystemssun4u//intel,amdcpu的输出不同

  Memorysize:

8192Megabytes  //内存为8G

  SystemPeripherals(SoftwareNodes):

  SUNW,Sun-Fire-V490

  scsi_vhci,instance#0

  packages(drivernotattached)

  SUNW,builtin-drivers(drivernotattached)

  ………

  3、查看本机所连接的磁盘数量,使用命令format.这个命令也是格式化硬盘的工具。

  root@zsc#format

  Searchingfordisks...done

  AVAILABLEDISKSELECTIONS:

  0.c1t0d0

  /pci@9,600000/SUNW,qlc@2/fp@0,0/ssd@w21000014c39d4d9d,0

  1.c1t1d0

  /pci@9,600000/SUNW,qlc@2/fp@0,0/ssd@w21000014c39d4d9b,0

  从输出可以知道此服务器有2个scsi硬盘。

  4、查看网络接口的状况,使用带选项的命令ifconfig–a.

  root@zsc#ifconfig-a

  lo0:

flags=2001000849mtu8232index1

  inet127.0.0.1netmaskff000000

  ce0:

flags=1000843mtu1500index2

  inet61.128.x.xnetmaskffffff00broadcast61.128.x.255

  ether0:

14:

4f:

1e:

69:

f3//ce0是网络接口的名字

  ce1:

flags=1000843mtu1500index3

  inet192.168.x.5netmaskffffff00broadcast192.168.x.255

  ether0:

14:

4f:

1e:

69:

f3//x是某个具体的数值,安全起见这样处理

  从输出可知,本机有2个网络接口。

如果网络接口配置错误或没有激活,将有可能在输出中看不见接口名称及状态。

  5、查看cpu的个数,使用不带参数的命令mpstat。

  root@db890~#mpstat  //这个命令也是查看CPU负载的工具

  CPUminfmjfxcalintrithrcswicswmigrsmtxsrwsysclusrsyswtidl

  0  0  1136  3  1  67  1  1  6  1  93  0  1  494

  1  0  1101  25  22  67  1  1  6  1  85  0  1  495

  2  0  1121  3  1  68  1  1  6  1  91  0  1  495

  3  0  1129  3  1  69  1  1  6  1  95  0  1  495

  4  0  1126  3  1  69  1  1  5  1  95  0  1  495

  5  0  1125  129126  66  1  1  5  1  90  0  1  495

  6  0  1123  4  1  68  1  1  6  1  92  0  1  495

  7  0  1105  242140  65  1  1  7  1  89  0  0  495

  从输出可知此服务器有8个cpu,此处按0-7的序号开始;有些输出不会以顺序序号开始,但可以从行数得知cpu数目(有多少行就有多少个cpu)。

(二)、用户及系统活动监控。

  1、     查看系统运行了多少时间,使用不带参数的命令uptime

  root@zsc#uptime

  上午8点48分  运行4天15:

12,2用户,平均负载:

0.01,0.01,0.01

  2、     查看有那些用户登录到solaris10系统,使用命令w.

  root@zsc#w

  上午9点12分  运行4天15:

36,3用户,平均负载:

0.02,0.01,0.01

  用户名  终端号      登入时间    闲置  JCPU  PCPU执行命令

  root  console    周一下午5点    5天  4:

53  4:

53/usr/dt/bin/dtscreen-modeblank

  root  pts/3    上午8点36分    25          -bash

  root  pts/4    上午9点12分                w

  3、     查看系统的运行级别,使用带选项的命令who–r.

  root@zsc#who-r

  .    run-level310月9日17:

36  3    0S

  4、查看系统近期的运行状态(包括关机、重起、用户登录等),使用不带参数的命令last.

  root@zsc#last|more

  root    pts/3    211.94.81.227  SatOct1414:

31仍在登录状态

  root    sshd    211.94.81.227  SatOct1414:

31仍在登录状态

  root    sshd    218.247.140.197SatSep1612:

03-12:

04(00:

00)

  oracle  console  :

0          SatSep1612:

02-关机(00:

02)

  reboot  systemboot            SatSep1612:

02

  reboot  systemdown            SatSep1612:

01

  root    pts/4    61.128.122.128  SatSep1612:

01-关机(00:

01)

  root    sshd    61.128.122.128  SatSep1612:

01-关机(00:

01)

  oracle  console  :

0          SatSep1612:

00-关机(00:

01)

  reboot  systemboot            SatSep1611:

59

  reboot  systemdown            SatSep1611:

59

  oracle  console  :

0          SatSep1611:

58-关机(00:

01)

  root    console  :

0          SatSep1611:

53-11:

54(00:

00)

  oracle  console  :

0          SatSep1611:

52-11:

53(00:

01)

  5、     查看系统运行的进程,通俗一点说就是查看系统正在运行那些程序,这是系统管理和维护过程中使用得最频繁的工具。

使用带若干选项的命令ps.ps-进程状态的缩写。

笔者常用的3个选项是:

-a列出请求最频繁的进程;-e列出正在运行的进程;-f打印进程的详细信息。

另外还有一个类似的工具ptree,用来查看进程树(提示:

linux里查看进程树的工具是pstree)。

  root@zsc#ps-aef

  UID  PIDPPID  C  STIMETTY      TIMECMD

  root  0  0  010月09?

      0:

10sched

  root  1  0  010月09?

      0:

02/sbin/init

  root  2  0  010月09?

      0:

00pageout

  root  3  0  010月09?

      46:

11fsflush

  daemon  209  1  010月09?

      0:

00/usr/lib/nfs/statd

  root15302  315  014:

31:

04?

      0:

00/usr/lib/ssh/sshd

  oracle2917  1  010月10?

      0:

06ora_smon_zsjdb

  oracle6093  1  010月12?

      0:

00ora_s041_zswdb

  oracle5995  1  010月12?

      0:

31ora_pmon_zswdb

  oracle2915  1  010月10?

      0:

11ora_ckpt_zsjdb

  root@zsc#ptree

  7  /lib/svc/bin/svc.startd

  212  /usr/lib/saf/sac-t300

  231  /usr/lib/saf/ttymon

  219  /usr/lib/saf/ttymon-g-d/dev/console-lconsole-Tsun-mldterm,ttc

  9  /lib/svc/bin/svc.configd

  102  /usr/lib/sysevent/syseventd

  103  /usr/sbin/nscd

  113  /usr/lib/picl/picld

  123  /usr/lib/crypto/kcfd

  201  /usr/sbin/cron

  2442/opt/oracle/product/9.2.0/bin/tnslsnrLISTENER-inherit

  2909ora_pmon_zsjdb

  2911ora_dbw0_zsjdb

  2913ora_lgwr_zsjdb

  有的时候,需要手动结束一个运行的进程,这种情况发生在诸如程序本身没有关闭指令等这样的场景。

结束进程使用kill或killall来完成。

执行结束进程的操作一定要仔细,看准确了再执行,不要杀错进程。

另外一个值得注意的是,不要随便赋予普通用户结束进程的权限,这是很冒险的事情。

  6、     查看磁盘的使用情况也是一项十分重要的工作。

再大的磁盘空间也会随时间的推移而逐渐变小,当磁盘空间增加到一定限度的时候,有一些程序将发生错误甚至停止工作,我这里曾有一台监控服务器发送没有标题和内容的报警邮件,原因就是分区/tmp被文件填满而不能写入数据所致。

使用带参数的命令df–k或df–h来查看系统硬盘的容量使用情况,笔者本人倾向于使用参数–h(humanreadableformat)使其输出的格式更加人性化。

  root@zsc#df-k

  文件系统        千字节  用了  可用容量    挂接在

  /dev/dsk/c1t0d0s0  1109369278869313095825  72%  /

  /devices            0    0    0  0%  /devices

  ctfs              0    0    0  0%  /system/contract

  proc              0    0    0  0%  /proc

  mnttab              0    0    0  0%  /etc/mnttab

  swap          2526104  10482525056  1%  /etc/svc/volatile

  objfs              0    0    0  0%  /system/object

  fd                0    0    0  0%  /dev/fd

  /dev/dsk/c1t0d0s5  605098215887924401681  27%  /var

  swap          2525376  3202525056  1%  /tmp

  swap          2525096    402525056  1%  /var/run

  /dev/dsk/c1t1d0s2  141179002  65553139701659  1%  /opt/disk2

  /dev/dsk/c2t40d0s6  2815892297006562271766775  3%  /opt/data1

  /dev/dsk/c2t40d1s6  281589229107661278665676  1%  /opt/data2

  /dev/dsk/c2t40d2s6  2815892292182197276591140  1%  /opt/data3

  root@zsc#df-h

  文件系统          大小  用了  可用容量    挂接在

  /dev/dsk/c1t0d0s0    11G  7.5G  3.0G  72%  /

  /devices          0K  0K  0K  0%  /devices

  ctfs              0K  0K  0K  0%  /system/contract

  proc              0K  0K  0K  0%  /proc

  mnttab            0K  0K  0K  0%  /etc/mnttab

  swap            2.4G  1.0M  2.4G  1%  /etc/svc/volatile

  objfs            0K  0K  0K  0%  /system/object

  fd              0K  0K  0K  0%  /dev/fd

  /dev/dsk/c1t0d0s5    5.8G  1.5G  4.2G  27%  /var

  swap            2.4G  320K  2.4G  1%  /tmp

  swap            2.4G  40K  2.4G  1%  /var/run

  /dev/dsk/c1t1d0s2    135G  64M  133G  1%  /opt/disk2

  /dev/dsk/c2t40d0s6  269G  6.7G  259G  3%  /opt/data1

  /dev/dsk/c2t40d1s6  269G  105M  266G  1%  /opt/data2

  /dev/dsk/c2t40d2s6  269G  2.1G  264G  1%  /opt/data3

  7、     查看网络连接,使用带选项的命令netstat.

  root@zsc#netstat–anp//linux用这个选项将输出更多的信息,包括连接的进程等

  NettoMediaTable:

IPv4

  Device  IPAddress          Mask    Flags  PhysAddr

  -------------------------------------------------------------

  ce0  61.128.x.1      255.255.255.255    00:

00:

0c:

07:

ac:

7a

  ce1  192.168.x.5    255.255.255.255SP  00:

14:

4f:

1e:

69:

f3

  ce0  61.128.x.3      255.255.255.255    00:

0c:

31:

0b:

48:

8a

  ce0  61.128.x.30    255.255.255.255    00:

14:

22:

0e:

f4:

c6

  ce0  61.128.x.27    255.255.255.255    00:

14:

22:

b0:

94:

18

  ce0  61.128.x.40    255.255.255.255SP  00:

14:

4f:

1e:

69:

f3

  ce1  224.0.0.0        240.0.0.0    SM  01:

00:

5e:

00:

00:

00

  ce0  224.0.0.0        240.0.0.0    SM  01:

00:

5e:

00:

00:

00

  oot@zsc#netstat–r  //查看路由表

  RoutingTable:

IPv4

  Destination      Gateway      FlagsRef  Use  Interface

  -----------------------------------------------------------------

  61.128.x.0      zsc            U      1  239ce0

  192.168.100.0    zsj            U      1    4ce1

  BASE-ADDRESS.MCAST.NETzsc            U      1    0ce0

  default        61.128.122.1      UG    1  2020

  localhost        localhost        UH    26877301lo0

  通过网络连接的状态,可以知道有哪些网络服务在工作,以及是否有非法的访问等情况。

  8、查看系统用户近期执行了哪些操作,使用命令history。

切换到其他用户,看看最近他们都干了些什么。

(三)、负载监控

  1、查看虚拟内存状态,使用带参数的命令vmstat。

  root@zsc#vmstat44  //每4秒钟采集一次,采集4次

  kthr    memory        page        disk      faults    cpu

  rbw  swapfreeremfpipofrdesrs1sdsdsd  in  sy  csussyid

  0003999808228674479270000010129018620500100

  00025256966370080  700000000128912520800100

  00025256966370080  000000000129912619200100

  0002525696637008192000000000130528321000100

  可以通过输出值来判断某些性能下降或者故障产生的原因。

  2、查看系统I/O,使用命令iostat.这个命令可以带很多选项,根据各自的需求选择选项。

  root@zsc#iostat33//采集数据3次,每次3秒钟

  tty    sd1      ssd0      ssd1      ssd2      cpu

  tintoutkpstpsservkpstpsservkpstpsservkpstpsserv  ussywtid

  0126  0  0  0  15  1  15  0  0  0  67  1  42  000100

  0  79  0  0  0  0  0  0  0  0  0  8  1  15  00010

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 党团工作 > 其它

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1