上一篇主要总结了Solaris安装后需要进行的一些设置,如ssh,pkgutil管理依赖,vim安装。
这一篇将会对Solaris资源管理与网络配置进行总结。
四 Solaris 系统管理
1,查询总内存
-bash-3.00# prtconf | grep Memory
2,查看可用内存
方法一
echo "::memstat" | mdb -k
方法二
vmstat
3,查看各个进程所用的内存
-bash-3.00# prstat PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP 809 noaccess 163M 115M sleep 59 0 0:00:10 0.1% java/18 984 root 2440K 1540K sleep 59 0 0:00:00 0.0% rpc.rstatd/1 1037 root 5500K 3220K cpu0 59 0 0:00:00 0.0% prstat/1 973 root 8436K 4524K sleep 59 0 0:00:00 0.0% sdtperfmeter/1 721 root 18M 17M sleep 59 0 0:00:02 0.0% Xorg/1 1009 root 6904K 3852K sleep 59 0 0:00:00 0.0% sshd/1 926 root 91M 9152K sleep 59 0 0:00:00 0.0% composite_aux_g/1 165 root 8172K 3156K sleep 59 0 0:00:00 0.0% nscd/31 826 smmsp 9440K 1804K sleep 59 0 0:00:00 0.0% sendmail/1 900 root 3896K 1288K sleep 59 0 0:00:00 0.0% iiimx/1 596 root 4764K 2176K sleep 59 0 0:00:00 0.0% syslogd/16 571 root 5248K 2244K sleep 59 0 0:00:00 0.0% devfsadm/7 568 root 6636K 2216K sleep 59 0 0:00:00 0.0% automountd/3 565 root 4668K 2324K sleep 59 0 0:00:00 0.0% vold/5 450 root 6684K 3288K sleep 59 0 0:00:00 0.0% inetd/4 567 root 6196K 1552K sleep 59 0 0:00:00 0.0% automountd/2 720 root 2604K 848K sleep 59 0 0:00:00 0.0% fbconsole/1 366 root 2940K 1052K sleep 59 0 0:00:00 0.0% cron/1 415 daemon 2960K 1744K sleep 59 0 0:00:00 0.0% statd/1 456 root 2500K 1300K sleep 59 0 0:00:00 0.0% ttymon/1 411 daemon 4916K 1488K sleep 59 0 0:00:00 0.0% nfsmapid/3 136 root 6144K 2372K sleep 59 0 0:00:00 0.0% syseventd/16 483 root 2112K 1056K sleep 59 0 0:00:00 0.0% smcboot/1 410 daemon 2504K 1424K sleep 60 -20 0:00:00 0.0% nfs4cbd/2 485 root 2112K 796K sleep 59 0 0:00:00 0.0% smcboot/1 487 root 2112K 796K sleep 59 0 0:00:00 0.0% smcboot/1 204 root 3772K 2548K sleep 59 0 0:00:00 0.0% picld/4 431 daemon 2488K 1408K sleep 60 -20 0:00:00 0.0% lockd/2 60 root 4116K 1308K sleep 59 0 0:00:00 0.0% dhcpagent/1 355 root 2384K 892K sleep 59 0 0:00:00 0.0% iscsi-initiator/2 663 root 2608K 1388K sleep 59 0 0:00:00 0.0% snmpdx/1 403 daemon 2880K 1268K sleep 59 0 0:00:00 0.0% rpcbind/1 445 root 1480K 736K sleep 59 0 0:00:00 0.0% utmpd/1 164 daemon 4452K 2256K sleep 59 0 0:00:00 0.0% kcfd/3 444 root 2504K 1388K sleep 59 0 0:00:00 0.0% ttymon/1 437 root 2124K 1032K sleep 59 0 0:00:00 0.0% sac/1 Total: 70 processes, 231 lwps, load averages: 0.00, 0.00, 0.02
4,查看cpu
#mpstat --查看cpu个数 CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl 0 15 1 0 102 36 95 10 0 0 0 132 0 68 0 32 #psrinfo -v --查看cpu主频 虚拟处理器 0 在下列时间的状态:12/13/2016 14:48:24 自 12/13/2016 13:04:47 开始已在运行。 i386 处理器以 2600 MHz 运行, 而且有 i387 compatible 浮点数处理器 #sar -u 3 20 --查看cpu使用率 SunOS unknown 5.10 Generic_147148-26 i86pc 12/13/2016 14:49:24 %usr %sys %wio %idle 14:49:27 0 0 0 99 14:49:30 0 0 0 100 14:49:33 0 1 0 99 14:49:36 0 0 0 100
5,查看硬盘
查看硬盘使用状况 # iostat -E cmdk0 Soft Errors: 0 Hard Errors: 0 Transport Errors: 0 Model: VMware Virtual Revision: Serial No: 000000000000000 Size: 42.95GB <42949509120 bytes> Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0 Illegal Request: 0 sd0 Soft Errors: 0 Hard Errors: 0 Transport Errors: 0 Vendor: NECVMWar Product: VMware IDE CDR10 Revision: 1.00 Serial No: Size: 0.00GB <0 bytes> Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0 Illegal Request: 4 Predictive Failure Analysis: 0 查看硬盘使用率 #df -h 文件系统 大小 用了 可用 容量 挂接在 /dev/dsk/c0d0s0 9.2G 4.3G 4.8G 48% / /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 3.5G 996K 3.5G 1% /etc/svc/volatile objfs 0K 0K 0K 0% /system/object sharefs 0K 0K 0K 0% /etc/dfs/sharetab /usr/lib/libc/libc_hwcap1.so.1 9.2G 4.3G 4.8G 48% /lib/libc.so.1 fd 0K 0K 0K 0% /dev/fd swap 3.5G 356K 3.5G 1% /tmp swap 3.5G 32K 3.5G 1% /var/run /dev/dsk/c0d0s7 30G 30M 29G 1% /export/home
五 Solaris 网络配置
情形:安装时图形界面开启了DHCP,现在切换为手动配置
1.查看网卡名称(e1000g0)
bash-3.2# ifconfig -a lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 e1000g0: flags=1004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4> mtu 1500 index 2 inet 192.168.70.132 netmask ffffff00 broadcast 192.168.70.255
2 转到/etc目录,查看是否有dhcp dhcp.e1000g0文件,如果有需要删除关闭dhcp
cd /etc ls |grep dhcp mv dhcp dhcpbk mv dhcp.e1000g0 dhcp.e1000g0bk
3 查看虚拟机虚拟网络查看器确定网络配置如下
hostname:oracle ip 192.168.70.132 netmask 255.255.255.0 defaultrouter 192.168.70.2 dns 8.8.8.8
4 新建/etc/nodename文件 内容为oracle
5 修改/etc/hosts
192.168.70.132 oracle
6 修改/etc/defaultrouter(网关)
192.168.70.2
7 修改/etc/hostname.e1000g0,内容为主机名
8 修改/etc/inet/hosts 内容等同/etc/hosts (软连接)
9 修改/etc/inet/netmask(子网掩码)
192.168.70.0 255.255.255.0
说明:192.168.70.0为VMvare 虚拟网络编辑器里的子网ip
10 修改修改/etc/networks(ip)
192.168.70.132 255.255.255.0 e1000g0
11 修改DNS
vim /etc/resolv.conf nameserver 8.8.8.8 vim /etc/nsswitch.conf 这行的意思是如果需要命名服务,首先查找/etc/inet/hosts文件,如果找不到,就到DNS中去查找。 hosts: files dns
重启后生效
说明: Solaris 修改主机名和linux方式不同
前者只需修改
/etc/hosts
/etc/sysconfig/network 文件
后者则需要修改多个相互关联的文件。