本篇文章给大家分享的是有关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.repo name=CentOS-$releasever - Media baseurl=file:///mnt/cdrom/ gpgcheck=0 enabled=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-vip 192.168.1.195 rac2-vip #Scan 192.168.1.200 rac-scan #NAS 192.168.1.194 nas1
-
修改内核参数
#vim /etc/sysctl.conf 在最后面添加 fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = 2097152 kernel.shmmax = 536870912 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.ipv4.ip_local_port_range = 9000 65500 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576 #sysctl -p
-
修改文件描述符的限制
#vi /etc/security/limits.conf oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 grid soft nproc 2047 grid hard nproc 16384 grid soft nofile 1024 grid 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" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi umask 022 fi
-
创建用户和组并创建相应的密码
#/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_SID JAVA_HOME=/usr/local/java; export JAVA_HOME ORACLE_BASE=/u01/app/grid; exportORACLE_BASE ORACLE_HOME=/u01/app/11.2.0/grid; exportORACLE_HOME ORACLE_PATH=/u01/app/oracle/common/oracle/sql;export ORACLE_PATH ORACLE_TERM=xterm; export ORACLE_TERM NLS_DATE_FORMAT="DD-MON-YYYYHH24:MI:SS"; export NLS_DATE_FORMAT TNS_ADMIN=$ORACLE_HOME/network/admin;export TNS_ADMIN ORA_NLS11=$ORACLE_HOME/nls/data; exportORA_NLS11 PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin PATH=${PATH}:/u01/app/common/oracle/bin export PATH LD_LIBRARY_PATH=$ORACLE_HOME/lib LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib export LD_LIBRARY_PATH CLASSPATH=$ORACLE_HOME/JRE CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib export CLASSPATH THREADS_FLAG=native; export THREADS_FLAG export TEMP=/tmp export TMPDIR=/tmp umask 022
-
修改oracle用户环境变量
alias df='df -h' alias du='du -sh' alias la='ls -lha' ORACLE_SID=racdb1; export ORACLE_SID ORACLE_UNQNAME=racdb; export ORACLE_UNQNAME JAVA_HOME=/usr/local/java; export JAVA_HOME ORACLE_BASE=/u01/app/oracle; exportORACLE_BASE ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1;export ORACLE_HOME ORACLE_PATH=/u01/app/common/oracle/sql;export ORACLE_PATH ORACLE_TERM=xterm; export ORACLE_TERM NLS_DATE_FORMAT="DD-MON-YYYYHH24:MI:SS"; export NLS_DATE_FORMAT TNS_ADMIN=$ORACLE_HOME/network/admin;export TNS_ADMIN ORA_NLS11=$ORACLE_HOME/nls/data; exportORA_NLS11 PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin PATH=${PATH}:/u01/app/common/oracle/bin export PATH LD_LIBRARY_PATH=$ORACLE_HOME/lib LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib export LD_LIBRARY_PATH CLASSPATH=$ORACLE_HOME/JRE CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib export CLASSPATH THREADS_FLAG=native; export THREADS_FLAG export TEMP=/tmp export TMPDIR=/tmp umask 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/sdb2 rac1上创建共享目录 #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 0 nas1:/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环境,小编相信有部分知识点可能是我们日常工作会见到或用到的。希望你能通过这篇文章学到更多知识。更多详情敬请关注亿速云行业资讯频道。
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/203851.html