| var $tag=''; var $tag_code='b488db90078acf03e62a851dd7f0657b'; var $r_quote_bligid='4cbd76e501000b39'; var $worldcup='0'; var $worldcupball='0'; | 分类: oracle_rac |
在集群中的两个 Oracle RAC 节点上执行以下配置过程!
在可以安装并使用 Oracle 真正应用集群之前,您必须为所有集群节点上的“oracle”UNIX 用户帐户配置安全 shell (RSH) 或远程 shell (RSH)。此处的目的是为“oracle”UNIX 用户帐户设置用户等效性。利用用户等效性 (User equivalence),“oracle”UNIX 用户帐户无需口令就可访问集群中的所有其他节点(运行命令和复制文件)。使用 SSH 或 RSH(其中 SSH 是首选方法)都可实现此配置。Oracle 在 10g 第 1 版中增加了将 SSH 工具套件用于设置用户等效项的支持。在 Oracle10g 之前,用户等效性必须使用远程 shell 进行配置。 注意,如果 10g 中的 Oracle Universal Installer 没有检测出存在安全 shell 工具(ssh 和 scp),那么它将尝试使用远程 shell 工具(rsh 和 rcp)。那么,我们为什么必须设置用户等效性?安装 Oracle 集群件和 Oracle 数据库软件只在 RAC 集群中的一个节点上进行。在特定节点上运行 Oracle Universal Installer (OUI) 时,它将使用 ssh 和 scp 命令(如果使用远程 shell,则用 rsh 和 rcp 命令)在集群内的所有其他节点上运行远程命令并向这些节点复制文件(Oracle 软件)。运行 OUI (runInstaller) 的节点上的“oracle”UNIX 用户帐户必须受到您的 RAC 集群中其他所有节点的信任。这意味着,相对于集群中的所有其他 Linux 服务器,您必须能够在要从其中运行 OUI 的 Linux 服务器上运行安全 shell 命令(ssh 或 scp)或远程 shell 命令(rsh 和 rcp),而不会收到输入口令的提示。 注意,普通 RAC 操作无需使用安全 shell 或远程 shell。然而,对于 RAC 和补丁集安装以及创建集群数据库时,必须启用该配置。第一步是确定使用哪种远程访问方法 — 安全 shell 还是远程 shell。二者各有利弊。例如,远程 shell 非常易于安装和配置。它的构造只需很少的几步,并当登录到受信任的节点(要从其中执行安装的节点)后,其在终端会话中始终可用。然而,在安装和任何修补过程中,到远程节点的连接不安全。另一方面,安全 shell 可在安装和修补时提供安全连接,但是设置步骤繁琐。此外,每次 oracle 用户登录到受信任的节点后,都需要在终端会话中启用该方法。官方 Oracle 文档仅给出了设置安全 shell 的步骤,并将其作为首选方法。在以下两个部分对于配置用户等效性的这两种方法进行了介绍:要确定是否 SSH 已安装并运行,可输入以下命令:
# pgrep sshd如果 SSH 正在运行,那么该命令的响应将是一个进程 ID 编号(一个或多个)列表。请在集群中的两个 Oracle RAC 节点上运行该命令,以验证 SSH 后台程序已安装并正在运行!要了解更多有关 SSH 的信息,请参阅以下 man 页:
2808
# man ssh在两个 Oracle RAC 节点上创建 RSA 和 DSA 密钥
使用以下步骤创建 RSA 和 DSA 密钥对。请注意,集群中的两个 Oracle RAC 节点上均需要完成这些步骤:
# su - oracle
$ mkdir -p ~/.ssh
$ chmod 700 ~/.ssh
$ /usr/bin/ssh-keygen -t rsa在提示符下:
该命令会将公共密钥写入 ~/.ssh/id_rsa.pub 文件,将私有密钥写入 ~/.ssh/id_rsa 文件。注意,始终不要将密钥分发给任何人!
$ /usr/bin/ssh-keygen -t dsa在提示符下:
该命令会将公共密钥写入 ~/.ssh/id_dsa.pub 文件,将私有密钥写入 ~/.ssh/id_dsa 文件。注意,始终不要将密钥分发给任何人!
现在,每个 Oracle RAC 节点都包含用于 RSA 和 DSA 的公共和私有密钥,您需要在其中一个节点上创建一个授权密钥文件。授权密钥文件只是一个包含每个人(每个节点)的 RSA 和 DSA 公共密钥的文件。在授权密钥文件包含了所有公共密钥后,将其分发至集群中的所有其他节点。
在集群中的其中一个节点上完成以下步骤,然后分发授权密钥文件。考虑到本文的目的,我将使用 linux1:
$ touch ~/.ssh/authorized_keys以上的列表应当显示前一部分中创建的 id_rsa.pub 和 id_dsa.pub 公共密钥。
$ cd ~/.ssh
$ ls -l *.pub
-rw-r--r--
-rw-r--r-- 1 oracle dba 223 Aug 31 23:36 id_rsa.pub
以下示例将从 linux1 运行,假设这是个双节点集群,即节点 linux1 和 linux2:
$ ssh linux1 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys注:第一次使用 SSH 从特定系统连接到节点时,您可能会看见一条类似下面的消息:
The authenticity of host 'linux1 (192.168.1.100)' can't be established.
RSA key fingerprint is 61:8a:f9:9e:28:a2:b7:d3:70:8d:dc:76:ca:d9:23:43.
Are you sure you want to continue connecting (yes/no)? yes
Warning:Permanently added 'linux1,192.168.1.100' (RSA) to the list of known hosts.
oracle@linux1's password:xxxxx
$ ssh linux1 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
Enter passphrase for key '/u01/app/oracle/.ssh/id_rsa':xxxxx
$ ssh linux2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
The authenticity of host 'linux2 (192.168.1.101)' can't be established.
RSA key fingerprint is 84:2b:bd:eb:31:2c:23:36:55:c2:ee:54:d2:23:6a:e4.
Are you sure you want to continue connecting (yes/no)? yes
Warning:Permanently added 'linux2,192.168.1.101' (RSA) to the list of known hosts.
oracle@linux2's password:xxxxx
$ ssh linux2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
oracle@linux2's password:xxxxx
The authenticity of host 'linux1 (192.168.1.100)' can't be established.在提示符下输入 yes 进行确认。如果从该系统连接到相同的节点,您将不会再次看到该消息。
RSA key fingerprint is 61:8a:f9:9e:28:a2:b7:d3:70:8d:dc:76:ca:d9:23:43.
Are you sure you want to continue connecting (yes/no)? yes
$ scp ~/.ssh/authorized_keys linux2:.ssh/authorized_keys
oracle@linux2's password:xxxxx
authorized_keys 100% 1652 1.6KB/s 00:00
$ chmod 600 ~/.ssh/authorized_keys
$ ssh linux1 hostname注:如果除主机名外,您还看到任何其他消息或文本,则 Oracle 安装可能失败了。进行必要的更改,以确保您在输入这些命令时只有主机名显示。您应当确保修改生成任何输出或询问任何问题的登录脚本(一个或多个)的任何部分,以便它们仅当 shell 是交互式 shell 时生效。
Enter passphrase for key '/u01/app/oracle/.ssh/id_rsa':xxxxx
linux1
$ ssh linux2 hostname
Enter passphrase for key '/u01/app/oracle/.ssh/id_rsa':xxxxx
linux2
# su - oracle
$ exec /usr/bin/ssh-agent $SHELL $ /usr/bin/ssh-add Enter passphrase for /u01/app/oracle/.ssh/id_rsa:xxxxx Identity added:/u01/app/oracle/.ssh/id_rsa (/u01/app/oracle/.ssh/id_rsa) Identity added:/u01/app/oracle/.ssh/id_dsa (/u01/app/oracle/.ssh/id_dsa)在提示符下,为生成的每个密钥输入口令短语。
$ ssh linux1 "date;hostname" Mon Jun 25 18:24:23 EDT 2007 linux1 $ ssh linux2 "date;hostname" Mon Jun 25 18:26:15 EDT 2007 linux2注:以上命令应显示两个 Oracle RAC 节点上设置的日期及其主机名。如果任何节点提示输入口令或口令短语,则验证位于该节点上的 ~/.ssh/authorized_keys 文件是否包含正确的公共密钥。此外,如果除日期和主机名外,您还看到其他任何消息或文本,则 Oracle 安装可能失败了。进行必要的更改,以确保您在输入这些命令时只有日期显示。您应当确保修改生成任何输出或询问任何问题的登录脚本(一个或多个)的任何部分,以便它们仅当 shell 是交互式 shell 时生效。
Bourne、Korn 和 Bash shell:
$ DISPLAY=C shell::0
$ export DISPLAY
$ setenv DISPLAY将 DISPLAY 变量设置为有效的 X 窗口显示后,您应当执行当前终端会话的另一个测试,以确保 X11 forwarding 没有启用::0
$ ssh linux1 hostname linux1 $ ssh linux1 hostname linux2注:如果您使用远程客户端来连接到执行安装的节点,则会看到类似下面的消息:"Warning:No xauth data; using fake authentication data for X11 forwarding.”,这意味着您的授权密钥文件配置正确,但是,您的 SSH 配置启用了 X11 forwarding。例如:
$ export DISPLAY=melody:0注意,启用 X11 Forwarding 将导致 Oracle 安装失败。要纠正这个问题,需为禁用 X11 Forwarding 的“oracle”UNIX 用户帐户创建一个用户级 SSH 客户端配置文件:
$ ssh linux2 hostname
Warning:No xauth data; using fake authentication data for X11 forwarding.
linux2
Host *
ForwardX11 no
要避免该问题,您必须修改这些文件以取消所有关于 STDERR 的输出,如下所示:
if [ -t 0 ]; then
stty intr ^C
fi
test -t 0
if ($status == 0) then
stty intr ^C
endif
注:如果由远程 shell 加载的隐藏文件包含 stty 命令,则 OUI 将指示错误并停止安装。
rsh 后台程序使用位于用户(oracle 的)主目录中的 /etc/hosts.equiv 文件或 .rhosts 文件验证用户。
首先,确保集群中的两个 Oracle RAC 节点上都安装了 rsh RPM:
# rpm -q rsh rsh-server rsh-0.17-25.4 rsh-server-0.17-25.4根据以上信息,我们可以确认已经安装了 rsh 和 rsh-server。如果未安装 rsh,则可以从 RPM 所在的 CD 中运行以下命令:
# su - # rpm -ivh rsh-0.17-25.4.i386.rpm rsh-server-0.17-25.4.i386.rpm
要启用“rsh”和“rlogin”服务,必须将 /etc/xinetd.d/rsh 文件中的“disable”属性设置为“no”并且必须重新加载 xinetd。这可通过在集群中的所有节点上运行以下命令来完成:
# su -要使“oracle”UNIX 用户帐户在 RAC 节点中获得信任,在集群中的所有节点上创建 /etc/hosts.equiv 文件:
# chkconfig rsh on # chkconfig rlogin on # service xinetd reload Reloading configuration:[ OK ]
# su - # touch /etc/hosts.equiv # chmod 600 /etc/hosts.equiv # chown root.root /etc/hosts.equiv现在,将所有 RAC 节点添加到集群中类似于以下示例的两个 Oracle RAC 节点的 /etc/hosts.equiv 文件中:
# cat /etc/hosts.equiv +linux1 oracle +linux2 oracle +linux1-priv oracle +linux2-priv oracle注:在以上示例中,第二个字段只允许 oracle 用户帐号在所指定的节点上运行 rsh 命令。由于安全原因,/etc/hosts.equiv 文件应该由 root 所拥有,并应该将权限设置为 600。实际上,某些系统只有在该文件的所有者为 root 并且权限被设置为 600 时才接受此文件的内容。 尝试测试 rsh 命令前,确保使用的是正确版本的 rsh。在默认情况下,Red Hat Linux 将 /usr/kerberos/sbin 放在 $PATH 变量的前面。这会导致执行 rsh 的 Kerberos 版本。
我通常会重命名 rsh 的 Kerberos 版本,以便使用正常的 rsh 命令。使用以下命令:
# su -
# which rsh
/usr/kerberos/bin/rsh
# mv /usr/kerberos/bin/rsh /usr/kerberos/bin/rsh.original
# mv /usr/kerberos/bin/rcp /usr/kerberos/bin/rcp.original
# mv /usr/kerberos/bin/rlogin /usr/kerberos/bin/rlogin.original
# which rsh
/usr/bin/rsh
现在,应从将要执行 Oracle 集群件和 10g RAC 安装的节点测试连接并运行 rsh 命令。我将使用节点 linux1 执行所有安装,因此我将从该节点运行以下命令:
# su - oracle $ rsh linux1 ls -l /etc/hosts.equiv -rw------- 1 root root 70 Jun 25 18:29 /etc/hosts.equiv $ rsh linux1-priv ls -l /etc/hosts.equiv -rw------- 1 root root 70 Jun 25 18:29 /etc/hosts.equiv $ rsh linux2 ls -l /etc/hosts.equiv -rw------- 1 root root 70 Jun 25 18:29 /etc/hosts.equiv $ rsh linux2-priv ls -l /etc/hosts.equiv -rw------- 1 root root 70 Jun 25 18:29 /etc/hosts.equiv与使用安全 shell 不同,不需要用其他操作或命令来启用用户等效性以使用远程 shell。在成功登录终端会话后,用户等效性将针对“oracle”UNIX 用户帐户启用。
验证以下启动命令都包含在集群中的两个 Oracle RAC 节点上!
至此,我们已经详细介绍了需要在 Oracle10g RAC 配置的两个节点上配置的参数和资源。在本部分中,我们将稍事调整,简要复述这些参数、命令和条目(在本文前面的章节中已提到过),当引导计算机时需要在两个 Oracle RAC 节点上执行它们。
对于以下的每个启动文件,都应将灰色的条目包含在每个启动文件中。
/etc/modprobe.conf
(所有要由内核模块使用的参数和值。)
alias eth0 r8169 alias eth1 e1000 alias scsi_hostadapter ata_piix alias snd-card-0 snd-intel8x0 options snd-card-0 index=0 install snd-intel8x0 /sbin/modprobe --ignore-install snd-intel8x0 && /usr/sbin/alsactl restore >/dev/null 2>&1 || : remove snd-intel8x0 { /usr/sbin/alsactl store >/dev/null 2>&1 || :; }; /sbin/modprobe -r --ignore-remove snd-intel8x0 alias usb-controller ehci-hcd alias usb-controller1 uhci-hcd options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180
/etc/sysctl.conf
(我们需要调整互联的默认和最大发送缓冲区大小以及默认和最大的接收缓冲区大小。)该文件还包含那些负责配置由 Oracle 实例使用的共享内存、信号和文件句柄以及本地 IP 范围的参数。)
# Kernel sysctl configuration file for Red Hat Linux # # For binary values, 0 is disabled, 1 is enabled.See sysctl(8) and # sysctl.conf(5) for more details. # Controls IP packet forwarding net.ipv4.ip_forward = 0 # Controls source route verification net.ipv4.conf.default.rp_filter = 1 # Controls the System Request debugging functionality of the kernel kernel.sysrq = 0 # Controls whether core dumps will append the PID to the core filename. # Useful for debugging multi-threaded applications. kernel.core_uses_pid = 1 # Default setting in bytes of the socket receive buffer net.core.rmem_default=262144 # Default setting in bytes of the socket send buffer net.core.wmem_default=262144 # Maximum socket receive buffer size which may be set by using # the SO_RCVBUF socket option net.core.rmem_max=262144 # Maximum socket send buffer size which may be set by using # the SO_SNDBUF socket option net.core.wmem_max=262144 # +---------------------------------------------------------+ # | SHARED MEMORY | # +---------------------------------------------------------+ kernel.shmmax=2147483648 # +---------------------------------------------------------+ # | SEMAPHORES | # | ---------- | # | | # | SEMMSL_value SEMMNS_value SEMOPM_value SEMMNI_value | # | | # +---------------------------------------------------------+ kernel.sem=250 32000 100 128 # +---------------------------------------------------------+ # | FILE HANDLES | # ----------------------------------------------------------+ fs.file-max=65536 # +---------------------------------------------------------+ # | LOCAL IP RANGE | # ----------------------------------------------------------+ net.ipv4.ip_local_port_range=1024 65000
/etc/hosts
(RAC 集群中的节点的所有计算机/IP 条目。)
# Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost # Public Network - (eth0) 192.168.1.100 linux1 192.168.1.101 linux2 # Private Interconnect - (eth1) 192.168.2.100 linux1-priv 192.168.2.101 linux2-priv # Public Virtual IP (VIP) addresses - (eth0) 192.168.1.200 linux1-vip 192.168.1.201 linux2-vip # Private Storage Network for Openfiler - (eth1) 192.168.1.195 openfiler1 192.168.2.195 openfiler1-priv 192.168.1.106 melody 192.168.1.102 alex 192.168.1.105 bartman 192.168.1.120 cartman
/etc/hosts.equiv
(/etc/hosts.equiv 文件仅在使用远程 shell 方法建立远程访问和用户等效性时需要。使用远程 shell 方法启用用户等效性后,无需提供口令就可以 oracle 用户帐户登录各个 Oracle RAC 节点。)
+linux1 oracle
+linux2 oracle
+linux1-priv oracle
+linux2-priv oracle
/etc/rc.local
(加载 hangcheck-timer 内核模块。)
#!/bin/sh
#
# This script. will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style. init stuff.
touch /var/lock/subsys/local
# +---------------------------------------------------------+
# | HANGCHECK TIMER |
# | (I do not believe this is required, but doesn't hurt) |
# ----------------------------------------------------------+
/sbin/modprobe hangcheck-timer
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9606200/viewspace-745643/ ,如需转载,请注明出处,否则将追究法律责任。