WINDOWS下的程序员出身,偶尔也写一些linux平台下小程序, 后转行数据库行业,专注于ORACLE和DB2的运维和优化。 同时也是ios移动开发者。欢迎志同道合的朋友一起研究技术。 数据库技术交流群:58308065,23618606
全部博文(599)
分类: Oracle
2009-12-17 21:14:29
本文将通过示例演示,对现有的RAC数据库环境增加节点的相关操作。这里我们的操作基于一套双节点的RAC环境。
在本文正式开始前,俺先假设要添加的节点已安装好操作系统;内核参数已经进行修改;ORACLE用户已初始化;成功并正确的配置和共享存储;相关rpm包均已安装;与当前RAC环境中各节点互联互通等等吧。
即使是添加节点,那么首先就需要对新节点进行适当的配置,以使其能够满足成为RAC环境中一员的需要。
执行命令如下:
修改hosts文件中的内容,修改完成后,hosts文件中至少包含下列的内容:
192.168.10.11 jssdbn1
192.168.10.12 jssdbn2
192.168.10.13 jssdbn3
192.168.10.21 jssdbn1-vip
192.168.10.22 jssdbn2-vip
192.168.10.23 jssdbn3-vip
10.10.10.101 jssdbn1-priv
10.10.10.102 jssdbn2-priv
10.10.10.103 jssdbn3-priv注意,这里不仅新增加的节点中hosts文件需要修改,同一个RAC环境中所有节点的hosts文件都必须重新修改。
RAC 环境中各节点间不仅时刻保持通讯,而且还有可能互访文件,因此必须要保证各节点间访问不需输入DBA手动密码即可自动完成,这里我们通过配置SSH来实现这一点。首先是在新增加的节点时操作,即jssdbn3节点(注意执行命令的用户):
[root@jssdbn3 ~]# su - oracle
[oracle@jssdbn3 ~]$ mkdir ~/.ssh
[oracle@jssdbn3 ~]$ chmod 700 ~/.ssh
[oracle@jssdbn3 ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_rsa.
Your public key has been saved in /home/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
37:89:ec:6a:49:2d:18:5d:9d:c2:7c:66:84:b0:2e:94 oracle@jssdbn3
[oracle@jssdbn3 ~]$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_dsa.
Your public key has been saved in /home/oracle/.ssh/id_dsa.pub.
The key fingerprint is:
43:f1:b1:9f:e6:ec:b5:b0:74:72:24:22:22:5c:24:ca oracle@jssdbn3然后转至jssdbn1节点执行,也是以oracle身份进行操作(执行过程中,当访问远端节点时可能需要输入目标节点的密码):
[oracle@jssdbn1 ~]$ ssh jssdbn3 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
The authenticity of host 'jssdbn3 (192.168.10.13)' can't be established.
RSA key fingerprint is 95:23:18:7a:5b:a9:5f:48:d7:1e:1a:f9:01:ec:f0:b1.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'jssdbn3,192.168.10.13' (RSA) to the list of known hosts.
oracle@jssdbn3's password:
[oracle@jssdbn1 ~]$ ssh jssdbn3 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
oracle@jssdbn3's password:最后传输jssdbn1节点中配置好的认证密钥信息到节点2和节点3,执行命令如下:
[oracle@jssdbn1 ~]$ scp ~/.ssh/authorized_keys jssdbn2:~/.ssh/authorized_keys
authorized_keys 100% 3000 2.9KB/s 00:00
[oracle@jssdbn1 ~]$ scp ~/.ssh/authorized_keys jssdbn3:~/.ssh/authorized_keys
oracle@jssdbn3's password:
authorized_keys 100% 3000 2.9KB/s 00:00配置完成后,在三个节点分别执行下列命令:
ssh jssdbn1 date
ssh jssdbn2 date
ssh jssdbn3 date
ssh jssdbn1-priv date
ssh jssdbn2-priv date
ssh jssdbn3-priv date某些节点第一次执行上述某些命令时可能会提示输入目标节点的密码,没有关系,输入就是。不过执行过一次之后,应该就不会再需要输入密码了,如果多次尝试调用命令,仍然提示输入密码,则有可能前面的步骤配置有误,尝试重新对ssh密钥进行配置。
最终执行的结果,应该类似这样,能够直接看到返回信息:
[oracle@jssdbn3 ~]$ ssh jssdbn1 date
Mon Nov 9 12:54:47 CST 2009
[oracle@jssdbn3 ~]$ ssh jssdbn2 date
Mon Nov 9 12:54:48 CST 2009
[oracle@jssdbn3 ~]$ ssh jssdbn3 date
Mon Nov 9 12:54:49 CST 2009
[oracle@jssdbn3 ~]$ ssh jssdbn1-priv date
Mon Nov 9 12:54:56 CST 2009
[oracle@jssdbn3 ~]$ ssh jssdbn2-priv date
Mon Nov 9 12:54:59 CST 2009
[oracle@jssdbn3 ~]$ ssh jssdbn3-priv date
Mon Nov 9 12:54:58 CST 2009在新增的节点上配置ORACLE ASM驱动,首先执行oracleasm configure命令,注意要以root身份进行。
[root@jssdbn3 ~ ]# /etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting
answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface []: oracle
Default group to own the driver interface []: dba
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver: [ OK ]
Scanning the system for Oracle ASMLib disks: [ OK ]提示:如果本步执行出错(可能出错机率最高的是在Scanning system for ASM),不妨将转换一下命令行的执行方式,改成:
[root@jssdbn3 ~]# sh /etc/init.d/oracleasm configure
有可能解决你的问题!如果configure执行正常,下面检查一下磁盘组:
[root@jssdbn3 Server]# /etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks: [ OK ]如无问题,再接着listdisks,应该能够看到当前RAC环境中创建的ASM盘:
[root@jssdbn3 Server]# /etc/init.d/oracleasm listdisks
VOL1
VOL2确保上述oracleasm listdisks显示的结果与实际情况相同。新节点的配置基本告以段落,下面准备开始安装crs喽。