这里规划三台虚拟机,每台虚机两个网卡:一个用于public ip ,一个用于private ip
[root@racdb02 ~]# ifconfig|grep eth
eth3 Link encap:Ethernet HWaddr 00:50:56:A3:6D:C0
eth4 Link encap:Ethernet HWaddr 00:50:56:A3:56:24
整体的网卡,我这样去设计:
# public ip
10.100.21.200 racdb01 racdb01.hdp.com
10.100.21.202 racdb03 racdb03.hdp.com
10.100.21.205 racdb02 racdb02.hdp.com
# private ip
172.16.6.30 racdb01-pri racdb01-pri.hdp.com
172.16.6.31 racdb03-pri racdb03-pri.hdp.com
172.16.6.32 racdb02-pri racdb02-pri.hdp.com
# vip
10.100.21.201 racdb01-vip racdb01-vip.hdp.com
10.100.21.203 racdb03-vip racdb03-vip.hdp.com
10.100.21.206 racdb02-vip racdb02-vip.hdp.com
# scan ip
10.100.21.204 racdb-scan racdb-scan.hdp.com
在每个节点测试下 public ip 以及 private ip 的连通性
cat /etc/sysctl.conf
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
kernel.shmmax 上面的配置已经是4T,不用担心内存分段交换的问题了
vim /etc/security/limits.conf
grid soft nofile 1024
grid hard nofile 65536
grid soft nproc 2047
grid hard nproc 16384
grid soft stack 10240
grid hard stack 32768
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
也可以通过用户组的形式来制定限制
@oinstall soft nofile 1024
@oinstall hard nofile 65536
@oinstall soft nproc 2047
@oinstall hard nproc 16384
@oinstall soft stack 10240
@oinstall hard stack 32768
在 /etc/pam.d/login 的 行末,加上
session required /lib/security/pam_limits.so
系统参数的修改到此为止:
用户与组的设置:
可能需要用到的组
DB 必须
/usr/sbin/groupadd -g 54321 oinstall
/usr/sbin/groupadd -g 54322 dba
/usr/sbin/groupadd -g 54323 oper
RAC
/usr/sbin/groupadd -g 54324 backupdba
/usr/sbin/groupadd -g 54325 dgdba
/usr/sbin/groupadd -g 54327 asmdba
/usr/sbin/groupadd -g 54328 asmoper
/usr/sbin/groupadd -g 54329 asmadmin
用户的设置
/usr/sbin/useradd -u 54321 -g oinstall -G asmadmin,asmdba,asmoper,dba grid
/usr/sbin/useradd -u 54322 -g oinstall -G dba,backupdba,dgdba,asmadmin,asmdba,oper oracle
如果用户已经存在
/usr/sbin/usermod -u 54322 -g oinstall -G dba,backupdba,dgdba,asmadmin,asmdba,oper oracle
确认用户身份:
[root@racdb01 network-scripts]# id oracle
uid=54322(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54327(asmdba),54329(asmadmin)
[root@racdb01 network-scripts]# id grid
uid=54321(grid) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54327(asmdba),54328(asmoper),54329(asmadmin)
统一设置用户密码:
passwd oracle
passwd grid
安装RPM包:
安装时ORACLE会提示,根据提示搭建YUM源安装所需要的RPM包即可。DBA能被装个包吓到,那就可笑了。在此不再赘述。
安装路径:
– 安装生成的文件,如集群的预警日子,监听的日志,
–存放grid用户的命令和脚本
mkdir -p /u01/app/grid_base
mkdir -p /u01/app/11.2.0/grid
oracle_home
mkdir -p /u01/app/oracle/product/11.2.0/dbhome_1
权限的设置
chown -R grid:oinstall /u01
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01
安装好后 目录的权限示意图大概是这个样子的:
[root@racdb01 app]# ll
total 12
drwxrwxr-x 3 grid oinstall 4096 Sep 15 12:02 11.2.0
drwxrwxr-x 2 grid oinstall 4096 Sep 15 12:02 grid_base
drwxrwxr-x 3 oracle oinstall 4096 Sep 15 12:02 oracle
环境变量的设置
设计如下: 其中hostname 和 oracle_sid 根据节点自己去设计和修改
oracle:
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=racdb01
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=orcl1
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export NLS_LANG=AMERICAN_AMERICA.UTF8
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
grid:
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=racdb01
export ORACLE_BASE=/u01/app/grid_base
export ORACLE_HOME=/u01/app/11.2.0/grid
export ORACLE_SID=+ASM1
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export NLS_LANG=AMERICAN_AMERICA.UTF8
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib