总的教程:
http://www.ibm.com/developerworks/data/library/techarticle/dm-0504mcarthur/index.html
1.Server准备
2.文件系统
3.建立实例
4.rsh
5.测试
环境:
Server:
test64bit00
test64bit01
node:
0 test64bit00 0
1 test64bit00 1
2 test64bit01 0
3 test64bit01 1
User ID:
dpfinst1:x:1004:999::/db2home/dpfinst1:/bin/bash
dpffen1:x:1003:998::/db2home/dpffen1:/bin/bash
dpfdas1:x:1002:997::/home/dpfdas1:/bin/bash
Share home path:
/db2home
1.Server准备
现在vmware装好DB2,建好用户,然后使用clone功能复制多一台
然后更新各自的IP就好
因为DB2安装路径、版本,用户和组的ID都必须一样,所以这样做既省事又准确
--添加用户 groupadd -g 999 db2iadm1 groupadd -g 998 db2fadm1 groupadd -g 997 dasadm1 useradd -u 1004 -g db2iadm1 -m -d /db2home/dpfinst1 dpfinst1 -p manager1 useradd -u 1003 -g db2fadm1 -m -d /db2home/dpffen1 dpffen1 -p manager1 useradd -u 1002 -g dasadm1 -m -d /home/dpfdas1 dpfdas1 -p manager1 passwd db2inst1 passwd db2fenc1 passwd dasusr1 --补齐包 rpm -ivh rsh-server-0.17-40.el5.x86_64.rpm --相应的服务 service portmap start service nfs start chkconfig rsh on --更新/etc/hosts 192.168.221.137 test64bit01 192.168.221.136 test64bit00
2.文件系统
在test64bit00上
mkdir /db2home --在/etc/fstab里面添加: /dev/sdc /db2home ext3 defaults 0 0 --在/etc/exports里面添加: /db2home test64bit00(rw,sync,no_root_squash) test64bit01(rw,sync,no_root_squash) --允许相应的server进行读写 --应用更改 /usr/sbin/exportfs -a
在test64bit01上
mkdir /db2home --在/etc/fstab里面添加: test64bit00:/db2home /db2home nfs rw,timeo=300,retrans=5,hard,intr,bg,nolock,suid --刷新最新的挂载点 mount -a
现在NFS就弄好了
[root@test64bit00 db2home]# touch a [root@test64bit01 db2home]# ll a -rw-r--r-- 1 root root 0 Nov 23 16:58 a
3.建立实例
--建立一次就好了 [root@test64bit00 db2home]# /opt/ibm/db2/V9.5/instance/db2icrt -u dpffen1 dpfinst1 DBI1070I Program db2icrt completed successfully. --把db2profile加到bash profile里面 [dpfinst1@test64bit01 ~]$ tail -1 .bash_profile /db2home/dpfinst1/sqllib/db2profile --更新相应的连接配置 --在/etc/services里面保证两边相同 [root@test64bit01 db2home]# grep -i dpf /etc/services DB2_dpfinst1 60020/tcp DB2_dpfinst1_1 60021/tcp DB2_dpfinst1_2 60022/tcp DB2_dpfinst1_END 60023/tcp db2 update dbm cfg using SVCENAME DB2_dpfinst1 db2set DB2COMM=tcpip
4.rsh
更新nodes列表:
[dpfinst1@test64bit00 ~]$ cat sqllib/db2nodes.cfg 0 test64bit00 0 1 test64bit00 1 2 test64bit01 0 3 test64bit01 1
添加rhost
vi /db2home/dpfinst1/.rhosts test64bit00 dpfinst1 test64bit01 dpfinst1 chmod 600 /db2home/dpfinst1/.rhosts
5.测试
[dpfinst1@test64bit00 ~]$ db2_all date Wed Nov 23 17:06:19 CST 2011 test64bit00: date completed ok Wed Nov 23 17:06:19 CST 2011 test64bit00: date completed ok Wed Nov 23 17:06:19 CST 2011 test64bit01: date completed ok Wed Nov 23 17:06:19 CST 2011 test64bit01: date completed ok
PS:途中遇到许多问题,整理了一些:
1.rsh 544 connection refused
connect to address 192.168.221.137 port 544: Connection refused Trying krb4 rsh... connect to address 192.168.221.137 port 544: Connection refused trying normal rsh (/usr/bin/rsh) test64bit01: Connection refused
A.首先确保iptables没有打开
B.在/etc/securetty里面添加
rexec
rsh
rlogin
C.去除多余的krb4
cd /usr/kerberos/bin mv rsh rsh.bak20110602 ln -s /usr/bin/rsh rsh
http://www.manotes.net/?tag=redhat-linux-ssh-port-544-connection-refused
2.各种NFS的配置
因为第一次配这个,所以要从头开始
http://www.liusuping.com/ubuntu-linux/Redhat-Linux-NFS-setting.html
http://server.zdnet.com.cn/server/2007/0831/482007.shtml
3.SQL5005C,SQL1042C
在NFS的client端必须要使用nolock的模式mount
不然db2_all反应很慢,报出以下错误:
[root@test64bit01 ~]# dmesg -c lockd: server 192.168.221.136 not responding, timed out lockd: server 192.168.221.136 not responding, timed out [dpfinst1@test64bit01 ~]$ db2 list db directory SQL5005C System Error. [dpfinst1@test64bit01 ~]$ db2start SQL1042C An unexpected system error occurred. SQLSTATE=58004
http://newyue.blog.51cto.com/174760/562926
http://linux.die.net/man/5/nfs
http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/core/r0012308.htm
http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.rn.doc/rn/r0021677.htm
http://publib.boulder.ibm.com/infocenter/tivihelp/v2r1/index.jsp?topic=%2Fcom.ibm.tsiem.doc%2Ftg%2Fkp_sql5005cerrors.html