zoukankan      html  css  js  c++  java
  • db2 v11 安装测试

    一、准备环境:

    介质: db2 v11 redhat7.3

    关闭selinux

    #setenforce 0 #vi /etc/selinux/config 修改如下: SELINUX=disabled
    #重启生效

    vim /etc/yum/pluginconf.d/subscription-manager.conf

    enabled=0 #将它禁用掉

    配置本地yum

    安装db2所需系统包

    Validating "/lib/libpam.so*" ...
    DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: "/lib/libpam.so*".
    WARNING : Requirement not matched.
    Requirement not matched for DB2 database "Server" with pureScale feature . Version: "11.1.3.3".
    Summary of prerequisites that are not met on the current system:
    DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: "/lib/libpam.so*".

    DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: "libstdc++.so.6".

    Required minimum version for "ksh": "20100621"
    Actual version is undetermined

    DBT3507E The db2prereqcheck utility failed to find the following package or file: "kernel-devel".

    DBT3507E The db2prereqcheck utility failed to find the following package or file: "gcc-c++".

    DBT3507E The db2prereqcheck utility failed to find the following package or file: "cpp".

    DBT3507E The db2prereqcheck utility failed to find the following package or file: "gcc".

    DBT3563E The db2prereqcheck utility determined that SELinux is enabled, which is not supported with GPFS.

    yum install libstdc++.i686

    yum install pam-devel.i686

    yum groupinstall 'Infiniband Support'

    yum install gcc 
    yum install cpp
    yum install gcc-c++
    yum install kernel-devel
    yum install ksh
    yum install ntp
    yum install sg3_utils
    yum install libstdc++.so.6
    yum install pam32*
    yum install libcxgb*
    yum install m4
    yum install binutils-devel
    yum install patch

    提示libstdc++.so.5 is needed by 需要安装 包含 libstdc .so.5 的 compat-stdlibc rpm

    rpm -ivh compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm

    rpm -ivh compat-libstdc++-33-3.2.3-72.el7.i686.rpm

    
    

      修改/etc/hosts如下配置:

      #vi /etc/hosts

      127.0.0.1    localhost

    修改系统内核参数
    
    # vi /etc/sysctl.conf
    
    kernel.shmmax = 137438953472    --设置为物理内存的一半或稍大
    
    kernel.shmall = 67108864
    
    kernel.shmmni = 4096
    
    kernel.sem = 250 32000 100 128
    
    fs.file-max = 65536
    
    net.ipv4.ip_local_port_range = 1024 65000

    net.core.rmem_default=262144

    net.core.rmem_max=262144
    net.core.wmem_default=262144
    net.core.wmem_max=262144
    
    
    二、安装DB2软件
    root用户执行

    df -h 确保空间大小满足条件

    vi /etc/security/limits

    除notice之外设置参数为-1

    mkdir /tmp/db2v11

    chown db2inst1:db2iadm1 /tmp/db2v11

    上传介质

    chmod -R 777 /tmp/db2v11

    gzip -d product.tar.gz

    tar xvf
    product.tar

    安装前验证 参考官网 https://www.ibm.com/docs/en/db2/11.1?topic=servers-linux

    ./db2prereqcheck

    安装
    ./db2_install
    
    安装目录,选择推荐目录即可(可以修改目录,如果不修改/预留大小为6G)
    
    Enter "help" to redisplay product names. --------------- 选择安装产品类型,这里选择SERVER
    Do you want to install the DB2 pureScale Feature? [yes/no] ---------------- 选择是否安装pureScale功能,这里选择不安装
    
    生成如下目录
    /opt/ibm/db2/V11.1
    
    /tmp/生成install日志,查看并确认

    三、创建Instance

    1. 创建DB2实例                        
        以下操作全部以root用户执行                    
        groupadd db2iadm1                    
        groupadd db2fadm1                    
                            
        useradd db2inst1 -G db2iadm1                    
        passwd db2inst1                    
        Changing password for user db2inst1.                    
        New password: input your password                    
        Retype new password: retype input your password                    
                            
        useradd db2fenc1 -G db2fadm1                    
        cd /opt/ibm/db2/V11.1/instance/                    
        ./db2icrt -a server -p 50000 -u db2fenc1 db2inst1                    
                            
        开放端口50000,以便用户可以访问                    
        firewall-cmd --zone=public --add-port=50000/tcp --permanent                    
        systemctl stop firewalld.service                    
        systemctl start firewalld.service            
    2. 激活license                                        
        以下操作全部以db2inst1用户执行                                    
        查看license信息                                    
        db2licm -l                                    
                                            
        license激活                                    
        db2licm -a /usr/local/src/db2ese_c.lic
    
    
    方式二 指定 用户ID和密码
    创建用户和组 用户用途 用户名 用户组 实例所有者 db2inst1 db2iadm1 受防护的用户 db2fenc1 db2fadm1 # groupadd
    -g 1011 db2iadm1 # groupadd -g 1012 db2fadm1 # useradd -u 1013 -g db2iadm1 -d /home/db2inst1 -m db2inst1 # useradd -u 1014 -g db2fadm1 -d /home/db2fenc1 -m db2fenc1 # echo 'db2inst1' |passwd --stdin db2inst1 # echo 'db2fenc1' |passwd --stdin db2fenc1

    #cd /opt/ibm/db2/V11.1/instance
    #./db2icrt -a server -p 50000 -u db2fenc1 db2inst1

    The execution completed successfully.

    For more information see the DB2 installation log at "/tmp/db2icrt.log.9503".
    DBI1070I Program db2icrt completed successfully.

    2. 激活license                                        
        以下操作全部以db2inst1用户执行                                    
        查看license信息                                    
        db2licm -l                                    
                                            
        license激活                                    
        db2licm -a /usr/local/src/db2ese_c.lic                                     
    创建DB文件系统并赋权给用户db2inst1
    
    
    # chown db2inst1:db2iadm1 /data
    
    # chown db2inst1:db2iadm1 /db2log
    
    # chown db2inst1:db2iadm1 /db2arch

    四、配置并启动Instance

    
    

    # /opt/ibm/db2/V11.1/instance/db2ilist

    
    

    db2inst1

    (1)  修改db2nodes.cfg

    位置在instance用户的$HOME/sqllib/.文件格式是:

    <logic port> <hostname> <logic port>     //主机名要与/etc/hosts 的主机名一致 或hostname命令查看

    0 r201 0

    1 r201 1

    (2)  检查services文件(多节点配置自动生成多个服务端口)

    vi  /etc/services    -G 跳到最后一行

    #DB2c_db2inst1   50000/tcp      // 要与dbm SVCENAME一致

     

    (3) 启动实例:  --切换到db2inst1用户

    配置环境变量  --root用户和db2inst1用户

    # vi ~/.bash_profile

    $ vi ~/.bash_profile

    ./home/db2inst1/sqllib/db2profile  # 增加该行代码

    # source ~/.bash_profile

    $ source ~/.bash_profile

    设置服务名称

    $ db2 update dbm cfg using SVCENAME db2inst1

    设置注册变量

    $ db2set DB2COMM=tcpip

    启动实例

    $ db2start

    
    

    五、创建DB

    $ db2 "create db RESDB on /oradata4 using codeset UTF-8 territory cn"
    
    DB20000I  The CREATE DATABASE command completed successfully.
    
    批注:创建数据库时若为指定路径,将使用默认路径,数据库用户的家目录,如下查看:
    
    $ db2 get dbm cfg | grep -i DFTDBPATH
    
     Default database path                       (DFTDBPATH) = /home/db2inst1
    
    9.参数调整

    $ db2 connect to resdb

    $ db2iauto -on db2inst1   --设置数据库实例开机自启动

    9.1参数调整

    $ db2 update dbm cfg using SVCENAME 9999 DFT_MON_BUFPOOL on DFT_MON_UOW on NUM_POOLAGENTS 4100

    DB20000I  The UPDATE DATABASE MANAGER CONFIGURATION command completed successfully.

    SQL1362W  One or more of the parameters submitted for immediate modification

    were not changed dynamically. Client changes will not be effective until the

    next time the application is started or the TERMINATE command has been issued.

    Server changes will not be effective until the next DB2START command.

    批注:需要重启数据库生效

    9.2日志调整

    --日志位置和大小调整

    $ db2 update db cfg for RESDB using NEWLOGPATH /db2log

    $ db2 update db cfg for RESDB using LOGARCHMETH1 disk:/db2arch

    $ db2 update db cfg for RESDB using LOGFILSIZ 25600 LOGPRIMARY 13 LOGSECOND 12  CATALOGCACHE_SZ 2048 LOGBUFSZ 4096 UTIL_HEAP_SZ 10240 DB_MEM_THRESH 100 DLCHKTIME 5000 LOCKTIMEOUT 15

    9.3其他参数调整

    db2set DB2_PARALLEL_IO=*

    db2set DB2_SKIPINSERTED=YES

    db2set DB2_USE_ALTERNATE_PAGE_CLEANING=YES

    db2set DB2_EVALUNCOMMITTED=YES

    db2set DB2_ANTIJOIN=EXTEND

    db2set DB2_SKIPDELETED=YES

    db2set DB2CODEPAGE=1208

    参数调整完毕,数据库重启:

    $ db2stop

    01/23/2017 13:48:24     0   0   SQL1025N  The database manager was not stopped because databases are still active.

    SQL1025N  The database manager was not stopped because databases are still active.

    $ db2 force application all

    DB20000I  The FORCE APPLICATION command completed successfully.

    DB21024I  This command is asynchronous and may not be effective immediately.

    $ db2stop

    01/23/2017 13:49:39     0   0   SQL1064N  DB2STOP processing was successful.

    SQL1064N  DB2STOP processing was successful.

    $ db2start

    01/23/2017 13:50:13     0   0   SQL1063N  DB2START processing was successful.

    SQL1063N  DB2START processing was successful.

    此时需要调整/etc/security/limits.conf配置文件
    
    db2list1  soft nofile 65536
    
    db2inst1  hard nofile 65536
    
    db2inst1  soft nproc  65536
    
    db2inst1  hard nproc  65536
  • 相关阅读:
    shell编程学习笔记(七):Shell中将指定内容输出到文件中
    shell编程学习笔记(六):cat命令的使用
    shell编程学习笔记(五):Shell中脚本的参数
    shell编程学习笔记(四):Shell中转义字符的输出
    shell编程学习笔记(三):Shell中局部变量的使用
    shell编程学习笔记(二):Shell中变量的使用
    shell编程学习笔记(一):编写我的第一段代码
    VMware DHCP Service服务无法启动问题的解决
    Jmeterr修改显示字体大小
    jenkins流水线pipeline脚本实例
  • 原文地址:https://www.cnblogs.com/dahaoran/p/9191748.html
Copyright © 2011-2022 走看看