OCM_Session7_1_配置/etc/hosts

本文详细介绍了在安装RAC集群第一步中如何正确配置hosts文件,包括IP地址、VIP地址和私有接口的配置,确保集群正常运行。
一、配置/etc/hosts
 
在安装rac第一步是配置/etc/hosts文件,在OCM环境中已经配置好,我们只需要查看:cat /etc/hosts

 
 

2.7.1 IP Address Requirements

Before starting the installation, you must have the following IP addresses available for each node:

  • An IP address with an associated network name registered in the domain name service (DNS) for the public interface. If you do not have an available DNS, then record the network name and IP address in the system hosts file, /etc/hosts.

  • One virtual IP (VIP) address with an associated network name registered in DNS. If you do not have an available DNS, then record the network name and VIP address in the system hosts file, /etc/hosts. Select an address for your VIP that meets the following requirements:

    • The IP address and network name are currently unused

    • The VIP is on the same subnet as your public interface

    Before installation, check that the default gateway can be accessed by a ping command. During installation, OUI uses the ping command to ensure that the VIP is reachable. To find the default gateway, use the route command, as described in your operating system's help utility. After installation, configure clients to use either the VIP address, or the network name associated with the VIP. If a node fails, then the node's virtual IP address fails over to another node.

  • A private IP address with a host name for each private interface

    Oracle recommends that you use private network IP addresses for these interfaces (for example: 10.*.*.* or 192.168.*.*). Use the /etc/hosts file on each node to associate private network names with private IP addresses.

For example, with a two node cluster where each node has one public and one private interface, you might have the configuration shown in the following table for your network interfaces, where the hosts file is /etc/hosts:

NodeInterface NameTypeIP AddressRegistered In
rac1 rac1 Public 143.46.43.100 DNS (if available, else the hosts file)
rac1 rac1-vip Virtual 143.46.43.104 DNS (if available, else the hosts file)
rac1 rac1-priv Private 10.0.0.1 Hosts file
rac2 rac2 Public 143.46.43.101 DNS (if available, else the hosts file)
rac2 rac2-vip Virtual 143.46.43.105 DNS (if available, else the hosts file)
rac2 rac2-priv Private 10.0.0.2 Hosts file

To enable VIP failover, the configuration shown in the preceding table defines the public and VIP addresses of both nodes on the same subnet, 143.46.43. When a node or interconnect fails, then the associated VIP is relocated to the surviving instance, enabling fast notification of the failure to the clients connecting through that VIP. If the application and client are configured with transparent application failover options, then the client is reconnected to the surviving instance.

--------------------------------------------------------------------------------------------------------------------------------------------------

我的修改如下:

rac1节点修改/etc/hosts文件
---------------------------------------------------------------------------------------
[root@rac1 ~]# cp /etc/hosts /etc/hosts.bak
[root@rac1 ~]# vi /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1       localhost
::1             localhost6.localdomain6 localhost6

#node1
192.168.1.151   rac1.localdomain       rac1
192.168.1.152   rac1-vip.localdomain   rac1-vip
172.168.1.14    rac1-priv.localdomain  rac1-priv


#node2
192.168.1.153   rac2.localdomain       rac2
192.168.1.154   rac2-vip.localdomain   rac2-vip
172.168.1.15    rac2-priv.localdomain  rac2-priv
~
~
~
"/etc/hosts" 17L, 482C written
[root@rac1 ~]# 

------------------------------------------------------------------------------------
rac2节点修改/etc/hosts文件

[root@rac2 ~]# cp /etc/hosts /etc/hosts.bak
[root@rac2 ~]# vi /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1       localhost
::1             localhost6.localdomain6 localhost6

#node1
192.168.1.151   rac1.localdomain       rac1
192.168.1.152   rac1-vip.localdomain   rac1-vip
172.168.1.14    rac1-priv.localdomain  rac1-priv


#node2
192.168.1.153   rac2.localdomain       rac2
192.168.1.154   rac2-vip.localdomain   rac2-vip
172.168.1.15    rac2-priv.localdomain  rac2-priv
~
~
~
"/etc/hosts" 15L, 480C written
[root@rac2 ~]# 
### ORACLE_OCM_CONFIG_DIR 的含义与配置方法 #### 含义 ORACLE_OCM_CONFIG_DIR 是 Oracle Configuration Manager (OCM) 用于存储配置文件和数据的目录路径环境变量。该变量用于指定 OCM 收集和存储配置信息的目标位置,这些信息通常用于 Oracle 的支持服务,如 My Oracle Support (MOS) 中的配置分析和问题诊断。如果该目录未正确设置或缺失,可能会导致 OCM 相关操作失败,例如配置作业无法写入数据或部署脚本无法完成执行[^1]。 在某些情况下,OCM 配置任务可能试图访问一个未被自动创建的目录路径,如 ORACLE_OCM_CONFIG_DIR2,这可能导致“ORA-29280: invalid directory path”错误。此类问题通常发生在 Oracle 数据库的内置脚本未创建该目录的情况下,而 OCM 的作业尝试访问它时会触发路径无效的错误[^3]。 #### 设置方法 ORACLE_OCM_CONFIG_DIR 通常由 Oracle Configuration Manager 在配置过程中自动设置。如果需要手动配置或验证该目录,可以按照以下步骤进行: 1. **创建目录**:确保操作系统中存在指定的目录结构,例如 `/u01/app/oracle/ocm/config`。 ```bash mkdir -p /u01/app/oracle/ocm/config ``` 2. **设置权限**:确保 Oracle 软件所有者(如 `oracle` 用户)对该目录具有读写权限。 ```bash chown -R oracle:oinstall /u01/app/oracle/ocm/config chmod -R 750 /u01/app/oracle/ocm/config ``` 3. **配置环境变量**:在 Oracle 的环境配置文件(如 `.bash_profile` 或 `.bashrc`)中设置 ORACLE_OCM_CONFIG_DIR。 ```bash export ORACLE_OCM_CONFIG_DIR=/u01/app/oracle/ocm/config ``` 4. **重新加载环境变量**:执行以下命令以应用更改。 ```bash source ~/.bash_profile ``` 5. **验证配置**:运行 OCM 配置工具以确认目录路径是否正确。 ```bash $ORACLE_HOME/ccr/bin/configCCR ``` 如果 OCM 报告目录结构不完整或未配置,例如提示“OCM is not configured for this host or ORACLE_CONFIG_HOME”,则需要重新运行配置工具以确保所有必要的目录和配置文件被正确生成[^2]。 #### 注意事项 - **一致性**:在多节点环境中,确保所有节点的 ORACLE_OCM_CONFIG_DIR 设置一致,以便于集中管理和支持。 - **备份与监控**:定期备份 OCM 配置目录,并监控其磁盘使用情况,以防止因空间不足导致的配置失败。 - **日志检查**:如果遇到配置错误,可以检查 OCM 的日志文件,通常位于 `$ORACLE_HOME/ccr/log` 目录下,以获取详细的错误信息和诊断线索。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值