快速搭建DB2 purescale测试环境(虚拟机)

因为之前有听过一个Purescale的培训,之后又看了些前辈和大师的文档。出于好奇,自己就动手在虚拟机上搭建一个测试环境。当然,首先要感谢各前辈和大师。过程如下,多多指教:


测试环境: 在HP的刀片上,安装Oracle VM VirtualBox,搭建IBM Purescale环境               虚拟两个主机,node01做共享存储。创建实例一个cf在node01上,一个member在node02上
测试软件: VirtualBox RPM包:VirtualBox-4.3-4.3.12_93733_el6-1.x86_64.rpm
                Linux 64位  系统   :[红帽企业Linux.6.4.服务器版].rhel-server-6.4-x86_64-dvd(ED2000.COM).iso
                DB2   数据库软件  :v10.5_linuxx64_server_t.tar.gz

  软件分享:http://pan.baidu.com/s/1zqEfW

1、最小化安装linux系统(node01、node02)(记得在虚拟机node01上添加一块新硬盘用于共享存储)
2、修改ip,注意网关!(node01【21】、node02【22】)
    vi /etc/sysconfig/network-scripts/ifcfg-eth0
      ONBOOT=yes
      BOOTPROTO=static
      IPADDR=192.168.56.21      ##【21】【22】
      NETMASK=255.255.255.0
      GATEWAY=192.168.56.1
##切记一定要设置网关,主机也要设置。
3、关闭防火墙:(node01、node02)
      chkconfig iptables off
4、关闭selinux:(node01、node02)
      vi /etc/selinux/config       ##修改SELINUXTYPE=disabled
      vi /etc/grub.conf            ##找到最后一个单词是quiet的一行,在quiet后面加上 selinux=0 ,修改之后重启系统!
5、使用yum安装需要的包(node01、node02)
      1.cd /mnt/
      2.mkdir cdrom
      3.mount /dev/cdrom /mnt/cdrom
      4.vi /etc/yum.repos.d/rhel-source.repo
           [rhel-source]
            baseurl=file:///mnt/cdrom/   ##此项修改成这样
            enabled=1                    ##此项修改成这样
      5.yum clean all
      6.yum repolist
      7.yum安装文件包:先切换到cd /mnt/cdrom/Packages/目录下
         1、yum -y install gcc automake autoconf libtool make openssh-clients iscsi-initiator-utils libnes libmthca libipathverbs libcxgb3 libibcm libaio ibsim ibutils rdma pam dapl* compat-libstdc++* perl-Config-General scsi-target-utils librdmacm-devel*  
         2、 yum -y install libstdc++* glibc* gcc* kernel* ntp* sg3* binutils* openssh* cpp* ksh*
           (检查确定所有包全部安装)
6、创建组和用户(node01、node02)
    groupadd -g 1001 db2fadm1
    groupadd -g 1002 db2iadm1
    useradd -g db2fadm1  -u 1001 -m  -d /home/db2fenc1  -p db2fenc1  db2fenc1
    useradd -g db2iadm1  -u 1002 -m  -d /home/db2inst1   -p db2inst1  db2inst1
    mkdir /root/.ssh
    su - db2inst1 -c "mkdir -p /home/db2inst1/.ssh"
    修改db2inst1的密码:passwd db2inst1
7、建立互信
     修改node01、node02上的ip与主机名映射
     vi /etc/hosts
     127.0.0.1       localhost
     192.168.56.21   node01   
     192.168.56.22   node02

  在node01执行如下命令:
  ssh-keygen -t rsa
  cp -v  /root/.ssh/id_rsa.pub /root/.ssh/id01
  scp  /root/.ssh/id01 node02:/root/.ssh
  su - db2inst1
  ssh-keygen -t rsa
  cp -v  /home/db2inst1/.ssh/id_rsa.pub     /home/db2inst1/.ssh/id01
  scp   /home/db2inst1/.ssh/id01   node02:/home/db2inst1/.ssh

  在node02执行如下命令:
  ssh-keygen -t rsa
  cp -v  /root/.ssh/id_rsa.pub            /root/.ssh/id02
  scp  /root/.ssh/id02           node01:/root/.ssh/
  su - db2inst1
  ssh-keygen -t rsa
  cp -v  /home/db2inst1/.ssh/id_rsa.pub  /home/db2inst1/.ssh/id02
  scp   /home/db2inst1/.ssh/id02 node01:/home/db2inst1/.ssh/

  在node01、node02执行如下命令(在root下)
  cd  /root/.ssh
  cat id01 id02 >authorized_keys
  chmod 600 authorized_keys
  su - db2inst1
  cd /home/db2inst1/.ssh
  cat id01 id02 >authorized_keys
  测试是否配置成功,确保不用输入密码和yes,则配置成功(node01、node02)
  ssh node01 ls
  ssh node02 ls
  su - db2inst1
  ssh node01 ls
  ssh node02 ls

8、设置共享存储
    1、在node01、node02上添加tgtd服务开机自启动:
     chkconfig --add tgtd
     chkconfig --level 2345 tgtd on
     chkconfig --list
    2、在node01上:(建立虚拟机时多添加的一块新盘/dev/sdb(若上面没添加,现在关机添加也可以),用于共享存储)
    vi /etc/tgt/targets.conf
    添加如下:
     
                  backing-store /dev/sdb
        initiator-address 192.168.56.21
        initiator-address 192.168.56.22
     

     设置之后,在node01上重启服务:service tgtd restart

     3、在node01、node02上:
      vi /etc/rc.local  
      添加如下:
        iscsiadm  --mode discoverydb  --type sendtargets  --portal 192.168.56.21 --discover
        iscsiadm --m node --targetname iqn.2014-05.localdomain:node01 --portal 192.168.56.21:3260 --login
     设置之后重启机器或者手动执行以上添加的命令,重启或手动执行之后:fdisk -l 应该可以看到多出一块盘/dev/sdc。

9、配置环境变量、安装db2软件(node01、node02)
配置环境变量:
vi /root/.bash_profile
添加如下:
export PATH=/root/bin:/usr/sbin/rsct/bin:/opt/ibm/db2/v10.5/bin:$PATH
export PATH=/usr/lpp/mmfs/bin:$PATH
export DB2USENONIB=TRUE
export DB2_CFS_GPFS_NO_REFRESH_DATA=true
export IBM_RDAC=NO
export CT_MANAGEMENT_SCOPE=2

安装db2软件: ./db2_install -> yes -> SERVER -> yes

10、设置GPFS文件系统(node01上)
cd /opt/ibm/db2/V10.5/instance/
./db2cluster_prepare -instance_shared_dev /dev/sdc    ##我的共享出来的盘是/dev/sdc

cd /opt/ibm/db2/V10.5/bin
./db2cluster -cfs -add -host node02
./db2cluster -cfs -add -license
mmstartup -a
mmgetstate -a(所有node active)
mmmount all -a
以上操作之后,两机器:df -h 会看到多出一个类似/db2sd_20140526123355文件系统。

11、创建实例、设置环境变量、启动实例(随意)
创建实例:./db2icrt -cf node01 -cfnet node01 -m node02 -mnet node02 -instance_shared_dir /db2sd_20140526123355/ -tbdev 192.168.56.1 -u db2fenc1 db2inst1

设置环境变量:
db2set DB2_SD_SOCKETS_RESTRICTIONS=false
db2set DB2_CA_TRANSPORT_METHOD=SOCKETS

启动实例:db2start
另:以上过程仅供在虚拟机上测试,多多指教,谢谢!


node03是我后添加上去的.jpg


(member node03,是我之后另添加上去的)
参与13

10同行回答

刘胜涛刘胜涛数据库管理员Volkswagen Group China
有点疑问:10、设置GPFS文件系统(node01上)cd /opt/ibm/db2/V10.5/instance/./db2cluster_prepare -in ...babydlj 发表于 2014-6-3 14:25     你的过程不会安装gpfs,在这一步之前已经安装好了,这一步主要工作是:   创建NSD、创建FS、挂载FS...显示全部
有点疑问:
10、设置GPFS文件系统(node01上)
cd /opt/ibm/db2/V10.5/instance/
./db2cluster_prepare -in ...
babydlj 发表于 2014-6-3 14:25



    你的过程不会安装gpfs,在这一步之前已经安装好了,这一步主要工作是:
   创建NSD、创建FS、挂载FS收起
汽车 · 2014-06-03
浏览1689
wsbj123wsbj123软件开发工程师SXYZ
谢谢分享,学习学习~显示全部
谢谢分享,学习学习~收起
互联网服务 · 2015-09-08
浏览1796
dbalisimmydbalisimmy项目经理大话西游
回复 1# yuan23 你好:    为在安装的时候出现了一下问题, TSAMP无法安装?不知道你遇到过没? 帮忙看下谢谢!Installing: TSAMPERROR: DBI20105E  An error occurred while installing the following file set:"tsamp". Because these files were not succe...显示全部
回复 1# yuan23

你好:

    为在安装的时候出现了一下问题, TSAMP无法安装?不知道你遇到过没? 帮忙看下谢谢!


Installing: TSAMP

ERROR: DBI20105E  An error occurred while installing the following file set:
"tsamp". Because these files were not successfully installed, functionality
that depends on these files might not work as expected.

Rolling back what has been installed

WARNING: DBI1216E  Uninstalling the IBM Tivoli System Automation for
      Multiplatforms (SA MP) failed because the command uninstallSAM was
      not found in the expected directory: /opt/IBM/tsamp/sam/uninst/uninstallSAM.

Explanation:

db2_deinstall uses the uninstallSAM utility to uninstall the SA MP.
db2_deinstall expects to find the uninstallSAM utility in the specified
directory, but did not find it there in this case. This might be because
the current version of the SA MP is earlier than version 2.2. The option
to uninstall the SA MP with the db2_deinstall command is only supported
for SA MP Version 2.2 or higher.

The SA MP was not uninstalled.

User response:

To uninstall the SA MP manually, use the uninstallSAM command.

For more information about the uninstallSAM command, see the SA MP Base
Component documentation.


   Related information:
   SA MP Base Component documentation


Removing files for "TSAMP".收起
软件开发 · 2015-08-15
浏览1803
laopoainibenlaopoainiben联盟成员技术支持平安普惠
请问下面的报错如何解决,在/tmp/db2cluster_prepare.log内没有任何有用信息./db2cluster_prepare -instance_shared_dev /dev/sddDBI1446I  The db2cluster_prepare command is running.DB2 installation is being initialized. DBI1264E  This progr...显示全部
请问下面的报错如何解决,在/tmp/db2cluster_prepare.log内没有任何有用信息
./db2cluster_prepare -instance_shared_dev /dev/sdd
DBI1446I  The db2cluster_prepare command is running.


DB2 installation is being initialized.

DBI1264E  This program failed. Errors encountered during execution were
      written to the installation log file. Program name:
      db2cluster_prepare. Log file name: /tmp/db2cluster_prepare.log.收起
政府机关 · 2015-01-13
浏览1631
dayan_hedayan_he软件开发工程师hhh
很不错,如果能补充一些 测试环境下 数据库和应用 部署更好了显示全部
很不错,如果能补充一些 测试环境下 数据库和应用 部署更好了收起
互联网服务 · 2014-06-12
浏览1612
lpr2010lpr2010数据库管理员GDC
谢谢分享,学习下显示全部
谢谢分享,学习下收起
系统集成 · 2014-06-10
浏览1666
daoguo525daoguo525系统工程师世纪五岳(北京)科技有限公司
感谢分享。显示全部
感谢分享。收起
互联网服务 · 2014-06-09
浏览1638
babydljbabydlj联盟成员系统分析师湖南unicom
有点疑问:10、设置GPFS文件系统(node01上)cd /opt/ibm/db2/V10.5/instance/./db2cluster_prepare -instance_shared_dev /dev/sdc    ##我的共享出来的盘是/dev/sdc这个操作步骤中,难道会安装了GPFS的软件么?我的印象中,GPFS FOR linux 应该有单独的安装软件的。还需...显示全部
有点疑问:
10、设置GPFS文件系统(node01上)
cd /opt/ibm/db2/V10.5/instance/
./db2cluster_prepare -instance_shared_dev /dev/sdc    ##我的共享出来的盘是/dev/sdc
这个操作步骤中,难道会安装了GPFS的软件么?
我的印象中,GPFS FOR linux 应该有单独的安装软件的。还需要在各个节点上安装GPFS软件,编译,和配置集群,添加GPFS的磁盘和格式化GPFS文件系统的。健壮的GPFS集群,其配置过程
本身就是一个比较复杂的。收起
IT其它 · 2014-06-03
浏览1646
heraleignheraleign网站架构师iwhalecloud
{:3_46:}牛B显示全部
{:3_46:}牛B收起
系统集成 · 2014-06-03
浏览1558
jlandzpajlandzpa系统运维工程师广州华南资讯科技有限公司
感谢分享。显示全部
感谢分享。收起
系统集成 · 2014-06-03
浏览1640

提问者

yuan23
数据库管理员中科软科技股份有限公司

相关问题

相关资料

问题状态

  • 发布时间:2014-06-03
  • 关注会员:2 人
  • 问题浏览:28152
  • 最近回答:2015-09-08
  • X社区推广