在redhatlinux AS4 上创建使用裸设备的informix数据库
1. 在安装AS4时留出了400G的空间作为informix数据库裸设备空间
2. 使用fdisk 对未分区的空间进行分区
[root@localhost /]# fdisk -l
Disk /dev/sda: 440.0 GB, 440087347200 bytes
255 heads, 63 sectors/track, 53504 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 639 5132736 83 Linux
/dev/sda2 640 1944 10482412+ 83 Linux
/dev/sda3 1945 2583 5132767+ 82 Linux swap
/dev/sda4 2584 53504 409022932+ 5 Extended
/dev/sda5 2584 3222 5132736 83 Linux
/dev/sda6 3223 3861 5132736 83 Linux
/dev/sda7 3862 4253 3148708+ 83 Linux
可以看到4254-53504未分区
[root@localhost /]# fdisk /dev/sda
Command (m for help): 在这里按m ,就会输出帮助;
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition 注:这是删除一个分区的动作;
l list known partition types 注:l是列出分区类型,以供我们设置相应分区的类型;
m print this menu 注:m 是列出帮助信息;
n add a new partition 注:添加一个分区;
o create a new empty DOS partition table
p print the partition table 注:p列出分区表;
q quit without saving changes 注:不保存退出;
s create a new empty Sun disklabel
t change a partition's system id 注:t 改变分区类型;
u change display/entry units
v verify the partition table
w write table to disk and exit 注:把分区表写入硬盘并退出;
x extra functionality (experts only) 注:扩展应用,专家功能;
Command (m for help): n 注:增加一个分区
Command action
l logical (5 or over)
p primary partition (1-4)
l 注:在这里输入l,就进入划分逻辑分区阶段了;
First cylinder (4254-53504, default 4254):4254
Last cylinder(4254-53504, default 4254):6700
(在这里我想建两个分区,一个用作安装informix的目录,一个用做informix的dbspace空间)
Command (m for help): t 注:通过t来指定分区类型;
Partition number (1-8): 8 注:要改变哪个分区类型呢?我指定了8,其实也就是sda8
Hex code (type L to list codes):L 注:在这里输入L,就可以查看分区类型的id了;
Hex code (type L to list codes):83 (这里我选了linux,我想linux不会有错,其他格式不清楚)
Command (m for help): p
Disk /dev/sda: 440.0 GB, 440087347200 bytes
255 heads, 63 sectors/track, 53504 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 639 5132736 83 Linux
/dev/sda2 640 1944 10482412+ 83 Linux
/dev/sda3 1945 2583 5132767+ 82 Linux swap
/dev/sda4 2584 53504 409022932+ 5 Extended
/dev/sda5 2584 3222 5132736 83 Linux
/dev/sda6 3223 3861 5132736 83 Linux
/dev/sda7 3862 4253 3148708+ 83 Linux
/dev/sda8 4254 6700 19655496 83 Linux
fdisk 的退出,用q或者 w;(其中 q是 不保存退出,w是保存退出;)
reboot 重启系统生效
同样的方法分配6701-53504为/dev/sda9
3. 对安装informix的分区进行格式化为ext3系统
[root@localhost /]#mkfs -t ext3 /dev/sda8
[root@localhost /]#mkdir /Informix 创建挂载目录
使用amount加载这个分区
[root@localhost /]#mount /dev/sda8 /Informix
为使开机自动挂载/Informix ,需在/etc/fstab中加入:
/dev/sda8 /Informix defaults 0 0
4. 建立informix组:[root@localhost /]#groupadd –g 501 informix
5. 建立informix用户:[root@localhost /]#useradd –u 501 –g 501 –d /Informix –m Informix
修改informix用户口令: [root@localhost /]#passwd Informix
6. 修改informix用户目录的属组及组:[root@localhost /]#chown Informix:Informix Informix
7. 修改informix用户的环境变量.bash_profile,将以下内容添加进去
INFORMIXDIR=/informix
INFORMIXSERVER=kefu_dbs
ONCONFIG=onconfig.kefu
DBDATE=MDY4*
LD_LIBRARY_PATH=$INFORMIXDIR/lib:$INFORMIXDIR/lib/esql:$LD_LIBRARY_PATH
export INFORMIXDIR INFORMIXSERVER ONCONFIG LD_LIBRARY_PATH
PATH=$PATH:$INFORMIXDIR/bin (path只需修改一下)
8. 使用informix用户将安装光盘中的.tar文件拷贝到informix目录下
tar –xvf
9. 转为root用户,转到informix安装文件所在的目录下执行./ids_install
(安装过程中选择安装路径为/informix)
10. 配置/etc/services文件添加:sqlexe 1526/tcp
11. 配置/etc/hosts 文件添加:10.100.61.40 kefu_set
12. 配置/informix/etc/sqlhosts添加:kefu_dbs onsoctcp kefu_set sqlexe
13. 建立裸设备空间
[root@localhost /]#pvcreate /dev/sda9 创建pv
[root@localhost /]#vgcreate /dev/vg00 /dev/sda9 创建vg
[root@localhost /]#lvcreate -L 2000000 -n kefu_rootchunk vg00
[root@localhost /]#lvcreate -L 200000 -n kefu_phychunk vg00
[root@localhost /]#lvcreate -L 2000000 -n kefu_logchunk1 vg00
[root@localhost /]#lvcreate -L 2000000 -n kefu_logchunk2 vg00 (可以根据需要建立多个logchunk)
[root@localhost /]#lvcreate -L 2000000 -n kefu_datachunk1 vg00 (可以根据需要建立多个datachunk)
[root@localhost /]#lvcreate -L 2000000 -n kefu_datachunk2 vg00
[root@localhost /]#lvcreate -L 2000000 -n kefu_tmpchunk vg00
绑定raw设备,informix在创建数据库时使用的是字符设备,用lvcreate创建的逻辑卷是块设备,所以必须将块设备和字符设备绑定。
块设备和字符设备绑定的命令:
[root@localhost /]#raw /dev/raw/raw1 /dev/vg00/kefu_tmpchunk
[root@localhost /]#raw /dev/raw/raw1 /dev/vg00/kefu_rootchunk
[root@localhost /]#raw /dev/raw/raw2 /dev/vg00/kefu_logchunk
[root@localhost /]#raw /dev/raw/raw3 /dev/vg00/kefu_logchunk2
[root@localhost /]#raw /dev/raw/raw4 /dev/vg00/kefu_datachunk1
[root@localhost /]#raw /dev/raw/raw5 /dev/vg00/kefu_datachunk2
[root@localhost /]#raw /dev/raw/raw6 /dev/vg00/kefu_datachunk2
依次添加。。。
更改raw设备文件的属主: chown -R informix:informix /dev/raw/*
修改/etc/sysconfig/rawdevices文件,增加:
/dev/raw/raw1 /dev/vg00/kefu_tmpchunk
/dev/raw/raw2 /dev/vg00/kefu_rootchunk
/dev/raw/raw3 /dev/vg00/kefu_logchunk
/dev/raw/raw4 /dev/vg00/kefu_logchunk2
/dev/raw/raw5 /dev/vg00/kefu_datachunk1
/dev/raw/raw6 /dev/vg00/kefu_datachunk2
依次添加。。。
在$INFORMIXDIR下以informix用户创建dbs文件夹,进入dbs
[informix@localhost dbs]$ln –s /dev/raw/raw2 rootchunk
[informix@localhost dbs]$ln –s /dev/raw/raw3 logchunk
[informix@localhost dbs]$ln –s /dev/raw/raw4 datachunk
修改etc/rc.local 添加chown -R informix:informix /dev/raw/*
收起