- 论坛徽章:
- 0
|
第一章 AIX操作系统的安装... 5
安装介质与方式... 5
BOS(Base Operating System)安装... 5
第二章 AIX操作系统基本命... 8
? 系统的进入和退出... 8
password. 8
mkdir、rm、mv和cd. 8
ls. 9
date. 10
wc. 10
who. 10
finger 11
ps. 11
kill 15
find. 15
grep. 16
第三章 vi编辑器... 18
3.1 vi 简介... 18
3.2 vi的进入与离开... 18
3.3 vi 的文本输入模式... 18
3.4 vi 基本编辑命令... 19
3.5 文件处理子命令... 21
第四章 存储管理... 21
4.1 相关术语... 21
PV (Physical Volume) 21
VG (Volume Group) 21
PP (Physical Partition) 22
LP (Logical Partition) 22
LV(Logical Volume) 22
Mirror(镜像) 22
VGDA(Volume Group Description Area,卷组描述区) 22
VGSA(Volume Group Status Area,卷组状态区) 23
4.2 PV的管理... 23
硬盘安装... 23
配置一个PV. 23
修改PV的属性... 24
删除一个PV. 24
4.3 VG的管理... 24
创建一个VG.. 24
删除一个VG.. 25
对VG的管理... 25
4.4 LV的管理... 27
增加一个LV. 27
修改LV的属性... 28
删除一个LV. 31
第五章 RS6000 更换硬盘的过程... 32
HDISK0和HDISK1做成MIRROR,是ROOTVG.. 32
先做系统备份... 32
查看HDISK0的S/N,P/N号等,在换盘的时候做对照... 33
查看所有硬盘(包括逻辑盘)的状态 # lsdev -Cc disk. 33
停HACMP. 34
把HDISK0从ROOTVG中不做MIRROW.. 34
关机... 34
开机... 34
把HDISK0加到ROOTVG中并做镜像... 35
重启动2号机... 35
关闭1号机的HACMP. 35
重启动1号机... 35
启动1号机的HACMP. 35
启动2号机的HACMP. 35
第六章 HACMP安装配置... 36
准备工作... 36
检测连8port卡的TTY. 37
使用AIX安装CD安装文件... 37
修改电源管理... 38
Netscape安装和配置... 38
安装HACMP/ES软件... 38
安装最新的AIX和HACMP补丁... 38
SSA微码升级... 39
设置主机名... 39
为所有网卡绑定boot或standby的IP地址... 39
创建VG、LV和FS. 40
修改系统参数... 41
重启两台机器... 41
配置HACMP. 41
HA测试(一): 启动和关闭... 43
HA测试(二):本机IP接管... 44
HA测试(三):资源接管... 44
第七章 模拟硬盘更换... 46
预做方案... 46
查看硬盘信息... 46
把要更换硬盘从VG中拿掉... 46
关机... 46
准备工作... 46
拆机箱... 46
更换硬盘... 47
开机... 47
查看硬盘... 47
改PV. 47
做镜像... 47
把另一块盘18G拿掉... 47
关机... 48
更换硬盘... 48
开机... 48
查看硬盘信息... 48
改PV. 48
做镜像... 48
起服务... 48
第二方案... 50
把把机器的前面板拆下... 50
查看硬盘信息,看哪个盘是干什么用的... 50
把要更换硬盘从VG中拿掉... 50
把硬盘做成PV. 51
lspv查看硬盘情况... 51
把硬盘加到VG中... 51
把18G硬盘数据复制到36G上, 51
取下另一18G硬盘... 51
把硬盘做成PV. 51
做镜像... 51
检查,OK. 52
第一章 AIX操作系统的安装
安装介质与方式
AIX操作系统的安装可以:
1)
通过Tape安装。 需要16M
RAM。PCI总线的RS/6000系列小型机不支持该方式。
2) 通过CD-ROM安装。 需要有8M RAM.
3)
通过网络安装。这需要使用AIX Network
Install Manager (NIM)来实现。系统支持通过Token Ring 、FDDI、ethernet的安装。
4)
预先安装(Preinstall).在购买时选择“预装操作系统”。
AIX操作系统的安装方式(Installation Method)有以下四种:
完全覆盖安装: 操作系统被安装在rootvg的第一块硬盘上,这将覆盖原系统中所有的系统保留目录。
保留安装:这种安装方式可以保留操作系统的版本不变,同时保留 rootvg上的用户数据,但将覆盖/usr 、/tmp、/var 和/
目录。用户还可以利用/etc/preserve.list指定系统安装时需要保留的文件系统。默认的需保留的文件系统为/etc/filesystem
中所列。
升级安装:这种安装方式用于操作系统的升级,这将覆盖/tmp目录。这是系统默认的安装方式。
备份带安装:恢复用mksysb命令生成的安装带中/image.data中指定的文件系统,这种安装方式用于系统(rootvg)的复制。
BOS(Base Operating System)安装
? 打开主机电源。
? 连接好系统终端,把第一张安装介质(磁带、光碟)插入驱动器。
? 在开机后按(图形终端)进入系统安装画面。
? 当终端显示如下信息时:
☆☆☆☆☆☆Please define the system console☆☆☆☆☆☆
Type a 1 and press enter to use this terminal as the system console.
Type een 1 en druk op enter om deze terminal als de systeemconsole to gebruiken.
Skrive tallet 1 og trykk paa enter for aa bruke denne terminalen som systemkonsoll.
Pour definir ce terminal comme console systeme, appuyez sur 1puis sur entree.
Taste 1 and ansch1iessend die eingabetaste druecken,um
diese datenstation als systemkonsole zu verwenden.
Prenier I1 tasto 1 ed invio per usare questo terminal como consolo.
Escriba 1 y pulse intro para utilizer esta terminal como consola del sistema.
a)Tryck paa 1 och sedan paa enter om dy vill att haer terminalen ska vara systemkonsol
键入“1”并回车(注意:键入的“1”不回显)选择主控台
? (5) 屏幕上将不断显示一些信息,几分钟后出现:
>>> 1 Type 1 and press enter to have English during install.
2 Type 2 en druk op enter om tijdens het installeren het Nederlands te
krijgen.
3 Entrez 3 pour effectuer 1 installation en francais.
4 Fr Installation in deutscher sprache 4 eingeben und die eingabetaste drcken.
5 Immettere 5 e premereinvio per 1 installazione initaliona.
6 Escriba 6 ypulse intro para usar el idioma espa ol durante la instalaci n.
7 Skriv 7 och tryck ned enter=svenska vid installationen.
88 Help?
>>>Choice【1】:
键入“1”后回车,选择语言环境为English
? (4) 此后屏幕出现:
Welcome to Base Operating System
Installation and Maintenance
Type the number of your choice and press enter .Choice is indicated by>>>
>>>1 Start install now with default settings
2 Change/show installation settings and install
3 Start Maintenance Mode for system Recovery
88 Help?
99 Previous Menu
>>>Choice 〔1〕:
这是系统安装和维护的主菜单。
? 安装BOS基本操作系统
键入“2”并回车,屏幕出现“Install and Setting”画面:
Installlation and a Settings
Either type 0 and press enter to install with current settings,
or type the number of the setting you want to change and press enter.
1 system setting:
Method of installlation.….….…Preserve install
Disk wher you want to install .….…hdisk0
2 Prinary Language Environment settings (AFTER Install):
Cultural Convention.….….… English(United States)
Language.….….….….….….. English(United States)
Keyboard.….….….….….….. English(United States)
Keyboard Type.….….….…... Eefault
3 Install Trusted Computing Base.…No
>>>0 Install AIX wint the current settings listed above.
88 Help?
99 Previous Menu
>>>Choice 〔1〕:
这是系统安装的默认设置,用户可以根据需要进行修改。
与此同时,在屏幕的右下角会出现如下的警告信息:
WARNING:Base Operating system installation will destroy or impair recovery of ALL data on the
destination disk hdisk0.
以上是提醒用户安装系统的后果将破坏用户原有的硬盘上的数据。
安装时可以选择保护安装(Preserve install) 或完全覆盖安装(New and complete overwrite)。
? (6) 设置完毕选择 0
安装即开始,屏幕将不断显示安装的进行情况,当BOS安装完毕系统将自动重启,否则在BOS安装完毕时屏幕会再次提示拧钥匙并处于等待状态。
? (7)
系统重新启动后,屏幕会提示输入终端类型,键入主控台的类型(vt100或ibm3151),此后将出现系统设置屏,用上下键移动亮条进行基本系统参数的
设置:
★set date and time 设置time zone选择 cur+8
★set root password 分两次输入相同口令,即可设置成功,移动光标至Task complete-Exit to AIX LOGIN退出。
注意:不能用F3或F10键退出,而应选菜单以通知操作系统设置任务已完成;否则,在下次启机时仍会自动进入系统设置画面。同时如果终端类型输入错误,屏幕显示将不可预料,此时可以用ctrl-c退出,重新输入。
? 至此,BOS安装完毕,以后启动机器时将不会有配置信息,直接出现LOGIN提示符。
第二章 AIX操作系统基本命
? 系统的进入和退出
login: 输入用户名(例如:user01)
password: 输入用户口令
若用户名及口令均正确,则用户将登陆成功。此时系统会出现命令提示符$或#,即表示可接收用户输入的操作系统命令。
退出系统:或 exit或logout。
例:#(or$)exit
#(or$)Ctrl^D
注,#为ROOT用户的命令提示符,$为一般用户
password
password命令用于建立或修改用户的密码。
如:
#password
passwd: —输入旧口令
new passwd: —输入新口令
re-enter new paswd: —重新输入新口令
mkdir、rm、mv和cd
mkdir :用于创建目录
$ mkdir oracle
$ ls
oracle
$
rm :用于删除文件或目录(rm –r 删除目录时目录内有内容,用-r一起删除)
$ rm -r oracle
$ ls
$
mv :用于移动文件
$ mkdir ll
$ ls
ll
$ mkdir kk
$ ls
kk ll
$ mv ll kk
$ ls
kk
$ cd kk
$ ls
ll
$
cd :用于进入系统某一级目录中去
$ cd /
$ pwd
/
$ cd /home/oracle
$ pwd
/home/oracle
$
ls
? 功能:显示目录中的内容,列出当前目录中所有文件的文件名
? 参数说明:
a :列出目录中所有文件
d :列出所有子目录
l :列出长格式文件信息
? 举例:
ls –a :列出当前目录中的所有文件
$ ls -a
#UNTITLED#
.dt
createdbscripts oracle
.
.dtprofile
dead_letter smit.log
..
.profile
ll
smit.script
.TTauthority
.sh_history
make.log websm.log
.Xauthority
afiedt.buf
mbox
websm.script
$
ls –l :显示文件的详细信息
$ ls -l
total 295
-rw-r--r-- 1 201
dba
3 Sep 01 15:24 #UNTITLED#
-rw-r--r-- 1 201
dba
51 Jul 08 18:18 afiedt.buf
drwxrwxr-x 2 201
dba
512 May 08 11:49 createdbscripts
drwx------ 2 201
dba
512 Jun 19 09:27 dead_letter
drwxr-xr-x 2 201
dba
512 Sep 22 10:17 ll
-rw-r--r-- 1 201
dba 95987
Apr 18 14:51 make.log
-rw------- 1 201
dba 11174
Sep 17 09:15 mbox
drwxr-xr-x 3 201
dba
512 Sep 22 10:21 oracle
-rw-r--r-- 1 201
dba
8971 Sep 20 11:08 smit.log
-rw-r--r-- 1 201
dba
5437 Sep 20 11:08 smit.script
-rw-r--r-- 1 201
system 1682 Sep 02
15:18 websm.log
-rw-r--r-- 1 201
system 21441 Sep 02 15:10
websm.script
$
date
? 功能:显示当前日期和时间,超级用户可以进行修改
? 举例:$ date
Mon Sep 22 10:28:26 BEIST 2003
$
wc
ü 功能:计算文件中的行数、字数和字符数
ü 参数说明:
c :计算字符数
l :计算行数
w :计算字数
举例:
# wc profile
13 53
381
profile
| | |
行数 字数 字符数
$ wc smit.log
422 1162 8971 smit.log
$
who
? 功能:列出当前系统注册的用户
举例:$who am i-- 列出当前系统使用者身份
$ who
oracle lft0 Sep 22 09:05
oracle
pts/0 Sep 22
10:17 (192.168.100.79)
oracle pts/4 Sep 22 09:05 (:0.0)
$ who am i
oracle
pts/0 Sep 22
10:17 (192.168.100.79)
$
finger
? 显示当前登陆到系统中的用户的信息
# finger
Login
Name
TTY Idle When Site I
nfo
oracle
???
*l0 2:02 Mon 09:05
oracle
???
p4 1:59 Mon 09:05
root
???
p0 Mon 11:06
# finger oracle
Login name: oracle
Directory: /usr/oracle/ora90 Shell: /usr/bin/ksh
On since Sep 22 09:05:35 on lft0, 2 hours 2 minutes Idle Time
(messages off)
On since Sep 22 09:05:41 on pts/4, 1 hour 59 minutes Idle Time
from :0.0
No Plan.
#
ps
? 功能:显示后台进程的有关信息。单独使用ps将显示由当前终端启动的后台进程的PID、终端号、进程已执行时间以及启动该进程的命令
? 语法:ps -options
? 参数说明:
-e :显示系统内当前运行的所有后台进程
-f :除ps所提供的信息外,还显示用户名、PPID(父进程ID)及启动时间
-l :除ps所提供的信息外,还显示 User ID, PPID 和进程优先级
例:
# ps
PID TTY TIME CMD
803034 pts/0 0:00 -ksh
917524 pts/0 0:00 ps
# ps -ef
UID
PID PPID C
STIME TTY TIME CMD
root
1 0 0
09:03:04 - 0:00 /etc/init
root
90262 1 0
09:03:42 - 0:00 /usr/ccs/bin/shlap64
root 106572 139368 0
09:03:30 - 0:01 /usr/lpp/X11/bin/X
-D /usr
oracle 123030 155720 0 09:05:36 - 0:00 dtwm
root
139368 1 0
09:03:29 - 0:00 /usr/dt/bin/dtlogin
-daemo
oracle 155720 172088 0 09:05:35 - 0:00 /usr/dt/bin/dtsession
root 163946 245824 0
09:04:28 - 0:00
/usr/sbin/rsct/bin/rmcd -r
root 172088 139368 0
09:03:30 - 0:00 dtlogin
-daemo
oracle 180378 188526 0 09:06:20 pts/4 0:00 -ksh
root 188526 483470 0 09:06:10 pts/4 0:00 -ksh
root 196670 303186 0
09:04:34 - 0:00 rpc.ttdbserver
100083 1
root 204866 245824 0
09:04:34 - 0:00
/usr/sbin/rsct/bin/IBM.Aud
oracle 221370 581780 0 09:05:41 - 0:03 /usr/dt/bin/dtterm
root
229440 1 0
09:03:41 - 0:01 /usr/sbin/syncd 60
root
237626 1 0
09:03:42 - 0:00 /usr/lib/errdemon
root
245824 1 0
09:03:47 - 0:00 /usr/sbin/srcmstr
root 262240 245824 0
09:03:50 - 0:00 /usr/sbin/syslogd
root 278642 245824 0
09:04:28 - 0:00
/usr/sbin/rsct/bin/ctcasd
root 286806 245824 0
09:04:30 - 0:00
/usr/sbin/rsct/bin/IBM.CSM
oracle 295050
1 0 09:07:03 - 0:00
ora_dbw0_ORCL
root 303186 245824 0
09:03:59 - 0:00 /usr/sbin/inetd
root 311380 245824 0
09:03:53 - 0:00 sendmail: accepting
connec
root 319566 245824 0
09:03:56 - 0:00 /usr/sbin/portmap
root 327760 245824 0
09:04:02 - 0:00 /usr/sbin/snmpd
root 335954 245824 0
09:04:06 - 0:00 /usr/sbin/dpid2
root 344150 245824 0
09:04:09 - 0:00 /usr/sbin/hostmibd
oracle 368788
1 0 11:09:35 - 0:00
oracleORCL (LOCAL=NO)
root
376946 1 0
09:04:18 - 0:00 /usr/sbin/cron
root 385122 245824 0
09:04:12 - 0:00 /usr/sbin/biod 6
oracle 393320
1 0 09:07:03 - 0:00
ora_reco_ORCL
daemon 401510 245824 0 09:04:15 - 0:00 /usr/sbin/rpc.statd
root
409726 1 0
09:04:28 - 0:00 /usr/bin/itesmdem
itesrv.i
root 417902 245824 0
09:04:18 - 0:00 /usr/sbin/rpc.lockd
root
434288 1 0
09:04:25 - 0:00 /usr/sbin/uprintfd
root 442484 245824 0
09:04:25 - 0:00 /usr/sbin/writesrv
root 450676 245824 0
09:04:22 - 0:00 /usr/sbin/qdaemon
root 458874 245824 0
09:04:31 - 0:00
/usr/sbin/rsct/bin/IBM.Ser
oracle 475266
1 0 09:05:35 - 0:00
/usr/dt/bin/ttsession -s
oracle 483470 221370 0 09:05:41 pts/4 0:00 /usr/bin/ksh
oracle 491646
1 0 09:07:02 - 0:00
ora_pmon_ORCL
oracle 499860
1 0 09:07:33 pts/4 0:08
/usr/oracle/ora90/bin/tnsl
oracle 524452
1 0 09:07:03 - 0:01
ora_ckpt_ORCL
root
532612 1 0
09:04:25 lft0 0:00 /usr/sbin/getty /dev/conso
root 540830 245824 0
09:04:32 - 0:00
/usr/sbin/rsct/bin/IBM.ERr
imnadm 557194
1 0 09:04:25 - 0:00
/usr/IMNSearch/httpdlite/h
root
565388 1 0
09:04:25 - 0:00
/usr/lpp/diagnostics/bin/d
oracle 573584
1 0 09:07:03 - 0:01
ora_smon_ORCL
oracle 581780 123030 0
09:05:41 - 0:00 /usr/dt/bin/dtexec
-open 0
oracle 589978
1 0 09:07:03 - 0:00
ora_lgwr_ORCL
oracle 598188
1 0 09:17:14 - 0:00
oracleORCL (LOCAL=NO)
oracle 606440
1 0 11:09:28 - 0:00
oracleORCL (LOCAL=NO)
oracle 622592
1 0 11:09:49 - 0:00
oracleORCL (LOCAL=NO)
oracle 631032
1 0 11:09:34 - 0:00
oracleORCL (LOCAL=NO)
oracle 638984
1 0 11:09:47 - 0:00
oracleORCL (LOCAL=NO)
oracle 647404
1 0 10:58:31 - 0:01
oracleORCL (LOCAL=NO)
oracle 655384
1 0 10:46:10 - 0:00
oracleORCL (LOCAL=NO)
oracle 663756
1 0 11:09:38 - 0:00
oracleORCL (LOCAL=NO)
oracle 671964
1 0 10:57:32 - 0:00
oracleORCL (LOCAL=NO)
oracle 679998
1 0 11:09:32 - 0:00
oracleORCL (LOCAL=NO)
oracle 688340
1 0 11:01:09 - 0:00
oracleORCL (LOCAL=NO)
oracle 696500
1 0 11:09:32 - 0:00
oracleORCL (LOCAL=NO)
oracle 704756
1 0 11:09:32 - 0:00
oracleORCL (LOCAL=NO)
oracle 712916
1 0 09:31:17 - 0:00
oracleORCL (LOCAL=NO)
oracle 721104
1 0 09:33:58 - 0:00
oracleORCL (LOCAL=NO)
root 729308 803034 4 11:09:56 pts/0 0:00 ps -ef
oracle 737532
1 0 11:07:43 - 0:00
oracleORCL (LOCAL=NO)
oracle 753856
1 0 09:34:03 - 0:00
oracleORCL (LOCAL=NO)
oracle 762104
1 1 11:09:53 - 0:00
oracleORCL (LOCAL=NO)
oracle 770280
1 0 11:09:46 - 0:00
oracleORCL (LOCAL=NO)
oracle 778466
1 0 11:04:42 - 0:00
oracleORCL (LOCAL=NO)
oracle 786634
1 0 11:09:50 - 0:00
oracleORCL (LOCAL=NO)
oracle 794656
1 0 11:08:10 - 0:00
oracleORCL (LOCAL=NO)
root 803034 1056846 0 11:06:38 pts/0 0:00 -ksh
oracle 811034
1 0 10:59:20 - 0:00
oracleORCL (LOCAL=NO)
oracle 819402
1 0 09:47:03 - 0:00
oracleORCL (LOCAL=NO)
oracle 827620
1 0 10:10:40 - 0:00
oracleORCL (LOCAL=NO)
oracle 835810
1 0 10:57:30 - 0:00
oracleORCL (LOCAL=NO)
oracle 843988
1 0 09:49:16 - 0:00
oracleORCL (LOCAL=NO)
oracle 852190
1 0 10:52:22 - 0:00
oracleORCL (LOCAL=NO)
oracle 860378
1 0 09:33:55 - 0:00
oracleORCL (LOCAL=NO)
oracle 868586
1 0 10:52:21 - 0:00
oracleORCL (LOCAL=NO)
oracle 876796
1 0 11:09:29 - 0:00
oracleORCL (LOCAL=NO)
oracle 884784
1 0 10:59:22 - 0:00
oracleORCL (LOCAL=NO)
oracle 893164
1 0 10:42:26 - 0:00
oracleORCL (LOCAL=NO)
oracle 909556
1 0 11:09:49 - 0:00
oracleORCL (LOCAL=NO)
oracle 917528
1 1 11:09:53 - 0:00
oracleORCL (LOCAL=NO)
oracle 925948
1 0 11:09:47 - 0:00
oracleORCL (LOCAL=NO)
oracle 942326
1 0 11:07:47 - 0:00
oracleORCL (LOCAL=NO)
oracle 950360
1 0 11:07:35 - 0:00
oracleORCL (LOCAL=NO)
oracle 958486
1 0 11:09:39 - 0:00
oracleORCL (LOCAL=NO)
oracle 974934
1 0 11:07:23 - 0:00
oracleORCL (LOCAL=NO)
oracle 983294
1 0 10:48:40 - 0:00
oracleORCL (LOCAL=NO)
oracle 999438
1 0 10:58:51 - 0:00
oracleORCL (LOCAL=NO)
oracle 1007638
1 0 10:52:27 - 0:00
oracleORCL (LOCAL=NO)
oracle 1015834
1 0 11:08:09 - 0:00
oracleORCL (LOCAL=NO)
oracle 1024012
1 0 09:45:28 - 0:00
oracleORCL (LOCAL=NO)
oracle 1032230 155720 0 11:08:33 - 0:00 /usr/dt/bin/dtexec -open 0
oracle 1040390
1 0 10:58:52 - 0:00
oracleORCL (LOCAL=NO)
root 1056846 303186 0 11:06:38 - 0:00 telnetd -a
oracle 1064970
1 0 10:05:40 - 0:00
oracleORCL (LOCAL=NO)
oracle 1081404
1 0 11:09:31 - 0:00
oracleORCL (LOCAL=NO)
oracle 1089562
1 0 11:09:32 - 0:00
oracleORCL (LOCAL=NO)
oracle 1097770
1 1 11:09:53 - 0:00
oracleORCL (LOCAL=NO)
oracle 1105962
1 0 11:09:32 - 0:00
oracleORCL (LOCAL=NO)
oracle 1114198
1 0 11:07:47 - 0:00
oracleORCL (LOCAL=NO)
oracle 1122406
1 0 11:07:00 - 0:00
oracleORCL (LOCAL=NO)
oracle 1130564
1 0 10:27:48 - 0:00
oracleORCL (LOCAL=NO)
oracle 1138778
1 0 10:57:28 - 0:00
oracleORCL (LOCAL=NO)
oracle 1146948
1 0 11:07:26 - 0:00
oracleORCL (LOCAL=NO)
oracle 1155106 1032230 0 11:08:33 - 0:00 /usr/dt/bin/dtscreen
oracle 1163312
1 0 11:09:39 - 0:00
oracleORCL (LOCAL=NO)
oracle 1171526
1 0 11:00:39 - 0:01
oracleORCL (LOCAL=NO)
oracle 1179700
1 0 10:53:31 - 0:00
oracleORCL (LOCAL=NO)
oracle 1196136
1 0 11:09:32 - 0:00
oracleORCL (LOCAL=NO)
oracle 1204300
1 0 10:58:52 - 0:00
oracleORCL (LOCAL=NO)
oracle 1212516
1 0 10:54:08 - 0:00
oracleORCL (LOCAL=NO)
oracle 1220718
1 0 10:42:22 - 0:00
oracleORCL (LOCAL=NO)
oracle 1237084
1 0 10:42:20 - 0:00
oracleORCL (LOCAL=NO)
oracle 1245250
1 0 11:09:33 - 0:00
oracleORCL (LOCAL=NO)
oracle 1253470
1 0 11:08:09 - 0:00
oracleORCL (LOCAL=NO)
oracle 1261658
1 0 11:09:32 - 0:00
oracleORCL (LOCAL=NO)
oracle 1269822
1 0 10:28:05 - 0:10
oracleORCL (LOCAL=NO)
oracle 1294398
1 0 10:46:13 - 0:00
oracleORCL (LOCAL=NO)
oracle 1302590
1 0 10:46:08 - 0:00
oracleORCL (LOCAL=NO)
oracle 1310814
1 0 11:09:34 - 0:00
oracleORCL (LOCAL=NO)
oracle 1318996
1 0 11:04:45 - 0:00
oracleORCL (LOCAL=NO)
oracle 1335400
1 0 11:09:47 - 0:00
oracleORCL (LOCAL=NO)
oracle 1343576
1 0 11:09:39 - 0:00
oracleORCL (LOCAL=NO)
oracle 1351830
1 0 11:09:31 - 0:00
oracleORCL (LOCAL=NO)
oracle 1368176
1 0 11:09:32 - 0:00
oracleORCL (LOCAL=NO)
#
# ps -l
F S
UID PID PPID C
PRI NI ADDR SZ
WCHAN TTY TIME CMD
240001 A 0 803034 1056846
1 60 20 20009284
952
pts/0 0:00 k
sh
200001 A 0 1114200 803034
1 60 20 2003549a
488
pts/0 0:00 p
s
#
kill
? 功能:杀死后台进程
? 语法:kill -num PID
? 举例:
kill –9 23094 (-9 是软件终止进程的信号,是不可忽略的)
find
? 功能:在一个或多个目录中查找符合指定条件的文件,显示文件名或对这些文件进行特定的操作
? 语法:find path expression
? 参数说明:
-type
f
文件
d
目录
-size
+n
文件大小超过n blocks(1block=512 bytes)
-n
文件大小小于n blocks
n
文件大小等于n blocks
-mtime
+x
X天以前被修改的文件
-x
X天以内被修改的文件
-perm
onum
访问指定权限的文件(权限以8进制表示)
mode
访问指定权限的文件(权限以字母表示,如rwx)
-user
User
属于用户user的文件
-o
逻辑‘或’
? 举例:
1. find . –name ‘unix’ –print
在当前目录及其子目录中查找文件名为“m*”的所有文件(‘*’是通配符)并显示文件名。
# find . -name "unix" -print
./usr/lib/boot/unix
./usr/oracle/ora90/inventory/filemap/md/demo/unix
./usr/oracle/ora90/inventory/filemap/ultrasearch/tools/remotecrawler/scripts/uni
x
./usr/oracle/ora90/md/demo/unix
./usr/oracle/ora90/ultrasearch/tools/remotecrawler/scripts/unix
./upload/Disk2/stage/Components/oracle.sysman.website.nls/9.2.0.1.0/1/DataFiles/
Expanded/websitehtm/unix
./unix
#
2. find . –name ‘m*’ –exec ls –l {} \;
在当前目录及其子目录中查找文件名为“m*”的所有文件(‘*’是通配符)并显示详细的文件列表信息。-exec 使得find以非交互的方式执行-exec后的命令。‘{}’用于保留find的查找结果,并将其作为ls –l 的输入。
3. find . –name ‘m*’ –ok rm {} \;
在当前目录及其子目录中查找文件名为“m*”的所有文件(‘*’是通配符)删除之。-ok 使得find以交互的方式执行-ok后的命令。
4. find . -perm 644 -mtime +4 –print
在当前目录及其子目录中查找权限为644、4天以前被修改过的文件。
grep
? 功能:在文件或标准输入中搜索与指定格式相匹配的行
? 语法:grep [options] pattern [file1 file 2..]
? 参数说明:
-v :显示与指定格式不匹配的行
-c :统计满足条件的行数
-l :只显示满足匹配条件的文件名
-n :显示满足条件的行所在的行号
-I :查找时忽略大小写
-w :做全单词匹配
第三章 vi编辑器
3.1 vi 简介
vi 是 UNIX
世界里使用非常普遍的全屏幕文本编辑器,几乎任何一种UNIX系统都会提供这套软件。AIX当然也支持这种编辑器。熟悉DOS下的文本处理后,用户在开始
接触vi时也许会感到它并不好用,然而一旦用户熟悉、掌握了vi ,就会发现它实在是一种功能强大、使用灵活方便的编辑器。
UNIX
提供一系列的ex编辑器,包括ex,edit和vi。相对于全屏幕编辑器,现在可能很难想像如何使用ex,edit这种行列编辑器。 vi
的原意是“Visual”,它是一个立即反应的编辑程式,也就是说可以立刻看到操作结果。vi
必须控制整个终端屏幕的显示输出,而终端的种类有许多种,特性又不尽相同,所以 vi 有必要知道现在所使用的是哪一种终端。这是通过 TERM
这个环境变量来设定的。
在命令行键入vi就可以进入vi的编辑环境。vi
有三种模式:命令模式、文本输入模式以及命令项模式。执行vi以后,会先进入命令模式,此时用户可输入各种子命令对行进行编辑,如删除行、拷贝行等。在文
本输入模式下,用户可以修改一行的内容并添加新行。在命令模式下键入 i、I、a
、A或o等即可进入文本输入模式,键入ESC键即可返回命令模式。在命令项模式下,用户可以通过子命令输入更多的参数,如“/”子命令要求输入下一个查找
项。用户使用ESC键返回命令模式。
3.2 vi的进入与离开
vi可以在全屏幕方式下编辑一个或多个文件。如果在执行vi时没有指定文件名,则vi
命令会自动产生一个无名的空文件。如果指定的文件不存在,则vi将按指定的文件名创建一个新的文件。进入 vi
后屏幕左方会出现波浪符号,凡是列首有该符号就代表此列目前是空的。要离开 vi 可以在命令模式下键入 :q , :wq
命令则是存档后再离开(注意冒号)。注意vi并不锁住所编辑的文件,因此多个用户可能同时编辑一个文件,那么最后保存的文件版本将被保留。
以下是vi 命令使用的一些选项及说明:
-c command :在对文件进行编辑前,先执行command命令;
-r filename :恢复文件filename;
-R
:以只读方式编辑文件;
-y number :每屏只编辑number 行文本。
3.3 vi 的文本输入模式
使用以下几种命令可以进入文本输入模式(用户在任何时候都可以按ESC键返回命令模式):
新增 (append) :
a :从光标所在位置之后开始输入文本
A :从光标所在行尾开始输入文本
插入 (insert) :
i :从光标所在位置之前开始输入文本
I :从光标所在行的第一个非空白字符前面开始输入文本
开始 (open) :
o :在光标所在行后插入一新行。
O :在光标所在行前插入一新行。
3.4 vi 基本编辑命令
在 vi 里,输入跟编辑是两码事。编辑是在命令模式下操作的,先利用命令移动光标来定位要进行编辑的地方,然后才下命令做编辑。
命令
说明
备注
cc 或S
修改一整行的文本
C
改变一行中光标所在位置之后的部分
Dd
删除光标所在的列
D
删除一行中光标所在位置之后的部分
dw
删除光标所在的单词
J
将下一行文本内容合并到本行行尾
R
修改光标所在字符,r 后接要修正的字符
R
修改本行内容
S
修改光标所在字符
U
恢复上一次所做的修改
X
删除光标所在字符
X
删除光标左侧字符
~
改变光标所在字符的大小写
.
重复上一次的操作
>
将当前行移到右边
P
将缓冲区的内容拷贝到光标所在行的下一行
P
将缓冲区的内容拷贝到光标所在行的上一行
“ad
将文本删除至缓冲区a
“ap
粘贴缓冲区a中的内容
yy或Y
将当前行存入缓冲区
Yw
将光标所在的单词存入缓冲区
0
移动到光标所在列的最前面
=[Home]
$
移动到光标所在列的最后面
=[End]
[CTRL+d]
向下半页
=[PageDown]
[CTRL+f]
向下一页
[CTRL+u]
向上半页
[CTRL+b]
向上一页
=[PageUp]
[CTRL+e]
下滚一行
[CTRL+y]
上滚一行
H
移动到屏幕的第一行
M
移动到屏幕的中间
L
移动到屏幕的最后一行
B
移动到上个小字的第一个字母
B
移动到上个大字的第一个字母
W
移动到下个小字的第一个字母
W
移动到下个大字的第一个字母
E
移动到下个小字的最后一个字母
E
移动到下个大字的最后一个字母
^
移动到光标所在列的第一个非空白字符
n-
减号移动到上一行的第一个非空白字符,前面加上数字可以指定移动到以上 n 行
n+
加号移动到下一行的第一个非空白字符,前面加上数字可以指定移动到以下 n 行
NG
直接用数字 n 加上 G 移动到第 n 行
Fx
往右移动到 x 字符上
Fx
往左移动到 x 字符上
Tx
往右移动到 x 字符前
Tx
往左移动到 x 字符前
;
配合 f&t 使用,重复一次
,
配合 f&t 使用,反方向重复一次
/string
往右移动到有 string 的地方
?string
往左移动到有 string 的地方
n
配合 /&? 使用,重复一次
N
配合 /&? 使用,反方向重复一次
%
移到匹配的”()”或”{}”上
n(
左括号移动到句子的最前面,前面加上数字可以指定往前移动 n 个句子
句子是以! . ? 三种符号来界定
n)
右括号移动到下个句子的最前面,前面加上数字可以指定往后移动 n 个句子
段落是以段落间的空白列界定
n{
左括弧移动到段落的最前面,前面加上数字可以指定往前移动 n 个段落
n}
右括弧移动到下个段落的最前面,前面加上数字可以指定往后移动 n 个段落
这些编辑命令非常有弹性,基本上可以说是由命令与范围所构成。例如 dw 是由删除指令d 与范围 w 所组成,代表删除一个字 d (elete) w (ord) 。命令列表如下:
d 删除(delete)
y 复制(yank)
p 放置(put)
c 修改(change)
范围可以是下列几个:
e 光标所在位置到该字的最后一个字母
w 光标所在位置到下个字的第一个字母
b 光标所在位置到上个字的第一个字母
$ 光标所在位置到该行的最后一个字母
0 光标所在位置到该行的第一个字母
) 光标所在位置到下个句子的第一个字母
( 光标所在位置到该句子的第一个字母
} 光标所在位置到该段落的最后一个字母
{ 光标所在位置到该段落的第一个字母
3.5 文件处理子命令
:q 结束编辑(quit)
如果不想存档而要放弃编辑过的档案则用 :q! 强制离开。
:w 存档(write)
其后可加所要存档的档名。 可以将档案命令合在一起,例如 :wq 即存档后离开。
zz 功能与 :wq 相同。
:n 开始编辑vi激活的文件列表中的下一个文件。
:n filename 指定被编辑的新的文件。
:e filename 在vi中编辑另一个文件filename。
:e # 开始编辑另一个文件。
:e ! 重新装入当前文件,如果当前文件有改动,则丢弃以前的改动。
:r filename 将文件filename合并至当前文件的文件尾。
另外值得一提的是 vi 的部份存档功能。可以用 :n,m w filename 将第 n 行到第 m 行 的文字存放的所指定的 filename 里去。
第五章 RS6000 更换硬盘的过程
HDISK0和HDISK1做成MIRROR,是ROOTVG
#mirrorvg rootvg hdisk0 hdisk1
先做系统备份
tctl –f /dev/rmt0 rewind
smitty mksysb
查看HDISK0的S/N,P/N号等,在换盘的时候做对照
lscfg –vl hdisk0
#lscfg -vl hdisk0
DEVICE
LOCATION
DESCRIPTION
hdisk0
11-08-00-2,0 16 Bit LVD SCSI Disk Drive
(36400
MB)
Manufacturer................IBM
Machine Type and Model......IC35L036UCDY10-0
FRU Number..................00P3831
ROS Level and ID............53323154
Serial Number...............E3V59K0B
EC Level....................H32224
Part Number.................08K0293
Device Specific.(Z0)........000003029F00013A
Device Specific.(Z1)........07N4972
Device Specific.(Z2)........0068
Device Specific.(Z3)........02305
Device Specific.(Z4)........0001
Device Specific.(Z5)........22
Device Specific.(Z6)........**********
查看物理卷
lspv
查看逻辑卷组
lsvg
查看在用的逻辑卷组
lsvg –o
# lsvg -o
orclvg
rootvg
#
查看所有硬盘(包括逻辑盘)的状态
# lsdev -Cc disk
hdisk0 Available 11-08-00-2,0 16 Bit LVD SCSI Disk Drive
hdisk1 Available 11-08-00-4,0 16 Bit LVD SCSI Disk Drive
#
查看7133磁盘柜硬盘状态
lsdev –Cc pdisk
停HACMP
smitty clstop
使用lsvg –o 命令会看不到一些(应用)VG(1号机会接管);使用 netstat –ir命令可以看到系统SVC地址会变成BOOT地址
把HDISK0从ROOTVG中不做MIRROW
unmirrorvg rootvg hdisk0
查看物理卷
lspv
这时HDISK0不在和HDISK1为MIRROR
把hdisk0从rootvg中去除
reducevg rootvg hdisk0
在HDISK1上创建boot image
bosboot –ad hdisk1
改变启动设备的顺序
bootlist –m normal hdisk1 cd0
删除HDISK0
rmdev –l disk0 –d
lspv
lscfg –vl hdisk0
以上2条命令不会显示HDISK0的相关信息
关机
shutdown –F
把2号机的外设机箱取出,更换硬盘。注意要标好各电缆的位置
开机
lspv
发现多出HDISK4,而我们需要的是HDISK0
删除HDISK4
rmdev –l hdisk4 –d
cfgmgr
lspv
发现多出HDISK0,HDISK4,可能是我前面删除HDISK0,没有做cfgmgr的原因
删除HDISK4,HDISK0
rmdev –l hdisk4 –d
rmdev –l hdisk0 –d
cfgmgr
lspv
好了,HDISK0出现了
把HDISK0加到ROOTVG中并做镜像
extendvg rootvg hdisk0
做MIRROR
mirrorvg –c 2 rootvg
查看PV
lspv
OK
在HDISK0,HDISK1上创建boot image
bosboot –ad hdisk0
bosboot –ad hdisk1
改变启动设备的顺序
bootlist –m normal hdisk0,hdisk1 cd0
重启动2号机
shutdown –Fr
关闭1号机的HACMP
Smitty clstop
重启动1号机
shutdown –Fr
启动1号机的HACMP
smitty clstart
启动2号机的HACMP
smitty clstart
一切OK
注意
可观察CLUSTER的启动:/usr/es/adm/cluster.log, /tmp/hacmp.out
CLUSTER的版本 lslpp –l|grep cluster
网络的状态 netstat -ni
准备工作
(1) HACMP相应安装CD。
(2) AIX安装CD。
(3) RM0X补丁CD或最新download的补丁。
(4) SSA Adapter和Disk的微码。
www.hursley.ibm.com/ssa/rs6k/
(5) IP地址。
(6) VG、LV、FS用于HA的配置计划。
(7) 了解跑什么应用,Start/Stop Script应该怎么写。
. 确认7133阵列、8port卡和心跳线已连好,机器启动完毕
. 检查每台机器上是否都找到了所有硬盘
lspv
lsdev –Cc disk
如果某台机器没有找到共享硬盘,可用cfgmgr命令。
cfgmgr
. 给系统添加TTY
如果安装了8port卡,一共应该有sa0 ~ sa4共5个tty,依次(0 ~ 4)安装。
smitty tty à Add a TTY à rs232 à saX à Port Number: 0
NOTES:
1. 如果使用串行口连心跳线,只能用sa3(即串口4)。
2. 串口4一般位于4个串口的右下一个。
检测连8port卡的TTY
在两台机器上同时运行:
stty
这时应该有信息显示。
. 安装Bundle: App_Dev; Client, Server
smitty easy_install
使用AIX安装CD安装文件
smitty installp à Line 1
选择: bos.dosutility
bos.data
X11.vsm* (只在装HA时选择了vsm包时需要)
. 安装Base Document
smitty installp à Line 1
选择: bos*; perfagent*
安装系统补丁
使用AIX UPDATE CD
选择: bos.adt*
修改.profile和.dtprofile文件
修改:
.dtprofile:
DTSOURCEPROFILE=true
.profile: export
PS1=’[’`hostname`’:$PWD]’
修改电源管理
lscfg –vpl pmc0
应该有显示。
smitty pm à Line 2 à Line 2 (Unconfig)
Netscape安装和配置
确认Netscape已安装。
确认docsearch可以运行。
这是基于Netscape的AIX帮助系统。
建立/.netscape文件系统,大小约为10M。
安装HACMP/ES软件
放入HACMP/ES光盘:
smitty installp à Line 1
选择: cluster.adt.es
cluster.doc.en_US
cluster.doc.en_US.es
cluster.es
cluster.es.clvm
(for HACMP/ES CRM)
cluster.es.cspoc
cluster.es.hc
(for HACMP/ES CRM)
cluster.es.taskguides
cluster.man.en_US.es
cluster.msg.En_US.cspoc
cluster.msg.En_US.es
cluster.msg.en_US.cspoc
cluster.msg.en_US.es
(有关es的全部)
安装最新的AIX和HACMP补丁
创建一个临时文件系统,将文件上载到机器上:
smitty update_all
(次命令将只升级当前系统中存在的软件包)
SSA微码升级
使用以下命令可以看到一些设备的微码状态:
lscfg –vl | grep
ssa0
看SSA卡微码(ROS要升到A400才可以)
lscfg –vp | grep –p
ROM
看系统微码
将下载的微码解压到硬盘:
tar –xvf XXX
运行smitty installp安装相应文件包。
运行cfgmgr –v让系统重新识别,自动完成SSA Adapter升级。
使用diag命令履行硬盘微码升级。
设置主机名
smitty hostname à Line 1
同时修改/etc/hosts文件(在两台机器上分别改):
127.0.0.1 loopback
localhost jmnx1
为所有网卡绑定boot或standby的IP地址
smitty mktcpip à 选网卡en1à 设置hostname和IP;Start Now = Yes
注意service地址不在此时设置。
NOTES:
1. 这里hostname不是刚才设置的hostname。boot和standby网卡要对应不同hostname。以下是一个范例(典型的一组HA)。
IP
hostname
1.1.1.1
jmnx1_svc
1.1.1.2
jmnx1_boot
1.1.2.1
jmnx1_stby
1.1.1.3
jmnx2_svc
1.1.1.4
jmnx2_boot
1.1.2.2
jmnx2_stby
2. 以上这些内容都要写入两台机器的/etc/hosts文件。
注意这个文件很容易被系统自动改动,安装配置HA时必须经常检查。
3. 检查/.rhosts,这个文件应记录上述所有hostname。
4. 分辨网卡位置:
内置网卡标号enX最大;
外置网卡标号从机箱背后看由左到右依次增大。
5. 如果要修改IP设置,可使用:
rmdev –dl enX 删掉网卡
smitty inet à Add a Network Interface
à Add a Standard Ethernet Interface
à 选entX,重新设置。Current State改为Up
6. 开机未启HA时,boot地址生效;
启动HA后,service地址生效;
service地址对应网卡失效后,由standby地址接管。
7. IP地址设置规则:
service和boot在同一网段;
standby必须与上面两者在不同网段;
创建VG、LV和FS
这些工作只需在一台机器上做,在另一台机器上必须先删去所有pdisk。
rmdev –dl hdiskX
注意先用lsdev –Cc disk看一下,不要把内置硬盘也删掉。
创建RAID。
注意要Enable Fast Read/Write
创建VG。
smitty mkvg à
Activate VG automatically at system
restart: No
Create VG Concurrent
Capable:
Yes/No (是/否concurrent)
Auto-varyon in Concurrent
Mode:
No
smitty chvg à
QUORUM
Yes/No
创建LV和FS(FS不要Auto Mount)。
在一台机器上varyonvg再varyoffvg所有共享或接管VG。
在另一台机器上importvg。
importvg –y VGName
hdiskX
(hdiskX为该VG中任何一个盘)
smitty
chvg
修改VG为Not Auto-varyon
varyonvg VGName
varyoffvg VGName
NOTE:
1. HA未启动时,一旦由一台机器改变了共享或接管VG的结构(LV、FS级),则另一台机器一定要exportvg该VG后再次importvg才能使用。
2. 如果共享或接管VG不止一个,则:
smitty mkvg时要指定Major Number;
importvg时对同一VG要指定与上面相同的Major Number: importvg -V MajorNum ...
修改系统参数
Extend the size of file system "/var" to 200M.
Change characteristics of aio
smitty chgaio
MINIMUM number of
servers
[20]
MAXIMUM number of
servers
[40]
STATE to be configured at system
restart
available
State of fast
path
enable
Change characteristics of Operating System
smitty chgsys
Maximum number of PROCESSES allowed per user
[512/1024]
HIGH water mark for pending write I/Os per
file
[33]
LOW water mark for pending write I/Os per
file
[24]
Change syncd frequency
smitty cm_tuning_parms
syncd frequency (in
seconds)
[10]
Change number of licensed users
smitty chlicense
Maximum number of FIXED
licenses
[512]
Enable Fast-Write for SSA
smitty ssadlog
重启两台机器
shutdown -Fr
配置HACMP
smitty hacmp
(1) Add Cluster
Cluster ID: 1
Cluster Name: XXX
(2) Add Node
Node Name: jmnx1 jmnx2
注意应该是第14点中对应的hostname。
(3) Add Adapter (IP)
给所有在/etc/hosts中定义过的svc/boot/stby添加一个IP Adapter。
service adapter在boot/standby之后定义,不然会修改/etc/hosts。
IP Label: See /etc/hosts
N/W Type: ether
N/W Attribute: public
Adapter Function: service/standby/boot
Adapter Identifier: 即相应IP地址
即netstat –in显示中相应网卡的Address一栏,但最后两位必须不同。
如系统显示:0.6.29.6c.13.9a,可以填:0.6.29.6c.13.11
注意以上两项只需一个,且只有service adapter需用H/W Address。
Node Name: jmnx1或jmnx2等
注意rotating方式中定义service adapter时,此项应该空着,表示这个service IP label为两台机器共享。
(4) Add Adapter (TTY)
e.g.:
tty_a; rs232(网络类型); rs232_net(自定网络名); serial; service; /dev/tty3; (空); jmnx1
(5) Sync Topology
(6) Add Resource Group
RG Name: XXX(应用服务名)
Node Relationship: cascading/concurrent/rotating
Participate Nodes: Jmnx1 Jmnx2
注意书写先后表示优先级,即初始该RG为哪个Node所有。
(7) Add Application Server
Server Name: XXX
Start Script: /tmp/...(自定)
Stop Script: /tmp/...(自定)
Edit executable files: “startapp” & “stopapp” to certain directory and copy to the same position of the other machine.
注意script中的banner语句并不一定能在hacmp.out中有输出,为了验证其确实已被运行,可以在其中加上诸如date > file等的写文件语句。
(9) Sync RG
NOTES:
1. HA启动后,除非共享或接管VG有disk一级的变动(增加/减少硬盘),一般不需要手动去同步两边VG。
2. 当Topology有了修改之后,不但要Sync Topology,还要Sync RG。
3. 双机单组HA中三种方式的比较:
TYPE
SERVICE IP ADAPTER
NUM.
SERVICE IP LABEL
rotating
1
1
cascading
2
2 and 1 is required for each RG
concurrent
2
not required
故在定义concurrent RG时,不要填IP label。rotating中只有一个共享svc IP,就填这一个即可。
4. 配置内容示例:
Configure HACMP for Rotating Resource Group
Define Cluster Topology
Define 1 cluster, 2 nodes, 2 boot
adapter, 1 IP service adapter, 2 standby adapter, 2 serial service
adapter.
Synchronize the cluster topology.
Define Resources
Define 1 rotating resource group with 2 participating nodes.
Define 1 application server and write corresponding start and stop scripts.
Configuring Resource for Resource Group
Add Service IP Label, Filesystems, Volume Groups, Application Servers into Resource Group.
Synchronize cluster resource.
Configure HACMP for Concurrent Resource Group
Define Cluster Topology
Define 1 cluster, 2 nodes, 2 boot
adapter, 2 service IP adapter, 2 standby adapter, 2 serial service
adapter.
Synchronize the cluster topology.
Define Resources
Define 1 concurrent resource group and 2 cascading resource group.
Define 2 application server and write corresponding start and stop scripts.
Configuring Resource for Resource Group
Add concurrent shared VGs to concurrent resource group.
Separately add 2 service IP adapter, 2 application server to 2 cascading resource group.
HA测试(一): 启动和关闭
在Concurrent中确保VG在两边都被varyoff
smitty
clstart
启动HA
tail –f /tmp/hacmp.out 看启动输出信息
tail –f /tmp/cm.log
看错误信息
netstat –i 和
–in
看IP地址是否变为service地址
lsvg
–o
Concurrent中看VG是否在两台机器上被varyon
lssrc –g
cluster
看相应SRC是否起来(应该显示2或3个SRC)
smitty
clstop
关闭HA
à graceful(正常)/takeover(接管)/force(强制,IP不变回boot)
这里就选graceful
tail –f /tmp/hacmp.out 看关闭输出信息
tail –f /tmp/cm.log
看错误信息
netstat –i 和
–in
看IP地址是否变为boot地址
lssrc –g
cluster
看相应SRC是否已关闭(应该无SRC显示)
使用Cluster Snapshot可以保存当前Cluster配置,以后直接Apply就可恢复。
HA测试(二):本机IP接管
确定两台机器HA已正常启动。
拔去与主机service IP关联的网卡的网线。
在主机上运行:
netstat –i 和 –in
这时standby网卡将接管service IP而原service网卡将对应standby IP。
备机不发生任何反应。
插回主机上拔去的网线并运行:
netstat –i 和 –in
这时主机没有任何复原动作,原standby网卡仍对应service IP而原service网
卡仍对应standby IP,即便关闭HA也不会变回来。
en0
en1
启动HA前对应IP
boot
stdby
启动HA后对应IP
svc
stdby
拔去en0网线后对应IP
stdby
svc
关闭HA后对应IP
stdby
boot
要使网卡恢复最初的对应IP,可以运行:
smitty mktcpip
选定网卡(en0, en1, ... ),不作任何改动回车。
HA测试(三):资源接管
确定两台机器HA已正常启动。
模拟主机异常终止运行:
方法一:主机上运行:
smitty clstopà 关闭方式选takeover
这种测试是主动告诉对方需要接管,并不是真正模拟了故障,可以
在进行真正故障模拟之前先进行这一步测试。
方法二:主机上运行halt –q即时关机(最佳方法)。
方法三:同时拔去主机所有网线和心跳线。
方法四:主机拔电(不建议)。
在备机上运行:
netstat –i 和 –in
如果备机也有service网卡(在cascading,即mutual takeover配置下),这时备机
的standby网卡将接管主机的service IP;
如果备机没有service网卡(在rotating,即standby配置下),这时备机的boot网
卡将接管主机的service IP。
当备机有svc地址:
备机en0
备机en1
启动HA前对应IP
备机boot
备机stdby
启动HA后对应IP
备机svc
备机stdby
发生接管后对应IP
备机svc
主机svc
当备机无svc地址:
备机en0
备机en1
启动HA前对应IP
备机boot
备机stdby
启动HA后对应IP
备机boot
备机stdby
发生接管后对应IP
主机svc
备机stdby
在备机上运行:
lsvg –o
在resource group中定义的VG应该在备机上自动varyon。
在备机上运行:
mount
在resource group中定义的FS应该在备机上自动mount。
NOTES:
1. 运行smitty clstop后有3种停止方式可供选择:
graceful 本机正常退出HA环境,恢复boot地址。不发生接管。
takeover 本机正常退出HA环境,恢复boot地址。发生接管,备机获得主机svc IP。
force 本机强制退出HA环境,不恢复boot地址。不发生接管。
当用graceful方式无法完全退出HA环境时(即lssrc –g cluster仍能看到显示,并
且svc IP没有变回boot IP),可以用force退出。
force退出以后lssrc –g cluster不会看到显示,但svc IP也不会变回boot IP,必须
手工运行一次smitty mktcpip(不改任何选项)。
2. 如果将一台机器的两根网线都拔掉,则备机并不会接管该机器的svc IP。
因为备机仍可以通过心跳线监测到主机存活。而对于网络来说,HA只防备单点故障,如果主机上两个网络都断了,它没有响应的能力。
如果要模拟接管,则必须将心跳线也拔掉。
- 怎样在AIX 5.1中建立热后备(hot spare)磁盘?
环境 AIX 5.1
问题 怎样在AIX 5.1中建立热后备(hot spare)磁盘?
解答 在AIX 5.1中可以在操作系统的级别上建立hot spare磁盘。
如需要在某一卷组(VG)中建立hot spare磁盘,必须满足如下条件:
1. 逻辑卷(LV)在此卷组中必须进行镜像(mirror)。
2. 作为hot spare的磁盘上不能有任何的逻辑卷或文件系统。
3. hot spare盘的容量应大于或等于此卷组中最大磁盘的容量。
当满足以上条件后,可采用以下步骤(此处假设卷组名为testvg,
磁盘为hdisk6):
1. # exptendvg testvg hdisk6
将hdisk6加入卷组testvg。
2. # chpv -hy hdisk6
将hdisk6标记为hot spare磁盘。
3. #chvg -hy -sy testvg
将testvg标记为使用hot spare盘的卷组,并且当发生磁盘失效
时自动进行磁盘的替换并同步。
如何查看某用户共启动了多少进程?
环境 产品: AIX
平台: RS
软件版本: AIX V4
问题 用户需要查看某个用户是否启动了过多的进程,影响了系统性能
解答 请用
#ps -ef|grep username|wc -l
备注:
这是利用wc -l统计行数的功能来对用户进程数的一个估计,并不是非常准确的值。
但完全可用于参考。
如何在清理/tmp文件系统时找到过大的文件?
环境 产品: AIX
平台: RS
软件版本: AIX V4
问题 /tmp文件系统已满,如何找到哪些文件过大,并释放空间。
解答 请用
For Example, 哪些文件大于5M字节.
#cd /tmp
#find . -size +10000 -exec ls -l {} \;
备注:
删除这些过大文件时,请确认其无用
如何在图形登录和命令行登录方式间切换?
环境 产品: AIX
平台: RS
软件版本: AIX V4
问题 用户需要在 CDE 的两种登录方式中切换。
解答 请用
#/usr/dt/bin/dtconfig -e 激活图形登录方式
#/usr/dt/bin/dtconfig -d 激活命令行登录方式
2)使用命令
lslpp -l bos.adt.lib
检查该文件集是否存在,否则需要安装。
在AIX中扩展卡的逻辑名和它所在插槽的对应关系
环境 产品, Pseries, RS6000
软件版本, AIX
问题 在IBM的Pseries 服务器中,相同类型的扩展卡可以插多块,但是AIX如何确定每一块卡所在的插槽?
解答 可用以下步骤来确定它们的关系:
1. 检查相同类型的卡的逻辑名及个数.
例如确定服务器中以太网卡的名称:
# lsdev -Cc adapter |grep en
ent0 Available 1A-08 IBM 10/100 Mbps Ethernet PCI Adapter (23100020)
ent1 Available 21-08 IBM 10/100 Mbps Ethernet PCI Adapter (23100020)
2. 通过查看Device Specific. 的值,确定其所对应的插槽.
如:
# lscfg -vl ent0 DEVICE
LOCATION
DESCRIPTION
ent0
1A-08
IBM 10/100 Mbps
Ethernet PCI
Adapter
(23100020) Serial
Number...............22010344
FRU
Number..................091H0397
Part
Number.................091H0397
Network
Address.............000629DC698C
Displayable Message.........PCI
Ethernet Adapter (23100020)
Device
Specific.(YL)........P1-I3/E1
I3 表示此网卡插在第三槽上.# lscfg -vl
ent1
DEVICE
LOCATION
DESCRIPTION
ent1
10-80
IBM 10/100 Mbps Ethernet PCI
Adapter
(23100020) Network
Address.............0004ACE4AF6D
Displayable Message.........PCI
Ethernet Adapter (23100020)
Device Specific.(YL)........P2/E1
是集成在主板上的网卡.
使用命令ifconfig 即可.其语法为:
ifconfig network_interface second_ip_address netmask your_netmask alias
在ODM中未记录此定义,所以关机后该定义会丢失,若需要的话,可将该命令加在启动文件(/etc/rc.net)中.
如第二个IP地址是 9.185.43.135 可用
# ifconfig en0 9.185.43.135 netmask 255.255.255.0 alias
当该IP地址不再需要时,可从系统中删除.
#ifconfig en0 9.185.43.135 netmask 255.255.255.0 delete
或从/etc/rc.net文件中删除。
如何为调试应用程序性能 定制系统内存环境
环境 产品: AIX
平台: RS
软件版本: AIX V4
问题 用户需要为调试应用程序在不同的内存配置下的性能。
解答 操作系统提供了这样的应用来满足客户的需求。
rmss -c memsize (设置需要调试的内存)
rmss -p 显示当前的内存配置
rmss -r 重新恢复至系统的实际内存大小
举例:
#rmss -p
Simulated memory size is 512 Mb.
#rmss -c 128
Simulated memory size changed to 128 Mb.
#svmon -G
size inuse free pin virtual stolen
memory 131061 121681 9380 9417 31604 95584
pg space 264192 17306
其中stolen的内存就是512Mb和128Mb的差。
当在128Mb内存下调试完程序后,恢复系统实际内存大小。
#rmss -r
#svmon -G
size inuse free pin virtual
memory 131061 26245 104816 9417 31604
pg space 264192 17306
free的内存已经恢复如初。
如何在AIX上实现象doskey一样的功能
环境 产品: AIX
平台: RS
软件版本: AIX V4
问题 客户需要实现类似doskey一样的功能
解答 在AIX操作系统中可以利用 set -o vi来实现类似功能。
当用户想重复上一个很长的命令时,只需按ESC+k就行,再按k就上滚一条命令,
而按j就可以后滚一条命令,然后回车就可以完成了。更好的是,你可以利用类似
使用vi的方法来编辑你所看到的命令,来达到随意调整的目的。
只一条简单的命令,就节约了宝贵的时间。需要时可以把set -o vi加入到.profile中
清除一个中断的安装和删除所有没有完成的安装
# installp –C
4、committing applied updates 命令: # installp –cgx all 或者是 smitty install_commit
这个命令将commit所有的updates同时删除以前版本的filesets
5、Rejecting applied updates 命令 # installp –rBfX ./reject.list或是smitty install_reject
该命令将删除所有uncommitted updates listed in ./reject.list 同时将系统带回到以前的maintenance level
6、删除一个安装的软件 # installp –ugp –V2 bos.net.ipsec.rte 运行该命令将显示一个将要删除的文件的列表,但并不真正删除它 或是 # smitty install_remove
7、列示在媒质上的所有的软件
# installp –L –d /dev/cd0
8、使用smitty安装软件 # smitty install_latest
注意: 在安装结束后,无论命令的状态报告是成功的还是失败的,都应该看看 $HOME/smit.log文件,因为你想安装的fileset系统可能并没有安装
1、
ftp://service.software.ibm.com
2、通过fixdist的工具 访问:
http://service.software.ibm.com
通过fixdist 下载的软件BFF的格式的,是用backup命令创建的,如*.bff,可以用restore命令来读。
如果你经常应用升级并将所有的升级软件放在相同的目录中,.toc文件可能会过期,installp命令使用.toc文件来执行安装,为了当你执行安装的时候使正确并最新的软件安装,推荐重构.toc文件,命令如下:
# inutoc ; 还有一个 inutoc /usr/sys/inst.images/.toc
该命令在运行installp的时候自动调用
你可以使用fixdist工具下载个别的fix,为了决定一个fix是否安装在系统上或为了安装一个fix,使用instfix命令( 和fix有关)
instfix命令允许你安装一个fix或set of fixes without knowing any information 除了APAR号或唯一的关键字来标示这个fix
例一:为了列示在一个CD-ROM中的fixes
# instfix –T –d /dev/cd0
例二:为了决定是否APAR IX75893安装到系统
# instfix –ik IX75893
例三:To examine information about APAR IX75893 and what it does
# instfix –aik IX75893
例四:To list what maintenance levels have been installed on your system with the instfix command
# instfix –i | grep ML
例五:为了从/dev/cd0安装APAR IX75893
# instfix –k IX75893 –d /dev/cd0
例六:To view the new maintenance level of your software
# lslpp –l 主要还是显示 fix level
this will show you the latest maintenance level of the filesets including those you just updated
为了创建installation images on your hard disk
# smitty bffcreate
为了克隆rootvg到一个新的磁盘 # smitty alt_clone
条件: The target disk should be a stand-alone disk not belonging to a VG,同时,SSA disks cannote be used as your target disks
第五部分:存储管理和文件系统
VGDA:
The VGDA, located at the beginning of
each physical volume,contain informatino that describes all the logical
volumes and all the physical volumes that belong to the volume group of
which that physical volume is a memober
The VGDA is allocated when the disk is assigned as a physical
volume,When the PV is assigned to a VG ,The actual VG informationg is
placed in the VGDA
VGSA:
The VGSA contains state information about PP and PV
LVCB:
The LVCB is located at the start of every LV , It contains information about the LV and users a few hundred bytes
Disk Quorum:
Each Physical disk in a VG has at least one VGDA/VGSA,
single PV in a VG: two VGDAs on one disk
two PV in a VG: two VGDAs on the first disk, one VGDA on the second disk
Three or more : one VGDA on each disk
Disk Mirroring :
disk mirroring is the association of two or three PP with each LP in a LV,在LV创建的时候就可以做Mirroring 。
mklv 命令允许你选择 one or two additional copied for each LV,Mirror也可以加在一个已经存在的LV,通过使用mklvcopy命令
mirrorvg命令镜像在一个给定VG中的所有的LV,相同的功能可以被完成通过mklvcopy命令,如果在一个VG中运行mklvcopy命令for 每一个单独的LV,注意此处就是目标磁盘必须和源磁盘等等在同一个VG中
例一:# mirrorvg -c 3 workvg 三重镜像一个卷组
例二:# mirrorvg workvg 以默认的方式镜像卷组
为了删除一个卷组中已经损坏的磁盘:
# unmirrorvg workvg hdisk7
# reducevg work hdisk7
# remdev -l hdisk7 -d
删除后添加一个新的磁盘(以同样的名称)
# extendvg workvg hdisk7
# mirrorvg workvg
同步新建的镜像
# mirrorvg -S -c 3 workvg
注意:在这个例子中,mirrorvg 将创建两个copy for the LV in workvg,他将创建新的镜像在新替换的磁盘上,但如果原来的系统被三重的镜像的话,将没有新的镜像创建在hdisk7上,因为其他的copy已经存在
为了创建一个卷组精确的映射
# mirrorvg -m datavg hdisk2 hdisk3
当rootvg mirroring完成后,下列的任务必须做:
一、运行bosboot命令 ( 从RAM磁盘文件系统和内核创建一个boot image )
二、运行bootlist命令
三、reboot system( 默认情况下,mirrorvg命令使quorum to be turned off, 为了 turn on the quorum on a rootVG,系统必须重启)
注意: 不要reboot 系统当 bosboot命令没有成功创建一个boot disk的时候
非rootvg的 mirroring:
当一个非rootvg的卷组被镜像时,the quorum state is
deactivated,为了解决这个问题,all open LV must be closed, 然后vary off and vary on
the VG for the changes to take effect
The dump device can be queried and modified with the sysdumpdev command
有三种方法用来配置一个新的disk ,如果你的LVM想用这磁盘的话,同时还必须做成一个PV
方法一:shutdown 然后Power on
# lspv 的输出结果中如果对应的hdiskx有PVID,说明该hdisk已经是PV了,可以被LVM使用,但如果没有PVID的话,就要使该disk成为PV
方法二:手工运行cfgmgr
一个新的磁盘只有被分配给一个VG才可以使用,必须作为一个PV才可以被LVM使用
相应命令: chdev -l hdisk1 -a pv=yes
The following command is used to turn off the allocation permission for the PV hdisk1
# chpv -a n hdisk1
To turn the allocation permission back on .use the following command
# chpv -a y hdisk1
当一个PV由于损坏要被从该系统删除时,该PV should be made unavailable :
# chpv -v r pvname
The following command will make a PV available to the system
# chpv -v a pvname
注意:当运行chpv命令失败了的时候,检查/tmp的空间
A PV must be unconfigured before it can be removed from the
system,The following example shows how to unconfigure a PV and change
its state from available to defined
# rmdev -l hdisk1
该PV的定义仍然保留在ODM中,使用 -d 将 remove the definition from the ODM
List PV on the system # lspv
List PV on the system along with the status of each PV # lspv -C -c disk
List PV characteristic # lspv hdisk1
List all the LV on the PV # lspv -l hdisk1
List PP allocation by PV region # lspv -p hdisk1
List PP allocation table # lspv -M hdisk1
下列的过程描述了如何从一个failing disk移出数据 before it is removed for repair or replacement
1、首先确定source and destinatino PV are in the same VG
# lsvg -p rootvg
2、a、make sure the disk is available
# lsdev -Cc disk
b、if the disk is listed and in the available state , make sure it does not belong to another VG
# lspv
c、if the disk is not listed or is not available,you need to check or install the disk
d、add the new disk to the Vg
# extendvg VGNAME hdisknumber
3、确定目标磁盘有足够的空间可以容纳源盘的内容
4、如果准备移动的数据所在的磁盘属于rootvg:
a、检查是否 boot logical volume(BLV)也就是hd5在 sourec disk中
# lspv -l sourcedisknumber | grep hd5
如果在的话: # migratepv -l hd5 SourceDiskNumber DestinationDiskNumber
注意: migratepv命令cannot migrate striped LV ,if htis is the case , to move
data from one PV to another,use the cplv命令 to copy the data,and then
use the rmlv command to remove the old copy
migratepv command is not allowed if the VG is varied on in a concurrent mode
b、在目标磁盘上执行bosboot命令
当BLV is migrated from a PV ,the boot record on the source should be
cleared ,Failure to clear this record may result in a system hang
c、在源磁盘上执行bosboot -c命令 to clear the boot record on the source
# bosboot -a -d /dev/DestinationDiskNumber
# bootlist -m normal DestinationDiskNumber
# mkboot -c -d /dev/SourceDiskNumber
5、如果你要移动的数据所在的磁盘属于用户定义的卷组
# smitty migratepv
To remove source disk from the Vg ,such as when it is failing
# reducevg VGNAME SourceDiskNumber
在物理的卸掉Source disk之前,运行
# rmdev -l SourceDiskNumber -d
创建一个新的VG ,# mkvg 或 # smitty mkvg
当使用mkvg创建VG的时候,root filesystem 至少需要2MB的Free space才能够保证VG成功创建
To make a VG to be varied on automatically each time a system is restarted
# chvg -ay newvg
Turn off the automatic varying on of the VG at system restart
# chvg -an newvg
Unlock a Vg
# chvg -u newvg
Add the PV hdisk3 to Vg newvg
# extendvg newvg hdisk3
The Vg must be varied on before it can be reduced
# reducevg myvg hdisk3
Remove a PV reference
# reducevg VG PVID
To
remove the system definition of a VG from the ODM database,the VG need
to be exported using the exportvg command,This command will not remove
any user data in the VG ,but will only remove its definition from the
ODM database
# exportvg myvg
# importvg –y myvg hdisk12
你也可以使用exportvg 和importvg来给一个用户定义的卷组改名
# varyoffvg vg00
# exportvg vg00 (导出前要先varrry off)
# importvg –y cadsvg hdisk1
A VG that has a paging space volume on it cannot be exported while the paging space is active
在导出一个包含活动的paging space的卷组的时候,首先:
# chps –a n paging_space_name
然后重起系统,从而该paging space处于inactive的状态
if
you don’t activate the VG that contains file systems, or if you
activated the VG through smitty importvg,It is highly recommended that
you run the fsck command before you mount the file systems, if you are
moving the VG to another system,be sure to unconfigure the disks before
moving them
The smitty exportvg command deletes references to file system in /etc/filesystems,but it leaves the mount points on the system
激活一个卷组:
# varyonvg newvg
Deactivate a Vg (The varyoffvg
command will deactivate a VG and its associated LV,This requires that
the LV be closed ,which requires that file systems associated with LV
be unmounted,)
# varyoffvg myvg
List all the Vg known to the system
# lsvg
List the Vg that are currently active
# lsvg –o
List the characteristics of a VG
# lsvg rootvg
List the LV in a VG
# lsvg –l rootvg
List the PV status within a VG
# lsvg –p rootvg
使用reorgvg命令的两个必要的条件:
1、VG must be varied on
2、Must have free partitions
The
relocatable flag of each LV must be set to y using the chlv –r command
for the reorganization to take effect,otherwise, the LV is ignored
注意:对于LV的relocatable必须用chlv -r设置成 y ,reorgvg命令对含条带集的逻辑卷无效,同时在该卷组中至少包含一个自由的物理分区
To synchronize the copies on PV hdisk04 and hdisk05
# syncvg –p hdisk04 hdisk05
To synchronize the copies on VG vg04 and vg05
# syncvg –v vg04 vg05
# mklv newlv 创建逻辑卷
# rmlv newlv 删除逻辑卷
# extendlv newlv 3 扩展该逻辑卷的逻辑分区(增加了3个LP)
使用cplv命令来拷贝一个逻辑卷到另外的新的磁盘或已经存在的逻辑卷
# cplv –v myvg –y newlv oldlv 该命令将拷贝oldlv的内容到一个新的逻辑卷newlv ,如果卷组没有指定的话,该命令将在相同的卷组中创建一个新的逻辑卷
拷贝一个逻辑卷的内容到一个已经存在的逻辑卷(existinglv卷组中的数据将被覆盖)
# cplv –e existinglv oldlv
如果卷组is varied on in concurrent mode的话,使用cplv命令来创建一个新的LV将失败
# splitlvcopy –y newlv oldlv 2 (以前的oldlv的一个LP对应三个PP)
该命令执行后:
oldlv的一个LP对应两个PP
newlv的一个LP对应一个PP
Before splitting LV ,You must unmount file system and close the LV
下列的LV在系统安装的时候自动创建
hd5 :This is boot logical volume that holds the boot code, it is available only at system startup time
hd6: This is the default paging space logical volume that is used by the system to perform paging.
hd8 : This LV is used as the default logging space for the JFS,一个分区,4MB
hd2 : This LV is used by the /usr file system
hd4 : This LV is used by the / root file system
hd9var : This LV is used bye the /var file system
hd3: This LV is used by the /tmp file system
hd1 : This LV is used by the /home file system
# lslv newlv
每一个文件系统都对应一个LV
创建一个文件系统
# smitty crjfs
在加载文件系统的时候一个常规的错误是无法使用pwd命令,通过设置加在点目录的权限至少为111可以解决这个问题
有两种类型的automatic mounting
第
一种:Those mounts that are required to boot and run the system,These file
systems are explicitly mounted by the boot process. The stanzas of such
file systems in the /etc/filesystems file have mount=automatic,
注意:
如果在/etc/filesystems文件中有定义且mount=automatic,则这些文件系统将不受mount all 和umount all 命令的影响
类型二:
The second type of automatic mount is user-controller,These file
systems are mounted during initialization by the /etc/rc script when it
issues the mount all command, The stanzas of user-controller automatic
mounts contain mount=true in /etc/filesystem
显示当前所有加载的文件系统
# mount
如果想删除一个文件系统,首先要umount it
# umount filesystem_name
然后 # rmfs –r filesystem_name或使用 # smitty rmjfs
使用df命令显示当前文件系统的大小
使用mksysb去减小一个文件系统的大小
在通过mksysb来恢复rootvg卷组的过程中,一个选项就是 shrink在磁盘上安装的文件系统,当选中这个选项时,在该卷组的LV和FS将按照容纳数据的最小尺寸来重新创建LV和FS
用户定义的卷组也可以通过 # restvg –s 来调用这个shrink的选项。
在加载文件系统之前运行fsck,同时必须能够读the device file on which the file system reside
The logform command initializes a LV for use as a JFS log device
运
行该命令在一个文件系统上将完全破坏该文件系统上的数据,if a log device is open due to its use by a
mounted file system, the file system should be unmounted prior to
running logform against the log device
Troubleshooting file system problems
1、Recovering from super block errors
If you receive one of the following errors from the fsck or mount commands,The problem may be a corrupted superblock
This problem can be resolved by restoring the backup of the superblock
over the primary superblock using one of the following commands
dd count=1 bs=4k skip=31 seek=1 if=/dev/lv00 of=/dev/lv00
The follow command works only for Aix version 4
fsck –p /dev/lv00
当恢复的进程结束后,使用 fsck /dev/lv00,在一般情况下,restoration of the backup of
the superblock to the primary superblock will recover the file system
,if this does not resolve the problem, recreate the file system and
restore the data from a backup
2、Cannot unmount file systems
情形一:、file are open within a file system
The fuser command is often the best way to determine what is still active in the file system,
# fuser –xc /tmp
情形二:A kernel extension that is loaded but exist within the source file system,此时fuser命令将无法显示kernel extension,通过genkex命令则可以显示
情形三:在该文件系统中仍然由文件系统处于加载的状态
情形四:一个进程正在使用该文件系统中的一个目录作为它当前的工作目录
第六部分: Paging space
Paging space 的大小在AIX安装系统定制的时候,要根据下列标准:
1、
Paging space can use no less than 16MB,except for hd6,In AIX version
4.2.1,hd6 can use no less than 32 MB ,and in AIX Version 4.3 and
later,no less than 64MB
2、Pagin space使用的空间不能超过总磁盘空间的20%
3、如果真实的物理内存小于256MB的话, Paging space is tow times real memory
4、if real memory is greater than or equal to 256MB, Paging space is 512MB
或者使用公式:Total paging space=512+(memory size-256)*1.25
理想情况下,There should be serveral paging spaces of roughly equal size each on a different physical volume
可以利用vmstat和topas这两个命令来获得Paging space的状态
# lsps -a 提供 a snapshot of the current utilization of each of the paging spaces on a system
# lsps -s 提供 a summary of the total active paging space and its current utilization
注意:避免增加paging space到一个便携式的硬盘上
Remove a disk that is online with
an active paging space will require a reboot to deactivate the paging
space and , therefore ,cause user disruption.
注意: In version prior to AiX 5L version 5.1,A VG that has a paging
space volume on it cannot be varied off or exported while the paging
space is active,Before deactivating a VG having an active paging space
volume,ensure that the paging space is not activated automatically at
system initialization and then reboot the system.
管理paging sapce的相关命令:
chps : change the attributes of a paging space
lsps: Display the characteristics of a paging space
mkps: creates an additional paging space
rmps: remove an inactive paging space
swapon: Activates a paging space
swapoff : Deactivates one or more paging space
考点: Active paging space cannot be removed .To remove an active paging space ,it must first be made inactive
在AIX
version to AIX version4.3 ,使用chps命令 so the paging sapce is not used on
the next system restart,Then restart the system,此时,The paging space is
inactive and can be removed using the rmps cmmand, IN Aix version 5.1
,使用swapoff命令去动态deactivate the paging space,Then use the rmps command
# swapon -a
Deactivate a paging space
AIX 5.1 deactivate a paging space and to decrease the size of a paging space without having to reboot
# swapoff DeviceName or # smitty swapoff
在AIX 4.3中:
# smitty chps ---->;>;reboot ----->;>; lsps -a
Decreasing the size of a paging space
AIX 5.1
# chps -d 2 paging03 不需要deactivate ,不需要reboot,
AIX4.3中
# 要deactivate it--->;>; reboot ---->;>; remove it --->;>; recreate it
如果要删除一个paging space
注意: remove default paging space incorrectly can prevent the system
from restarting,You must deactivate the paging space before you can
remove it , which require a reboot
check the primary dump device you are using by executing the command
# sysdumpdev -l
you cannot remove the default dump
device,you must change the default dump device to another paging space
or LV before removing the paging space
删除一个paging space ( except hd6 )
deactivate it--->;>; reboot ---->;>; remove it
如果在AIX 5L中
# swapoff /dev/paging00
# rmps paging00
管理默认的 paging space ( hd6 )
1、减小 hd6 paging space的大小 (在 AIX4.3或之前的版本 )
注意: 在AIX4.2.1 and later does not support reducing the size of hd6 below 32MB
第一步:mkps -a -n -s 30 rootvg hdisk0 (创建一个临时的paging sapce)
第二步:chps -a n hd6 ( deactivate the hd6 )
第三步:将 /sbin/rc.boot中的 swapon /dev/hd6改成 swapon /dev/paging00
第四步:sysdumpdev -l ( check the primary dump device designation)
第五步:sysdumpdev -P -p /dev/paging00 (change the primary ……to paging00
第六步:bosboot -d /dev/hdisk -a ( Create a bootable image
第七步:shutdown -r
第八步:rmps hd6
第九步:mklv -t paging -y hd6 rootvg 30
第十步:sysdumpdev -P -p /dev/hd6
十一步:在/sbin/rc.boot文件中将 ……改成 swapon /dev/hd6
十二步:bosboot -d /dev/hdisk0 -a
十三步:chps -a y hd6
十四步:chps -a n paging00
十五步:shutdown -r
十六步:rmps paging00
减小hd6 (在 AIX 5.1 )
# chps -d
Moving
a paging space with the name hd6 from rootvg to another VG is not
recommended because the name is hard-coded in serveral places
移动 hd6 paging space在相同的卷组中不需要重新启动系统
# migratepv -l hd6 hdisk0 hdisk1
第七部分:System Backup ,restores and availability
使用tctl命令控制磁带机
mksysb : create an installable image of the rootvg either in a file or onto a bootable tape
-e Excludes files listed in the /etc/exclude.rootvg file from being backup up
-i Call the mkszfile command , which generates the /image.data file automatically during a backup
-m Call the mkszfile command to generate map files
savevg : The savevg command saves non-root VG
The mksysb command creates a bootable image of all mounted file systems on the rootvg
The
tape format include a BOS boot image ,a BOS install image and a dummy
table of contents(TOC)follow by the system backup(rootvg)
用户定义的卷组和裸设备不能用mksysb来备份
The BOS boot image contains a copy of the system's kernel and
device drivers needed to boot from the mksysb tape,It is created by the
bosboot command
There are three important files in the mkinsttape image:
./tapeblksz contains the block size
./bosinst.data
allow you to specify the requirements at the target system and how the
user interacts with the target system
./image.data
contain information describing the image installed during the BOS
installation process,This information includes the size,names ,maps,and
mount points of logical volumes and file systems in the rootvg
# mksysb -i 产生一个新的image.data on the tape during a backup( mkszfile命令产生的image.data)
The mksysb commmand creates a bootable image of the rootvg file
system either in a file system directory onto a bootable tape,an is
used to restore a system after a system failure or for system cloning
# savevg -if /dev/rmt0 uservg
使用tar备份目录:
进入该目录,运行: # tar -cvf /dev/fd0 *
使用backup备份目录:
进入该目录,运行: # find . -print ( or -depth ) | backup -i -f /dev/rmt0 (相对的路径)恢复时使用restore
使用cpio备份目录:
# cd /
# find /userdirectory -print | cpio -o -c -v -B >; /dev/rmt0 (恢复时使用cpio -i) (绝对的路径)
增量备份:
# backup -0 -uf /dev/rmt0 /home
# backup -1 -uf /dev/rmt0 /home
对于磁带机:
Rewind the tape to the beginning by using the following
# tctl -f /dev/rmt0 rewind ( mt 也可以 )
显示在一个备份的媒质上的内容
# restore -T -d -v -q -s4 -f /dev/rmt0.1
恢复一个文件:
# restore -x -d -v -q -s4 -f /dev/rmt0.1 ./etc/hosts
# tar -xvg /dev/rmt0 /etc/hosts
# cpio -i -c -v -d -u -m -B
恢复一个目录:
先 tctl -f /dev/rmt0 rewind
# restore -x -d -v -s4 -f/dev/rmt0.1 ./var/dt
# tar -xvf /dev/rmt0 /var/dt
# cpio -i -c -v -d -u -m -B
考点: 一个典型的错误发生在磁带和系统之间移动数据的时候,是因为不正确的 Block size
使用 # tcopy /dev/rmt0 来决定 tape block size
# dd if=/dev/rmt0 bs=128k count=1 | wc -c 来决定 tape block size
改变 tape block size 使用 # chdev -l rmt0 -a block_size=512
复制磁带: # tcopy /dev/rmt0 /dev/rmt1
创建一个软盘的copy:
# dd if=/dev/fd0 of=/tmp/ddcopy
# dd if=/tmp/ddcopy of=/dev/fd0
第九部分: SRC
启动SRC:
涉及到一个 /usr/sbin/srcmstr 进程,Remove
the srcmstr daemon from the /etc/inittab file would cause these
startsrc command to fail
Make a record for the srcmstr daemon in the /etc/inittab file using the mkitab command
# mkitab -i fbcheck srcmstr:2:respawn:/usr/sbin/srcmstr
#telinit q
The syslogd daemon read the /etc/syslog.conf configuration file when it is activated or when it receives a hangup signal
If you decide to capture the warning messages from all users int hte /var/spool/syslog file,
1、 .warning /var/spool/syslog (在 /etc/syslog.conf中加入相关信息 )
2、 touch /var/spool/syslog ( 创建该文件 )
3、 chmod 666 /var/spool/syslog ( 改变权限使所有的用户都可以写信息到该文件 )
4、 refresh -s syslogd
安装skuler command只需要将/var/spool/cron/crontabs/root文件中的注释去掉
第十部分: Newwork adminsitration
At IPL time, the /init process will run /etc/rc.tcpip after starting the SRC
The
script /etc/tcp.clean can be used to stop TCP/IP daemon, It will stop
some daemons and remove the /etc/locks/lpd TCP/IP lock file
Note that the /etc/tcp.clean does not stop the portmap and nfsd daemons ( 要使用stopsrc 和 startsrc )
该命令调用方法: # sh /etc/tcp.clean
注意:不要使用 # startsrc -g tcpip 来启动TCP/IP daemons(它将同时启动routed和gated)
Remove the rc.tcpip条目在/etc/inittab中将在IPL阶段不会启动任何 server application,如果使用的图形终端,一定要确认删除了rc.dt和rc.tcpip条目,否则系统将挂起
Inetd进程调用了inet.conf文件,如果使用smit改变该/etc/inetd.conf的话,inetd进程自动refresh,如果使用vi来更新的话,则要使用refresh -s inetd 或者是 kill -l inetdPID来手工刷新
subserver controlled by inetd in the inetd.conf文件
# lssrc -ls inetd 列示启动的subserver
When
the inetd daemon is stopped, The previously started subserver processes
are not affected , However , new service requests for the subservers
can no longer be satisfied,此时,就不能telnet 或 ftp了
如果Inetd进程停止,已经存在的session将不会受到影响,但不会产生新的session
The protmap daemon converts remote procedure call (RPC) program numbers into Internet port numbers
When an RPC server starts up , it registers with the portmap daemon
Since standard RPC servers are normally started by the inetd daemon,The
portmap daemon must be started before the inetd daemon is invoked
注意:
if the portmap daemon is stopped or comes to an abnormal end,all RPC
servers on the hosts must be restarted, The nfsd is a common RPC server
The default order in resolving host names is : 1、 BIND/DNS (named) 2、NIS 3、/etc/hosts
通过创建/etc/netsvc.conf文件可以改变该顺序
通过设置NSORDER变量可以改变默认的和/etc/netsvc.conf文件中的顺序,NSORDER的优先级最高
一个/etc/resolv.conf的例子:
# cat /etc/resolvl.conf
nameserver 9.3.1.12
domain itsc.ibm.com
search itsc.ibm.com itse.ibm.com
确认named进程的状态: # lssrc -s named
插入一块新的网卡后需要的配置步骤:(基于硬件的配置)
1、必要的话重新调用cfgmgr命令来加载硬件
2、smitty devices安装驱动软件
3、# diag -a 确认新的网卡已经加入到硬件配置中了
4、再次运行cfgmgr
5、# lsdev -cl ent0 确认该网卡处于available的状态
6、使用 # smitty inet来配置nework interface,不要使用smitty mktcpip,It is used for configuration TCP/IP for the first time
To change advanced feature of network adapters
# smitty chgenet
To configure TCP/IP
# smitty tcpip
To change/show Characteristics of a nework interface
# smitty chinet
Enable IP forwarding:
no -o ipforwarding=1
配置IP地址: # smitty mktcpip
Identify network interface on your server
# lsdev -Cc if
This will list of all interfaces on the system,whether they are being actively or not
或者使用 # ifconfig -a
This will produce a list of all network interfaces on the system that have ip addresses and are actively
To get information about one specific network interface
# ifconfig en0
To activate a network interface
# ifconfig tr0 up
# ifconfig tr0 10.32.1.1 netmaski 255.255.255.0 up (同时分配一个IP address)
To deactivate a network interface
# ifconfig tro down
To delete an address from a network interface
# ifconfig tro delete ( this command does not place the interface in
the down state,nor does it remove the interface from the work interface
list )
To remove the interface tro from the network interface list
#
ifconfig tr0 detach ( This command remove all network addresses
assigned to the interface and removes the interface from the output of
the ifconfig -a command,To add an interface back to the system , or to
add a new interface to the newwork interface list , run # ifconfig
Interface
考点: 给一块网卡绑两个IP address :
# ifconfig tr0 10.32.1.1 netmask 255.255.255.0 alias
删掉该IP # ifconfig tr0 10.32.1.1 netmask 255.255.255.0 delete
MTU to small :may be lost during transmission
MTU to length :may be collide with other packets
如何看一块网卡的MTU ( 同一个LAN中必须有相同的MTU)
# lsattr -El en0
调整MTU的大小:
# ifconfig en0 mtu 12000
Example of trusted daemons : ftpd , rexecd , telnetd
Example of non-trusted daemons : rshd , rlogind , tftpd
The $HOME/.netrc 文件
Contains information used by the automatic login feature of the rexec and ftp command , 该文件的权限必须设置成600
The /etc/hosts.equiv and $HOME/.rhosts 文件
Define the hosts and user accounts that can invoke remote commands on a
local host without supplying a
password,先检查/etc/hosts.equiv后检查$HOME/.rhosts
如果一个远程的命令由root用户所发出,/etc/hosts.equiv文件被忽略,只有 /.rhosts 文件被检查,同样,这两个文件的权限应该设置成600
为了安装匿名的FTP在一个服务器上(运行AIX 5L)
# /usr/samples/tcpip/anon.ftp
To enable FTP logging
1、编辑 /etc/syslog.conf文件增加该条目 daemon.info FileName ,在执行下一步之前该文件必须存在
2、运行 # refresh –s syslogd
3、编辑 /etc/inetd.conf 修改包含ftp的那一行
4、运行 # refresh –s inetd
可以使用 # uname –n 命令来显示系统的主机名
# uname 可以显示你使用的是什么操作系统
网络问题的决定:
考点:当 Paging space may be full or not enough memory
的时候,如果一个用户尝试telnet或者是ftp 到系统,There will be time out as the system
cannot create additional processes
考点:一个文件系统可能满了
如果一个用户可以访问系统,但该用户不能启动 Web based system manager,可能是/tmp文件系统满了
第十一部分 Network File System administration
The /usr/sbin/nfsd daemon on the server
The /usr/sbin/biod daemon on the client
The /usr/sbin/rpc.mountd daemon on the server
The /usr/sbin/mount command on the client
要启动NFS daemon进程在每一个系统,无论是服务器还是客户机:
# smitty mknfs
或者使用 # mknfs –N
使用下面的步骤配置一个NFS Server
1、启动NFS daemon (如果没有启动的话)
# startsrc –s nfsd ( 启动 nfsd进程 ) 或使用 # startsrc –g nfs (启动 All of the NFS daemons )
注意: 如果/etc/exports 文件不存在的话,The nfsd 和 rpc.mountd进程将不会启动,你可以创建一个空的/etc/exports 文件 # touch /etc/exports ,从而nfsd和rpc.mountd进程就可以启动了
导出一个NFS目录方法一:
1、确认NFS进程已经运行了
# lssrc –g nfs
2、使用 # smitty mknfsexp 去导出目录
3、导出后,使用 # /usr/sbin/exportfs –a : tell the exportfs command to send all information in the /etc/exports file to the kernel
4、确认所有的文件系统已经被导出 # showmount –e CROOM
导出一个NFS目录方法二:
# vi /etc/exports 创建条目在该文件中,List each directory to be exported in the left margin,
OK 后 运行 # /usr/sbin/exportfs –a
临时导出一个目录:
# exportfs –i /dirname
Unexporting an NFS directory
# smitty rmnfsexp 从而该目录的条目从/etc/exprots文件中删掉
你也可以使用vi来Unexprot 一个目录 然后运行 # exprotfs –u dirname
Mounting an NFS directory
由三种类型的NFS Mount
1、预定义的加载指定在 /etc/filesystems文件中
2、explict mounts serve the needs of the root user,,不需要升级/etc/filesystems文件
3、Automatic mounts are controlled by the automount command,
NFS 加载的过程:
1、
When the server starts , the /etc/rc.nfs script runs the exportfs
command , which reads the server /etc/exports file and then tells the
kernel which directory are to be exported and which access restrictions
they require.
2、The rpc.mountd daemon and several nfsd daemons are then started by the /etc/rc.nfs script
3、
When the client start, the /etc/rc.nfs script starts several biod
daemons, which forward client mount request to the appropriate server
4、Then the /etc/rc.nfs script executes the mount command , which reads the file systems list in the /etc/filesystems file
5、
The mount command locates one or more servers that export the
information the client wants and sets up communication between itself
and that server
6、The mount command then request that one or more
servers allow the client to access the directory in the client
/etc/filesystem file
7、The server rpc.mountd daemon receives the
client mount requests and either grants or denies them , if the
requested directory is available to that client
8、The client kernel then ties the file handle to the mount point by recording certain information in a mount record
加载方法一:
编辑/etc/filesystem
方法二: # smitty mknfsmnt
确认The NFS Server has exported the directory:
# showmount –e ServerName
自动加载一个文件系统
1、showmount –e ServerName
2、创建一个映射文件 /tmp/mount.map
3、# lssrc –s automountd 确认该进程已经启动
4、 /usr/sbin/automount –v /backup /tmp/mount.map
5、可以 # cd /backup了 ( 自动加载成功 )
6、
为了得到所有的NFS进程的状态
# lssrc –g nfs
改变一个导出的文件系统
在做改变时要先 unexport # exportfs –u /dirname
然后 # smitty chnfsexp
然后再次导出 # exportfs /dirname
使用文本编辑器改变一个导出的文件系统
1、exportfs –u /dirname
2、vi /etc/exportfs 改变相应的内容保存退出
3、重新导出 # exportfs /dirname
To Unmount an explicitly or automatically mounted NFS directory ,
# umount /backup
The rmfs command can be used to remove any file systems you created
相关的文件,命令和进程的参考:
/etc/exports List the directories that can be exported to NFS clients
/etc/xtab List the directories that are currently exported
/etc/filesystems List all file systems that can potentially be mounted and their mounting configuration.
在诊断NFS的问题的时候,如果要确认 the server is up and running (在客户端运行)
# /usr/bin/rpcinfo –p server_name
确认 the mountd, portmap ,and nfsd daemons are running on the NFS server
# /usr/bin/rpcinfo –u server_name mount
# /usr/bin/rpcinfo –u server_name portmap
# /usr/bin/rpcinfo –u server_name nfs
确认在服务器上的/etc/exports 文件列出了要加载的文件系统的名字
确认在服务器上已经导出了该文件系统 # showmount –e ServerName
nfsstat命令决定现在是否丢包 nfsstat –c and nfsstat –s 命令来决定客户机和服务器是否在重传大包, 重传率达到5%就是很高了
NFS 的错误信息
1、if a server fails to respond to a hard-mounted request
显示信息: ……………… not respond
2、If a server fails to respond to a soft-mount request
显示信息: ……………… time out
3、Bad sendreply error message
Insufficient transmit buffers on your network can cause the following error message
显示信息: nfs_server : bad sendreply
为了增加transmit buffers , # smitty commodev
4、Server not responding
首先看看NFS进程是否启动或是否停止了,如果mountd或者是nfsd进程被停止了或是没有启动在服务器上的话,当客户端欲mount filesystem的时候将会出错
如果rpc.mountd进程在启动后停止了,解决方法:
1、telnet 到服务器
2、cd /etc
3、# stopsrc –g nfs
4、# stopsrc –s portmap
5、rm –rf state sm sm.bak xtab rmtab
6、startsrc –s portmap
7、startsrc –g nfs
8、exportfs –a
9、showmount –e servername
考点:
A file system name that appears in the /etc/exports file but not in the
output from the showmount command ,说明 a failure in the mountd daemon ,
either the daemon could not parse that line in the file , it could not
find the directory, or the directory name was not a locally mountd
directory, If the /etc/exports file looks correct and your network runs
NIS , check the server’s ypbind daemon , it may be stopped or hung
NFS mounts and unmount are only allowed for root user and members of the system group
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/16863/showart_127716.html |
|