D_DB2 DPF环境搭建

来源:互联网 发布:javascript字符串反转 编辑:程序博客网 时间:2024/04/29 21:53

RHEL6.3系统上DB2 V10.5 DPF环境搭建手册

转自:
http://www.db2china.net/home/space.php?uid=27514&do=blog&id=31383

1. 概述

本文档主要描述在RHEL 6.3系统上如何配置DB2 V10.5DPF环境。

本文档不会讲述RHEL6.3系统的安装方法和DB2 V10.5的安装方法,所以本文档要求读者具有基础操作系统操作能力和DB2 基础操作能力。

2. 环境要求

本章节主要说明DB2 V10.5 DPF环境要求的硬件和软件都有哪些。

2.1. 硬件环境

节点名称

主机名

网络参数

硬件规格

备注

节点1

db2-node1

192.168.100.50/24/192.168.100.1

172.16.0.50/24(私有网络)

Core i3及以上级别处理器;1GB及以上容量内存;20GB及以上容量硬盘;2块千兆以太网卡;交换机2台,内外网分离。

在本机需要搭建一个NFS服务端和NTP服务端供db2-node2使用

节点2

db2-node2

192.168.100.51/24/192.168.100.1

172.16.0.51/24(私有网络)

 

本硬件环境中私有网络是供NFS共享、内部通讯用的。这样能分发网络带宽压力。

2.2. 软件环境

序号

软件名称

软件版本

用途

1

RHEL

6.3

操作系统

2

DB2

10.5

数据库

3

NFS

4RHEL系统自带)

共享目录

4

NTP

4.2.4p8RHEL系统自带)

两节点间时间同步

5

RSH

0.17-60RHEL系统自带)

两节点间通讯

 

3. 安装配置说明

本章节重点是讲述如何配置一个DPF环境。由于侧重点不同本章节不对RHEL6.3系统的安装和DB2V10.5数据库的安装进行讲解。

3.1. 安装操作系统

虽然本文档不涉及操作系统的安装,但是还要注意在安装操作系统时要选择最小化安装。这样就可以避免安装上很多软件。这样做减少了磁盘的占用,降低了整个系统的安全风险。软件选择界面要如下图所示选择最小化安装。


3.2. 配置网络

IBM DB2DPF环境是严重依赖以太网络的,所以在配置DPF之前一定要把基础的硬件环境和网络环境搭建好。本示例中的两台服务器都各有两块网卡,网卡名称分别为eth0eth1。其中eth0用于外网通讯而eth1用于内网通讯,内网通讯就包括NFS共享,NTP时间同步。

3.2.1. 检查网络是否畅通

本文档默认红帽子RHEL6.3系统已经配置完成了,并且网络已经配置通了。在节点db2-node1上用下面方法验证网络是否通畅

[db2inst1@db2-node1 ~]$ ping 192.168.100.50

PING 192.168.100.50 (192.168.100.50) 56(84) bytes of data.

64 bytes from 192.168.100.50: icmp_seq=1 ttl=64 time=0.147 ms

64 bytes from 192.168.100.50: icmp_seq=2 ttl=64 time=0.040 ms

64 bytes from 192.168.100.50: icmp_seq=3 ttl=64 time=0.061 ms

--- 192.168.100.50 ping statistics ---

3 packets transmitted, 3 received, 0% packet loss, time 2010ms

rtt min/avg/max/mdev = 0.040/0.082/0.147/0.047 ms

[db2inst1@db2-node1 ~]$ ping 192.168.100.51

PING 192.168.100.51 (192.168.100.51) 56(84) bytes of data.

64 bytes from 192.168.100.51: icmp_seq=1 ttl=64 time=0.742 ms

64 bytes from 192.168.100.51: icmp_seq=2 ttl=64 time=0.578 ms

--- 192.168.100.51 ping statistics ---

2 packets transmitted, 2 received, 0% packet loss, time 1117ms

rtt min/avg/max/mdev = 0.578/0.660/0.742/0.082 ms

[db2inst1@db2-node1 ~]$ ping 172.16.0.50

PING 172.16.0.50 (172.16.0.50) 56(84) bytes of data.

64 bytes from 172.16.0.50: icmp_seq=1 ttl=64 time=0.062 ms

--- 172.16.0.50 ping statistics ---

1 packets transmitted, 1 received, 0% packet loss, time 742ms

rtt min/avg/max/mdev = 0.062/0.062/0.062/0.000 ms

[db2inst1@db2-node1 ~]$ ping 172.16.0.51

PING 172.16.0.51 (172.16.0.51) 56(84) bytes of data.

64 bytes from 172.16.0.51: icmp_seq=1 ttl=64 time=0.759 ms

--- 172.16.0.51 ping statistics ---

1 packets transmitted, 1 received, 0% packet loss, time 812ms

rtt min/avg/max/mdev = 0.759/0.759/0.759/0.000 ms

3.2.2. 配置主机名

确认网络畅通后需要检查和配置两节点的主机名,在RHEL6.3系统上需要用vim编辑/etc/sysconfig/network文件配置主机名,修改好的节点1的文件内容为

NETWORKING=yes

HOSTNAME=db2-node1

修改好的节点2的文件内容为

NETWORKING=yes

HOSTNAME=db2-node2

在节点12上的这个文件都修改完成后需要在两个节点配置/etc/hosts文件,要注意这两个节点上的/etc/hosts文件内容要一致,修改后的内容为:

127.0.0.1localhost.localdomainlocalhost.localdomainlocalhost4localhost4.localdomain4localhost

::1localhost.localdomainlocalhost.localdomainlocalhost6localhost6.localdomain6localhost

 

192.168.100.50db2-node1

192.168.100.51db2-node2

 

172.16.0.50db2-node1-priv

172.16.0.51db2-node2-priv

3.2.3. 修改services文件

/etc/services文件中添加DB2需要用到的一些端口的对应信息,内容如下:

db2c_db2inst150000/tcp # DB2 connections service port

DB2_db2inst1 60000/tcp

DB2_db2inst1_1 60001/tcp

DB2_db2inst1_2 60002/tcp

DB2_db2inst1_END 60003/tcp

 

3.3 配置安全终端

在配置DPF的时候需要用到rsh这个软件,这个软件需要修改/etc/securetty文件,在这个文件中添加一些内容,使系统允许rsh登陆。修改后的/etc/securetty内容如下:

console

vc/1

vc/2

vc/3

vc/4

vc/5

vc/6

vc/7

vc/8

vc/9

vc/10

vc/11

tty1

tty2

tty3

tty4

tty5

tty6

tty7

tty8

tty9

tty10

tty11

rsh

rlogin

rexec

 

3.4. 软件包

配置DPF环境首先需要安装和配置一些软件包,以满足此环境的需要。在RHEL6.3系统中推荐配置光盘源以方便安装软件。

3.4.1. 配置光盘软件源

挂载RHEL6.3系统的安装光盘到/mnt目录,然后修改/etc/yum.repos.d/rhel-source.repo文件。修改这个文件的内容为:

[rhel-source]

name=Red Hat Enterprise Linux $releasever - $basearch - Source

#baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/SRPMS/

baseurl=file:///mnt/  #只修改这行,改成光盘挂载的位置

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

 

[rhel-source-beta]

name=Red Hat Enterprise Linux $releasever Beta - $basearch - Source

baseurl=ftp://ftp.redhat.com/pub/redhat/linux/beta/$releasever/en/os/SRPMS/

enabled=0

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

 

3.4.2更新索引文件

软件源配置文件修改完成后需要更新软件源索引信息,命令为:

# yum update

 

3.4.3安装软件包

更新软件索引后需要安装用到的软件包

yum install rsh rsh-server ksh vim nfs-utils.x86_64 pam.i686 ntp.x86_64 ntpdate.x86_64 openssh-clients.x86_64  sg3_utils.x86_64 dapl.x86_64 dapl.i686 compat-dapl.x86_64 compat-dapl.i686 rdma.noarch libaio.x86_64 libaio.i686 libstdc++.x86_64 libstdc++.i686 compat-libstdc++-33.x86_64

 

3.4.4定制自启动软件包

DPF环境需要用到的软件设置成随系统启动而启动,其他软件禁止启动。设置步骤如下所示:

# chkconfig iptables off

# chkconfig ip6tables off

# chkconfig postfix off

# chkconfig rpcbind on

# chkconfig nfs on

# chkconfig nfslock on

# chkconfig netfs on

# chkconfig rsh on

# chkconfig xinetd on

# chkconfig ntp on(只在节点1上启动)

# chkconfig rdma on

3.4.5修改内核参数

echo "options mlx4_corelog_mtts_per_seg=7" >> /etc/modprobe.conf

 

3.5. 创建用户

通过如下命令创建用户

Mkdir /db2home

groupadd -g 999 db2iadm1

groupadd -g 998 db2fadm1

groupadd -g 997 dasadm1

 

useradd -u 1004 -g db2iadm1 -m -d /db2home/db2inst1 db2inst1

useradd -u 1003-g db2fadm1 -m -d /db2home/db2fenc1 db2fenc1

useradd -u 1002 -g dasadm1 -m -d /home/dasusr1 dasusr1

 

passwd db2inst1 <<EOF

12345678

12345678

EOF

 

passwd db2fenc1 <<EOF

12345678

12345678

EOF

 

passwd dasusr1 <<EOF

12345678

12345678

EOF

 

3.6. 配置rsh

Rsh需要配置信任主机以实现免密登陆,要实现这个功能需要配置一个用户配置文件。本文档中需要在实例用户db2inst1的家目录中创建.rhosts文件以达到要求。创两节点都要配置,文件内容如下:

[db2inst1@db2-node1 ~]$ cat $HOME/.rhosts

db2-node1db2inst1

db2-node2db2inst1

DB2的实例用户db2inst1的创建需要参考章节3.4

修改rsh的配置参数/etc/xinetd.d/rsh,修改成如下内容:

# default: on

# description: The rshd server is the server for the rcmd(3) routine and, \

#consequently, for the rsh(1) program.  The server provides \

#remote execution facilities with authentication based on \

#privileged port numbers from trusted hosts.

service shell

{

socket_type= stream

wait= no

user= root

log_on_success+= USERID

log_on_failure += USERID

server= /usr/sbin/in.rshd

disable= no

}

 

3.7. 配置ntp

本文档要求以节点1为时钟同步源,节点2与节点1保持时钟同步。

3.7.1. 配置时钟同步源

本章节需要在节点1上配置,修改/etc/ntp.conf文件,在次文件的第19行添加如下内容:

restrict 172.16.0.0 mask 255.255.255.0 nomodify notrap

 

3.7.2. 同步时钟

本步操作在节点2上执行,节点2需要配置一个定时任务,定时与节点1同步时钟。

*/5 * * * * /usr/sbin/ntpdate 172.16.0.50

 

3.8. 配置nfs
3.8.1配置NFS服务

在节点1上配置NFS服务,共享初一个目录。

# mkdir /db2home

# vim /etc/exportfs

/db2home *(rw,sync,no_root_squash)

# service nfs restart

# service nfslock restart

# service netfs restart

 

3.8.2挂载NFS共享

在节点2上挂载节点1共享出来的目录。

# echo “172.16.0.50:/db2home/db2homenfsrw,timeo=300,retrans=5,hard,intr,bg,hard 00

” >>/etc/fstab

# mount -a

 

3.9. 关闭SELinux

# vim /etc/sysconfig/selinux

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

#     enforcing - SELinux security policy is enforced.

#     permissive - SELinux prints warnings instead of enforcing.

#     disabled - No SELinux policy is loaded.

SELINUX=disabled

# SELINUXTYPE= can take one of these two values:

#     targeted - Targeted processes are protected,

#     mls - Multi Level Security protection.

SELINUXTYPE=targeted

到这步为止,需要重启系统。

3.10. 创建实例

通过如下命令创建实例,

# cd /opt/ibm/db2/V10.5/instance

 ./db2icrt -u db2fenc1 db2inst1

修改节点配置文件

$ vim /db2home/db2inst1/sqllib/db2nodes.cfg

0 db2-node1 0

1 db2-node1 1

2 db2-node2 0

3 db2-node2 1

上述步骤都做完后尝试启动实例

$ db2start

 

3.11. 创建数据库

$ db2 create db basedb 


0 0