千家信息网

Centos6.5 + Oracle 11g r2 + nfs如何搭建RAC环境

发表于:2024-11-29 作者:千家信息网编辑
千家信息网最后更新 2024年11月29日,本篇文章给大家分享的是有关Centos6.5 + Oracle 11g r2 + nfs如何搭建RAC环境,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小
千家信息网最后更新 2024年11月29日Centos6.5 + Oracle 11g r2 + nfs如何搭建RAC环境

本篇文章给大家分享的是有关Centos6.5 + Oracle 11g r2 + nfs如何搭建RAC环境,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。

  • 环境要求:

1.2台系统为Centos6.5的机器,其中 1台做nfs(硬盘大小至少4T)

2. 每台机器至少2块网卡

3. 准备5个可用的IP地址(一个为scan,二台配置各配置public和private地址)

4. 内存至少2G以下内存,建议使用4G或者更高

  • 地址规划:

第一台主机:rac1 网卡eth0 IP地址:172.16.0.1/24 网卡eth2地址: 192.168.1.192/24

第一台主机:rac1 网卡eth0 IP地址:172.16.0.2/24 网卡eth2: 192.168.1.193/24

虚拟IP地址:192.168.1.200

  • 关闭ntp 并配置yum的本地源

关闭服务#/etc/init.d/ntpd stop#chkconfig ntpd off#mv /etc/ntp.conf /etc/ntp.conf.org#mkdir /mnt/cdrom/#mount /dev/cdrom /mnt/cdrom/#vim /etc/yum.repos.d/CentOS-Media.reponame=CentOS-$releasever - Mediabaseurl=file:///mnt/cdrom/ gpgcheck=0enabled=1
  • 安装依赖软件包

#yum -y install binutils-2*.rpm  \    compat-libstdc++-33*.rpm  \    elfutils-libelf-0.*.rpm  \    elfutils-libelf-devel-*.rpm  \    gcc-4*.rpm  \    gcc-c++-4*.rpm  \    glibc-2.*.rpm  \    glibc-common-2*.rpm  \    glibc-devel-2*.rpm  \    libaio-0*.rpmlibgcc-4*.rpm  \    libstdc++-4*.rpm  \    libstdc++-devel*.rpm  \    make-3*.rpm  \    pdksh-*.rpm  \    sysstat-7*.rpm  \    libaio-devel-*.rpm  \    unixODBC-2*.rpm  \    unixODBC-devel-2*.rpm    \
  • 配置host文件


#vim /etc/hosts#Public 172.16.0.1 rac1-priv 172.16.0.2 rac2-priv#Virtual 192.168.1.194 rac1-vip192.168.1.195 rac2-vip #Scan 192.168.1.200 rac-scan#NAS192.168.1.194 nas1
  • 修改内核参数

#vim /etc/sysctl.conf   在最后面添加fs.aio-max-nr = 1048576fs.file-max = 6815744kernel.shmall = 2097152kernel.shmmax = 536870912kernel.shmmni = 4096kernel.sem = 250 32000 100 128net.ipv4.ip_local_port_range = 9000 65500net.core.rmem_default = 262144net.core.rmem_max = 4194304net.core.wmem_default = 262144net.core.wmem_max = 1048576#sysctl -p
  • 修改文件描述符的限制

#vi /etc/security/limits.conf oracle soft nproc 2047oracle hard nproc 16384oracle soft nofile 1024oracle hard nofile 65536grid soft nproc 2047grid hard nproc 16384grid soft nofile 1024grid hard nofile 65536
  • 添加pam_limits.so 模块

vim /etc/pam.d/login      在最后添加session required pam_limits.so
  • 添加profile环境配置文件

#vim /etc/profile            在最后添加if [ $USER = "oracle" ] || [$USER = "grid" ]; thenif [ $SHELL = "/bin/ksh" ]; thenulimit -p 16384ulimit -n 65536elseulimit -u 16384 -n 65536fiumask 022fi
  • 创建用户和组并创建相应的密码

#/usr/sbin/groupadd -g 501 oinstall#/usr/sbin/groupadd -g 502 dba#/usr/sbin/groupadd -g 503 oper#/usr/sbin/groupadd -g 504 asmadmin#/usr/sbin/groupadd -g 505 asmoper#/usr/sbin/groupadd -g 506 asmdba#/usr/sbin/useradd -g oinstall -Gdba,asmdba,oper oracle#/usr/sbin/useradd -g oinstall -Gasmadmin,asmdba,asmoper,oper,dba grid#passwd oracle#passwd grid

创建目录并设置相应权限

#mkdir -p /u01/app/oracle#chown -R oracle:oinstall /u01/app/oracle#chmod -R 775 /u01/app/oracle#mkdir -p /u01/app/oracle/product/11.2.0/db_1#chown -R oracle:oinstall/u01/app/oracle/product/11.2.0/db_1#chmod -R 775/u01/app/oracle/product/11.2.0/db_1 #mkdir -p /u01/app/grid#chown -R grid.oinstall /u01/app/grid#chmod -R 775 /u01/app/grid#mkdir -p /u01/app/11.2.0/grid#chown -R grid:oinstall /u01/app/11.2.0/grid#chmod -R 775 /u01/app/11.2.0/grid #mkdir -p /u01/app/oraInventory#chown -R grid:oinstall/u01/app/oraInventory#chmod -R 775 /u01/app/oraInventory#mkdir -p /u01/oradata#mkdir -p /u01/shared_config#chown -R oracle:oinstall /u01/oradata#chown -R grid:oinstall /u01/ shared_config#chmod -R 775 /u01/oradata/u01/shared_config
  • 修改grid用户环境变量

#su - grid$ vim /home/zkyg/.bash_profile alias df='df -h'alias du='du -sh'alias la='ls -lha'ORACLE_SID=NFS1; export ORACLE_SIDJAVA_HOME=/usr/local/java; export JAVA_HOMEORACLE_BASE=/u01/app/grid; exportORACLE_BASEORACLE_HOME=/u01/app/11.2.0/grid; exportORACLE_HOMEORACLE_PATH=/u01/app/oracle/common/oracle/sql;export ORACLE_PATHORACLE_TERM=xterm; export ORACLE_TERMNLS_DATE_FORMAT="DD-MON-YYYYHH24:MI:SS"; export NLS_DATE_FORMATTNS_ADMIN=$ORACLE_HOME/network/admin;export TNS_ADMINORA_NLS11=$ORACLE_HOME/nls/data; exportORA_NLS11PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/binPATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/binPATH=${PATH}:/u01/app/common/oracle/binexport PATHLD_LIBRARY_PATH=$ORACLE_HOME/libLD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/libLD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/libexport LD_LIBRARY_PATHCLASSPATH=$ORACLE_HOME/JRECLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlibCLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlibCLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlibexport CLASSPATHTHREADS_FLAG=native; export THREADS_FLAGexport TEMP=/tmpexport TMPDIR=/tmpumask 022
  • 修改oracle用户环境变量

alias df='df -h'alias du='du -sh'alias la='ls -lha'ORACLE_SID=racdb1; export ORACLE_SIDORACLE_UNQNAME=racdb; export ORACLE_UNQNAMEJAVA_HOME=/usr/local/java; export JAVA_HOMEORACLE_BASE=/u01/app/oracle; exportORACLE_BASEORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1;export ORACLE_HOMEORACLE_PATH=/u01/app/common/oracle/sql;export ORACLE_PATHORACLE_TERM=xterm; export ORACLE_TERMNLS_DATE_FORMAT="DD-MON-YYYYHH24:MI:SS"; export NLS_DATE_FORMATTNS_ADMIN=$ORACLE_HOME/network/admin;export TNS_ADMINORA_NLS11=$ORACLE_HOME/nls/data; exportORA_NLS11PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/binPATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/binPATH=${PATH}:/u01/app/common/oracle/binexport PATHLD_LIBRARY_PATH=$ORACLE_HOME/libLD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/libLD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/libexport LD_LIBRARY_PATHCLASSPATH=$ORACLE_HOME/JRECLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlibCLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlibCLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlibexport CLASSPATHTHREADS_FLAG=native; export THREADS_FLAGexport TEMP=/tmpexport TMPDIR=/tmpumask 022
  • 配置ssh双机信任(gird,oracle用户下都要配置)以oracle为例子

$ ssh-keygen -t rsa$ ssh-keygen -t dsa $ ssh-keygen -t rsa$ ssh-keygen -t dsa $ cat .ssh/id_rsa.pub >> .ssh/authorized_keys$ cat .ssh/id_dsa.pub >>.ssh/authorized_keys$ ssh rac2 cat .ssh/id_rsa.pub >>.ssh/authorized_keys$ ssh rac2 cat .ssh/id_dsa.pub >>.ssh/authorized_keys$ scp.ssh/authorized_keys rac2:.ssh/authorized_keys
  • 在二台机器测试是否正常

$ssh rac1 date$ssh rac2 date

以上操作需要在二台机器都要操作

  • 配置nfs

Rac1上使用fdisk /dev/sdb 分2个区sdb1、sdb2并进行格式化#mkfs.ext3 /dev/sdb1#mkfs.ext3 /dev/sdb2rac1上创建共享目录#mkdir -p /shared_config#mkdir -p /shared_data#vi /etc/fstab   添加以下:/dev/sdb1         /shared_config         ext3 defaults   0 0/dev/sdb2         /shared_data           ext3 defaults   0 0#vi /etc/exports 设置共享/shared_config    *(rw,sync,no_wdelay,insecure_locks,no_root_squash)/shared_data       *(rw,sync,no_wdelay,insecure_locks,no_root_squash)#chkconfig nfs on开启nfs服务#service nfs restart#vi /etc/fstab添加以下开机挂载共享目录nas1:/shared_config /u01/shared_config  nfs rw,bg,hard,nointr,noac,tcp,vers=3,timeo=600,rsize=32768,wsize=32768,actimeo=0  0 0nas1:/shared_data   /u01/oradata nfs  rw,bg,hard,nointr,tcp,vers=3,timeo=600,rsize=32768,wsize=32768,actimeo=0  0 0挂载相应的目录#mount /u01/shared_config#mount /u01/oradata#chown grid:oinstall /u01/shared_config#chown oracle:oinstall /u01/oradata#chmod 775 /u01/oradata#chmod 775 /u01/app/11.2.0/grid
  • 安装grid软件

unzip grid-XXX.zip在root下输入xhost +#su - grid$cd grid-XXX$./runcluvfy.sh stage-pre crsinst -n rac1,rac2 -fixup -verbose | tee check_grid.txt 如果最后提示:集群服务设置的预检查成功.可以开始去安装  grid  否则请查看失败在什么地方解决后再次执行该命令行来检查.运行安装目录下的runInstaller$./ runInstaller

以上就是Centos6.5 + Oracle 11g r2 + nfs如何搭建RAC环境,小编相信有部分知识点可能是我们日常工作会见到或用到的。希望你能通过这篇文章学到更多知识。更多详情敬请关注行业资讯频道。

0