老孟 DB2 V9.7 ESE(一)产品部署 基于centOS 6.4

本文安装系统CENTOS 6.4 DB2位数64

安装中涉及目录位置各位可自行定义

生产系统为安全和性能考虑,一般将DB2实例目录、日志目录、归档日志目录、表空间目录区分开,可建立/db2home

/db2home/log

/db2home/arclog

/db2home/db


本文章安装的是DB2 ESE 就是企业版,因为后继文档还要搭建HADR,这个是有期限的,现在EXPRESS-C是免费的。


关于文档:较之前的版本来说现在好多了,提供了部分中文文档。全部的中文文档和英文文档可以打包下载:

http://www-01.ibm.com/support/docview.wss?rs=71&uid=swg27015148

网络使用不是很方便的同学,或者网速慢的同学,可以下载DB2 信息中心到本地进行安装,下载地址在上面链接中的:downloadable version of the latest DB2 Version 9.7 Information Center is also available for local installations.部分。


准备工作

准备centOS系统 64 bit:虚拟机或单独机器安装。下载地址 http://mirrors.163.com/centos/6.4/isos/x86_64/


下载DB2:访问  http://www-01.ibm.com/software/data/db2/ ,右上角输入DB2 V9.7 DOWNLOAD,查询结果中寻找下载。下载可通过HTTP或者IBM下载工具(需要安装JRE)。下载包名为 v9.7_linuxx64_server.tar.gz


安装centOS系统


上传DB2安装包至/software 目录


解压DB2安装包 gunzip  v9.7_linuxx64_server.tar.gz

tar -xvf v9.7_linuxx64_server.tar

安装前检查

进入安装目录 cd /software/server

./db2prereqcheck 进行安装前检查

这里面会主要提到两个问题

1、

WARNING:
DBT3534W  The db2prereqcheck utility determined that ASLR is set to ON and that this could cause issues with some tools.

这个是说centOS开启了内存地址随机化机制(address space layout randomization)功能,这个功能对DB2本身没有太大影响,有个别工具db2pd db2egcf 会出现异常,若有强迫症

官方解释:

DBT3534W

db2prereqcheck 实用程序确定 ASLR 设置为 ON 并且这可能导致某些工具发生问题。

说明
地址空间布局随机化 (ASLR) 缺省情况下在某些 Linux 分发上已激活。ASLR 被设计为在随机地址装入共享内存对象。
ASLR 启用后,DB2 数据库不能保证地址对共享内存对象可用。
地址空间中的此冲突意味着尝试将共享内存对象附加至特定地址的进程可能无法完成任务,从而导致 shmat 子例程失败。但是,后续使用新进程重试共享内存附加时可能会成功。结果是一组随机失败。已知会见到此错误的一些进程包括:db2pd、db2egcf 和 db2vend。
此问题可能导致的一些错误包括以下各项
db2pd 命令可能会报告找不到数据,即使实例或数据库处于活动状态。
db2egcf 进程(用于监视)可能会错误地确定实例已关闭并启动故障转移操作。
在备份和日志归档操作中,db2vend 进程可能会失败,并产生错误,指示未能启动子进程。

用户响应
通过设置以下内核参数来关闭随机化:
kernel.randomize_va_space=0
通过发出以下命令来临时禁用随机化并重新启动 DB2 实例:
echo 0 > /proc/sys/kernel/randomize_va_space
或者
sysctl -w kernel.randomize_va_space=0

上面两条命令是临时更改,重启后,该值会还原成2

要想永远对centOS关闭,则编辑/etc/sysctl.conf 文件

新增一行kernel.randomize_va_space = 0

保存退出后,运行sysctl -p 使之生效,重启后也有效了。



2、

WARNING: 
   The 32-bit library file libpam.so is not found on the system. 
这个是DB2要求的一个32位的pam库


官网解释如下

Error description
The db2prereqcheck utility was enhanced to check for libpam.so
in DB2 version 9.7 FP6 via APAR IC78338 and the validation is
done by looking up "libpam.so" (either a file or a symbolic
link) on the system. The original approach was to look up the
file libpam.so.0 on system, however this would not work on
systems with updated PAM module.  PAM module could be updated
from time to time and if we hard-coded db2prereqcheck to check
for libpam.so.0, then the check would fail on newer system where
the module might have updated to upper version like libpam.so.1.

In most case a symbolic link of libpam.so would be created to
point to latest version of libpam.so.x, hence have
db2prereqcheck to look for libpam.so (either a file or a symbol
link). This approach  was to avoid any further issue with PAM
module upgrade on affected platform. However this may not work
on older system which has libpam.so.0 only.
Local fix
Create a symbolic link named libpam.so that points to
libpam.so.0:

参考IBM官方解决方案IC87092:http://www-01.ibm.com/support/docview.wss?rs=0&q1=IC87092&uid=swg1IC87092&loc=zh_CN&cs=utf-8&lang=

大概意思就是说,DB2会找libpam.so文件,通常会找lipan.so.0,但可能涉及不定期更新,因此需要手工做个软链接到最新的文件

以下是具体操作

安装PAM包
[root@centos-0 server]# yum -y install pam.i686

到安装后生成的库文件
[root@centos-0 lib]# find / | grep libpam.so
/lib64/libpam.so.0.82.2
/lib64/libpam.so.0
/lib/libpam.so.0.82.2
/lib/libpam.so.0

对找到的SO文件用file命令测试
[root@centos-0 lib]# file /lib/libpam.so.0.82.2
/lib/libpam.so.0.82.2: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, stripped

建立符号链接
[root@centos-0 lib]# ln -s /lib/libpam.so.0.82.2 /lib/libpam.so

安装

[root@centos-0 server]# ./db2_install 
WARNING:
DBT3534W  The db2prereqcheck utility determined that ASLR is set to ON and that this could cause issues with some tools.
 
Default directory for installation of products - /opt/ibm/db2/V9.7

***********************************************************
Do you want to choose a different directory to install [yes/no] ?
no
 
 
Specify one of the following keywords to install DB2 products.

  AESE 
  ESE 
  CONSV 
  WSE 
  EXP 
  PE 
  CLIENT 
  RTCL 
 
Enter "help" to redisplay product names.

Enter "quit" to exit.

***********************************************************
ese
WARNING:
DBT3534W  The db2prereqcheck utility determined that ASLR is set to ON and that this could cause issues with some tools.
DB2 installation is being initialized.

 Total number of tasks to be performed: 48 
Total estimated time for all tasks to be performed: 1990 

Task #1 start
Description: Checking license agreement acceptance 
Estimated time 1 second(s) 
.......

Task #48 start
Description: Updating global profile registry 
Estimated time 3 second(s) 
Task #48 end 

A minor error occurred while installing "DB2 Enterprise Server Edition " on
this computer. Some features may not function correctly.

For more information see the DB2 installation log at
"/tmp/db2_install.log.17061"

ESE 一共48个步骤,最后安装完成后,有个提示:说有个较小的错误发生了,可能会影响某些功能的正常使用,这个一般没问题

具体看日志如下

Installing or updating SA MP :.......Failure
Executing control tasks :.......Success
Updating global registry :.......Success
The installation of IBM Tivoli Monitoring for Databases  failed. The log file
can be found at /opt/ibm/db2/V9.7/itma/logs/itm_install.log.

Starting DB2 Fault Monitor :.......Success
Updating the db2ls link :.......Success
Registering DB2 licenses :.......Success
Setting default global profile registry variables :.......Success
Initializing instance list :.......Success
Registering DB2 Update Service :.......Success
Updating global profile registry :.......Success
WARNING: A minor error occurred while installing "DB2 Enterprise Server Edition
" on this computer. Some features may not function correctly.


Post Install Recommendations
-----------------------------

看到了吧,就是SA MP安装失败,那么这个鸟东西是做什么的呢?为什么会失败,失败后有什么影响呢?


还是看这个日志,刚刚看的是最后方,再看看开始的地方

Target directory:                               /opt/ibm/db2/V9.7

Space required:                                 1068 MB
Install SA MP:                                  No



TSAMP_VERSION=3.2.2.1
 DBI1130E  The IBM Tivoli System Automation for Multiplatforms (SA MP)
      could not be installed or updated because system prerequisites
      were not met. See the log file /tmp/prereqSAM.log.17992 for details.

Explanation:

There are system prerequisites for installing or updating SA MP. These
prerequisites have not been met.

The mentioned log file has the details for the unsatisfied
prerequisites.

To find out more about the system prerequisites for the SA MP Base
Component, see the SA MP Base Component documentation's Installation and
Configuration Guide.

SA MP cannot be installed or updated.

User response:

Modify your system to meet the prerequisites; and use the installSAM
utility to manually install SA MP.

哦,原来SA MP 是 IBM Tivoli System Automation for Multiplatforms 缩写,再看看后面的日志文件为啥失败

prereqSAM:  OPTIONS         = '-l /tmp/prereqSAM.log.17992 --noliccheck --silent'
prereqSAM:  OPT_SILENT      = 1
prereqSAM:  OPT_NOLICCHECK  = 1
prereqSAM: Detected operating system  Linux
prereqSAM: Detected architecture  i386x
prereqSAM: Error: The following distribution is not supported
prereqSAM: Error: Prerequisite checking for the ITSAMP installation failed  Linux i386x
CentOS release 6.4 (Final)
prereqSAM: Most severe error code returned  23
prereqSAM: Unable to perform prerequisite checking

恩,是说在检查SA MP安装的时候失败,返回错误码23:

好吧,到这个时候,应该找不到问题解决了吧,别急,再仔细看看日志 ,哦?有个错误号DBI1130E

大家注意,在好的软件遇到问题的时候,第一反应要知道两个内容,错误解释和错误编号,如果有的话


官方解释如下:


这个错误消息是有关Tivoli Systems Automation (TSA) 的,对DB2的核心功能一般情况下没有什么影响。
有一种情况会产生影响,就是当做HADR的时候(就是这个 High Availability features ),当其中1台机器失败时,不能自动路由跳转到另外一台机器继续提供DB服务。


这个也是仅仅在HADR使用TSA作为跳转。如果不试用TSA组件,那么这个错误完全可以忽略不计。


如果真的需要使用TSA功能。(或者有些人实在强迫症,看不得报错?)那么可以手动执行installSAM脚本安装这个(SA MP),具体请看
Installing IBM Tivoli System Automation for Multiplatforms (SA MP) Base Component using the installSAM install script

这个链接叫:使用 installSAM 安装脚本来安装 IBM Tivoli System Automation for Multiplatforms (SA MP) Base Component ,这个就不继续往下了,Tivoli以后再说吧。


官方原文:

Technote (troubleshooting)

Problem(Abstract)
DB2 install fails with "DBI1130E The SA MP Base Component could not be installed or updated because system prerequisites were not met." error message.
Symptom
While trying to install DB2 V9.5 and later, the error message DBI1130E might be returned. Additional log file /tmp/prereqSAM.log.123456 should be available for more details.
Cause
The DBI1130E error messages is returned when some of the pre-requisites needed for installing the particular component are missing or are not installed.
Environment
Note: This technote is true only for installations of DB2 Versions 9.5 and later that have the TSA component bundled with the install.
Diagnosing the problem
The error message from the install log should read as below:
DBI1130E The SA MP Base Component could not be installed or updated
because system prerequisites were not met. See the log file
/tmp/prereqSAM.log.454724 for details.

Explanation: 
There are system prerequisites for installing or updating the IBM Tivoli
System Automation for Multiplatforms Base Component (SA MP Base
Component). These prerequisites have not been met.
The mentioned log file has the details for the unsatisfied
prerequisites.
To find out more about the system prerequisites for the SA MP Base
Component, see the Installation and Configuration Guide at
http://publib.boulder.ibm.com/tividd/td/IBMTivoliSystemAutomationforMultiplatforms2.2.html.
The SA MP Base Component cannot be installed or updated.

User response: 
Modify your system to meet the prerequisites; and use the installSAM utility to manually install the SA MP Base Component.
The /tmp/prereqSAM.log.123456 might have some failures relating to AIX packages as below:
prereqSAM: Error: The following AIX package is not installed rsct.opt.storagerm
prereqSAM: Error: Prerequisite checking for the ITSAMP installation failed AIX 6100-04
prereqSAM: Most severe error code returned 21
prereqSAM: One or more prerequisite packages were not found installed 

Note: The package name is not restricted to rsct.opt.storagerm. There might be other operating system packages mentioned in the error messages as well.

Resolving the problem
This DBI1130E error message is related to the Tivoli Systems Automation (TSA) and this is not a component that affects core DB2 functionality, as it deals with some of the more advanced High Availability features of DB2. In essence, it handles DB2's fail-over from one machine to another. If the TSA component is not going to be used, the error message can be safely ignored.
If the need to use TSA arises in future, the installSAM script can be used to manually install the component. The following link can help: 

Installing IBM Tivoli System Automation for Multiplatforms (SA MP) Base Component using the installSAM install script
To resolve this issue, install the reported operating system package mentioned in the prereqSAM.log.123456 file and re-run the installation.

Related information
DBI1130E

接下来::::验证一下许可吧

[root@centos-0 V9.7]# cd /opt/ibm/db2/V9.7/adm
[root@centos-0 adm]# ./db2licm -l
Product name:                     "DB2 Enterprise Server Edition"
License type:                     "Trial"
Expiry date:                      "02/14/2014"
Product identifier:               "db2ese"
Version information:              "9.7"

Product name:                     "DB2 Connect Server"
License type:                     "Trial"
Expiry date:                      "02/14/2014"
Product identifier:               "db2consv"
Version information:              "9.7"
90天,唉,感觉90天不够用的,去找license吧

接下来

大工告成!~

关于官方内核参数

之前V8的时候调整过参数,直到前几天看同事搭建ORACLE的时候,还是需要手动调整参数。

从9.7 FP2以后,内核参数是无需手动调整的,版本10全系列都不用调整,在DB2运行时动态计算。这个必须赞一个

但还是理解一下原来的参数设置吧。

ipcs purpose : Reports interprocess communication facility status.(个人理解是 inter process communication  status 的缩写)

lpcs -l 列出当前设置,注意这个设置在centos中是存储在/etc/sysctl.conf 文件中

# ipcs -l

      ------ Shared Memory Limits --------
      max number of segments = 4096               // SHMMNI	
      max seg size (kbytes) = 32768               // SHMMAX
      max total shared memory (kbytes) = 8388608  // SHMALL
      min seg size (bytes) = 1

      ------ Semaphore Limits --------
      max number of arrays = 1024                 // SEMMNI
      max semaphores per array = 250              // SEMMSL
      max semaphores system wide = 256000         // SEMMNS
      max ops per semop call = 32                 // SEMOPM
      semaphore max value = 32767

      ------ Messages: Limits --------
      max queues system wide = 1024               // MSGMNI
      max size of message (bytes) = 65536         // MSGMAX
      default max size of queue (bytes) = 65536    // MSGMNB

DB2 官方文档给出如下解释:

第一部分,SHMMAX 限制是 Linux 系统上共享内存段的最大大小。SHMALL 限制是系统上共享内存页的最大分配。
建议将 SHMMAX 值设置为等于系统上的物理内存量。然而,x86 系统上需要的最小内存量为 268435456 (256 MB),对于 64 位系统,需要的最小内存量为 1073741824 (1 GB)。
下一部分包括可用于操作系统的信号量。内核参数 sem 由以下四个标记组成:SEMMSL、SEMMNS、SEMOPM 和 SEMMNI。SEMMNS 是 SEMMSL 乘以 SEMMNI 的结果。数据库管理器要求在必要时增大阵列数 (SEMMNI)。通常情况下,SEMMNI 应该是系统上需要的最大代理程序数乘以数据库服务器计算机上的逻辑分区数再加上数据库服务器计算机上的本地应用程序连接数的和的两倍。
第三部分包括系统上的消息
MSGMNI 参数将影响可以启动的代理程序数;MSGMAX 参数将影响队列中可以发送的消息的大小,MSGMNB 参数将影响队列的大小。
应该将 MSGMAX 参数更改为 64 KB(即,65536 个字节),并且应该将 MSGMNB 增大到 65536。


表 2. 配置其他 Linux 内核参数
建议内核参数设置 配置 DB2 数据服务器的内核参数
vm.swappiness=0 此参数定义内核交换出物理随机存取存储器 (RAM) 中的应用程序的倾向性。缺省设置为vm.swappiness=60。建议的内核参数设置 vm.swappiness=0 会配置内核以优先将应用程序内存保留在 RAM 中,而不是为文件高速缓存分配更多内存。此设置可避免不必要的调页和交换空间的过度使用。对于配置为使用自调整内存管理器 (STMM) 的数据服务器而言,此设置尤其重要。
vm.overcommit_memory=0 此参数影响内核允许分配的虚拟内存量。缺省设置 vm.overcommit_memory=0 将内核设置为不允许单个进程进行过大的内存分配,但分配的总虚拟内存不受限制。对于为动态内存管理保留额外的未使用虚拟内存分配的 DB2 数据服务器而言,具有无限制的虚拟内存十分重要。在 Linux 系统上,未被引用的已分配内存不会由 RAM 或调页空间进行备份。应避免设置vm.overcommit_memory=2,因为此设置会限制可分配的总虚拟内存量,这会导致意外错误。
kernel.randomize_va_space=0 此参数配置内核使用内存地址空间布局随机化。将该值设置为 0 (kernel.randomize_va_space=0) 可禁用地址空间布局随机化。DB2 数据服务器依赖特定共享内存对象的固定地址,地址空间布局随机化会导致有些活动发生错误。有关其他信息,请参阅技术说明 #1365583。(看到这个没??这个就是开始那个检查的时候报 ASLR 的具体解释)




  • 4
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值