- 论坛徽章:
- 0
|
The doc is copied from a PPT, but is very useful for query and collect basic knowledge for Solaris.
Guide for Solaris Users
. Run levels
> 0: Power-down State
> s: Single-user State
> 3: Multiuser Level with NFS resources shared
> 5: Power-down state (auto turn off)
> 6: Reboot State
. Shutdown
> # shutdown -y -g0
> # poweroff
. File systems
> Solaris file system: UFS
> /tmp is a memory file system, it's empty after reboot
> Default home directories
> /export/home (/home is reserved for mounting network home
directories)
> File system configuration files
> /etc/vfstab (local)
> /etc/dfs/dfstab (NFS)
> #share(for NFS share)
. Configure network, gateway, DNS...
> Way 1: # /usr/sbin/sys-unconfig then reboot and answer questions
> Way 2: ifconfig command for dynamic setting
– # ifconfig -a
– # ifconfig plumb //enable a network interface
– # ifconfig up //change address on the fly
– # ifconfig dhcp start //use dhcp
> Way 3: Modify files for static setting (need reboot)
– Host name: /etc/nodename, /etc/hostname., /etc/hosts
– IP address: /etc/hosts, /etc/inet/ipnodes
– Netmask: /etc/netmasks
– Static gateway: /etc/defaultrouter
– Dhcp Client: touch /etc/hostname., touch
/etc/dhcp.
– DNS: /etc/resolv.conf, /etc/nsswitch.conf
– Domain: /etc/defaultdomain
. Software management
> # prodreg (GUI admin)
> # pkginfo
> # pkgadd -d , pkgrm, pkgchk,
> # patchadd, patchrm,...
> # showrev -p (display patches installed)
. Enable root user for telnet
> Comment out “CONSOLE=/dev/console” in /etc/default/login
. Enable root user for ftp
> Comment out “root” in /etc/ftpd/ftpusers
. View System Information
> # prtconf -D (show physical memory and other info)
> # prtdiag -v (only for solaris sparc: show machine model
and system board info)
> # psrinfo [-v] (show cpu info)
> # iostat -E, prtvtoc (show hard disk info)
> # isainfo -b (show kernel 32-bit or 64-bit)
> # isalist (show cpu architecture supported)
> # swap -s (show swap info)
. Useful resources
> Download currently shipped Solaris
>
http://www.sun.com/software/solaris/get.jsp
> Download Solaris Express (Solaris 11 early builds)
>
http://www.sun.com/software/solaris/solaris-express/get.jsp
> Or
http://www.opensolaris.org
> English resources:
>
http://docs.sun.com
> Solaris admin guide for new users
–
http://www.sun.com/bigadmin/content/solSysadminGuide/
> Solaris on X86 FAQ
http://www.sun.drydog.com
>
http://www.sun.com/bigadmin/home/index.html
Guide for Solaris Users
. Other useful resources
> Chinese resources:
>
http://docs.sun.com/app/docs/prod/solaris.10?l=zh
>
http://gceclub.sun.com.cn
>
http://www.chinaunix.net
> 中文FAQ
–
http://wiki.gceclub.sun.com.cn/index.php/Opensolaris_chinese_faq
> 博客
–
http://blog.gceclub.sun.com.cn/
Guide for System Monitoring
. Solaris has much more useful system monitoring
and control tools than any other operating system.
. Moreover, they're bundled with Solaris distribution.
. Let me tell you more in next slides...
. prstat
> You should use prstat rather than “top" on Solaris
> prstat [-a] (show output similar as top)
> prstat -mL -p (show detailed info of each LWP)
> See man prstat for more options
. mpstat (Show each cpu status)
. iostat -xn, vmstat....
. psradm
> You can disable/enable cpus
> You can prevent a cpu from handling interrupts
. pstack or
> Print stack trace of a process or a core file
. plimit
> Display a process' limit
. pldd
> Display the libraries the process uses.
. pargs -aec
> Display the process's parameters, such as JVM settings.
. pmap -xs
> Display a process's memory segments.
. pfiles
> Display the opened descriptors by a process
. pwdx
> Display current working directory of the process.
. psig
> Display the process's signal handlers.
. ptree
> Display process trees.
. ptime
> More accurate than "time" by microstate accounting, children of the command are not timed.
. pgrep / pkill
> Find / kill the process IDs for the pattern.
. truss or
> Trace system calls, signals, and faults
> -c: statistics, -t: trace specific system call, -u: trace a
library
> More options, see man truss
. Example
[paet2k2:/export/home/perfbin]# truss -p 3835
/228: pollsys(0xFA10FD98, 1, 0xFA10FD20, 0x00000000) = 1
/228: read(835," GET h ttp://w"..,8191) =138
/228: stat("/db0/suncache/s8.013/71/0DD02E1E4D379903", 0x01080B3C) = 0
/228: open64("/db0/suncache/s8.013/71/0DD02E1E4D379903", O_RDWR) = 766
/228: read(766," 0D D02E1E4D37"..,40) =40
/228: read(766,"
http://wt200"..,40
) =40
........
. Dtrace (from Solaris 10)
> Quickly identify the root causes of system and
application bottlenecks
> Over 30,000 probes built into Solaris 10
> Can create more probes on the fly
> New powerful, dynamically interpreted language (D) to
instantiate probes
> Probes are light weight and low overhead
> No overhead if probe not enabled
> Safe to use on “live” system
. Some simple examples of Dtrace (on Solaris 10)
> Why doesn't my app use CPU?
> # dtrace -n sched:::off-cpu'/execname ==
"my_app"/{@[ustack()] = count()}'
> Which system call are called most often?
> # dtrace -n syscall:::entry’/pid == 1234/{ @syscalls[probefunc]
= count(); }’
> Trace user functions
> /usr/demo/userfunc.d
> Trace I/O on what files and what disk?
> /usr/demo/iosnoop.d
> Trace I/O time
> /usr/demo/iotime.d
> Why thread sleep and how long?
> /usr/demo/whatfor.d
> Who are in the CPU running queue?
> /usr/demo/whoqueue.d
> Which applications are blocking on which and how long?
> /usr/demo/whofor.d
> Which thread preempts who?
> /usr/demo/whopreempt.d
> Who did most page-ins?
> dtrace -n
[email=pgin’{@[execname]pgin’{@[execname[/email]
] = count()}’
> Who calls most xcalls?
> # dtrace -n
[email=xcalls’{@[execname]xcalls’{@[execname[/email]
] = count()}’
. Resources for Dtrace
> “Solaris Dynamic Tracing Guide” is an excellent
resource. Many of the examples in this presentation are
from the Guide
>
http://docs.sun.com/db/doc/817-6223
> The BigAdmin DTrace web page has a lot of good info
>
http://www.sun.com/bigadmin/content/dtrace/
> Open Solaris DTrace community page
>
http://www.opensolaris.org/os/community/dtrace/
> DTrace toolkit contains a lot of very useful scripts
>
http://www.opensolaris.org/os/community/dtrace/dtracetoolkit/
> Read the Blogs from Bryan Cantrill, Adam Leventhal,
Mike Shapiro
>
http://blogs.sun.com/roller/page/bmc
>
http://blogs.sun.com/roller/page/ahl
>
http://blogs.sun.com/mws
. You can google DTrace
>
http://www.google.com/search?q=dtrace
. Advanced Tools
> cpustat
> e.g. #cpustat -c pic0=L2_dmiss_ld,pic1=Instr_cnt,sys 1 100
> trapstat
> intrstat
> busstat
> kstat (mpstat, vmstat are based on kstat)
> mdb
> lockstat (show kernel level locks)
> Plockstat (show user level locks) (from Solaris 10)
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/4448/showart_275381.html |
|