您好,登錄后才能下訂單哦!
本篇文章給大家分享的是有關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環境,小編相信有部分知識點可能是我們日常工作會見到或用到的。希望你能通過這篇文章學到更多知識。更多詳情敬請關注億速云行業資訊頻道。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。