oracle11gr2rac中的4种IP解说
关于在配置oracle 11gr2 rac时的4种IP,有不少朋友对此很迷惑,本文在此解说一下。 打开一个RAC节点的/etc/hosts文件 cat /etc/hosts # Public IP 192.168.1.138rac1.localdomain rac1 192.168.1.139rac2.localdomain rac2 #Private IP 172.16.10.138rac1-pr
关于在配置oracle 11gr2 rac时的4种IP,有不少朋友对此很迷惑,本文在此解说一下。
打开一个RAC节点的/etc/hosts文件
cat /etc/hosts
# Public IP
192.168.1.138rac1.localdomain rac1
192.168.1.139rac2.localdomain rac2
#Private IP
172.16.10.138rac1-priv.localdomain rac1-priv
172.16.10.139rac2-priv.localdomain rac2-priv
#Virtual IP
192.168.1.140 rac1-vip.localdomain rac1-vip
192.168.1.141 rac2-vip.localdomain rac2-vip
#SCAN IP
192.168.1.142 rac-scan.localdomain rac-scan
这个文件里设计四种IP,分别有Public IP、Private IP、Virtual IP、SCAN IP
private ip:即内部IP。用于节点间的通信,通信内容包括network heartbeat和cache fusion
public ip:即外部IP。用于提供对外数据服务。
Virtual IP:即虚拟IP。其最大作用是用于故障切换。
Oracle RAC中每个节点都有一个虚拟IP,简称VIP, 与公网PUBLIC IP在同一个网段。vip 附属在public网口接口。
Virtual IP和PUBLIC IP最主要的不同之处在于:VIP是浮动的,而PUBLIC IP是固定的。在所有节点都正常运行时,每个节点的VIP会被分配到public NIC上;在linux下ifconfig查看,public网卡上是2个IP地址;如果一个节点宕机,这个节点的VIP会被转移到还在运行的节点上。也就是幸存的节点的public NIC这个网卡上,会有3个IP地址。
如果没有vip,连接失败节点的process会有一个比较长的tcp超时等待,才能返回错误,有了vip后,节点失效后,由于vip漂移到其它节点,连接该vip的process很快就能返回错误,从而更快的尝试连接其它活动的节点,避免客户端反复连接node1的实例。 如果应用程序和客户机都配置了透明的应用程序故障转移选项,可以在客户端重新连接到剩余的实例。
使用Virtual ip的另一个原因,我认为是负载均衡。客户端在配置tnsnames.ora时,有些场合是要使用的vip,而有些场合又必须使用Public IP。例如,当你在定位一个数据库的死锁时,使用Public IP,可以确保连到你想处理的机器。相反此时使用VIP时,会出现不确定性,因为服务器默认是开启负载均衡的,也就是有可能你想连A机,系统却给你分配了B机。
SCAN IP:在oracle 11gR2中,SCAN IP是作为一个新增IP出现的, scan ip其实是oracle在客户端与数据库之间,新加的一个连接层,当有客户端访问时,连接到 SCAN IP LISTENER, 而SCAN IP LISTENER接收到连接请求时,会根据 LBA 算法将该客户端的连接请求,转发给对应的instance上的VIP LISTENER,从而完成了整个客户端与服务器的连接过程。简化如下:
client -> scan listener -> local listener -> local instance
你也可以把scan理解为一个虚拟主机名,它对应的是整个RAC集群。客户端主机只需通过这个scan name即可访问数据库集群的任意节点。当然访问的节点是随机的,oracle强烈建议通过DNS Server的round robin模式配置解析SCAN,实现负载均衡(即轮换连接SCAN对应的IP地址)。这有点类似通过vip和listener loadbalance配置实现负载均衡的原理。
那么有了Virtual ip后为什么还增加了一个SCAN IP呢?
在oracle 11.2之前,client链接数据库的时候要用vip,假如你的oracle cluster有4个节点,那么客户端的tnsnames.ora中就对应有四个主机vip的一个连接串,如果cluster增加了一个节点,那么对于每个连接数据库的客户端都需要修改这个tnsnames.ora。
引入了scan以后,就方便了客户端连接的一个接口,顾名思义 single client access name ,简单客户端连接名,这是一个唯一的名称,在整个公司网络内部唯一,并且在DNS中可以解析为三个ip地址,客户端连接的时候只需要知道这个名称,并连接即可, 每个SCAN VIP对应一个scan listener,cluster内部的service在每个scan listener上都有注册,scan listener接受客户端的请求,并foward到不同的Local listener中去,还是由local 的listener提供服务给客户端。
scan ip主要是为了简化客户端连接,假如你的oracle 集群有20个节点,客户端连接的时候,是不是需要配置20个vip,如果用scan,只需要一个scan name就行了,剩下的事情,scan帮你做了。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



PyCharm is a powerful integrated development environment (IDE), and PyTorch is a popular open source framework in the field of deep learning. In the field of machine learning and deep learning, using PyCharm and PyTorch for development can greatly improve development efficiency and code quality. This article will introduce in detail how to install and configure PyTorch in PyCharm, and attach specific code examples to help readers better utilize the powerful functions of these two. Step 1: Install PyCharm and Python

Title: How to correctly configure Git in PyCharm In modern software development, the version control system is a very important tool, and Git, as one of the popular version control systems, provides developers with powerful functions and flexible operations. As a powerful Python integrated development environment, PyCharm comes with support for Git, allowing developers to manage code versions more conveniently. This article will introduce how to correctly configure Git in PyCharm to facilitate better development during the development process.

Title: The working principle and configuration method of GDM in Linux systems In Linux operating systems, GDM (GNOMEDisplayManager) is a common display manager used to control graphical user interface (GUI) login and user session management. This article will introduce the working principle and configuration method of GDM, as well as provide specific code examples. 1. Working principle of GDM GDM is the display manager in the GNOME desktop environment. It is responsible for starting the X server and providing the login interface. The user enters

Understanding Linux Bashrc: Function, Configuration and Usage In Linux systems, Bashrc (BourneAgainShellruncommands) is a very important configuration file, which contains various commands and settings that are automatically run when the system starts. The Bashrc file is usually located in the user's home directory and is a hidden file. Its function is to customize the Bashshell environment for the user. 1. Bashrc function setting environment

PyCharm is a commonly used integrated development environment (IDE). In daily development, using Git to manage code is essential. This article will introduce how to configure Git in PyCharm and use Git for code management, with specific code examples. Step 1: Install Git First, make sure Git is installed on your computer. If it is not installed, you can go to [Git official website](https://git-scm.com/) to download and install the latest version of Git

How to configure a workgroup in Win11 A workgroup is a way to connect multiple computers in a local area network, which allows files, printers, and other resources to be shared between computers. In Win11 system, configuring a workgroup is very simple, just follow the steps below. Step 1: Open the "Settings" application. First, click the "Start" button of the Win11 system, and then select the "Settings" application in the pop-up menu. You can also use the shortcut "Win+I" to open "Settings". Step 2: Select "System" In the Settings app, you will see multiple options. Please click the "System" option to enter the system settings page. Step 3: Select "About" In the "System" settings page, you will see multiple sub-options. Please click

Title: How to configure and install FTPS in Linux system, specific code examples are required. In Linux system, FTPS is a secure file transfer protocol. Compared with FTP, FTPS encrypts the transmitted data through TLS/SSL protocol, which improves Security of data transmission. In this article, we will introduce how to configure and install FTPS in a Linux system and provide specific code examples. Step 1: Install vsftpd Open the terminal and enter the following command to install vsftpd: sudo

MyBatisGenerator is a code generation tool officially provided by MyBatis, which can help developers quickly generate JavaBeans, Mapper interfaces and XML mapping files that conform to the database table structure. In the process of using MyBatisGenerator for code generation, the setting of configuration parameters is crucial. This article will start from the perspective of configuration parameters and deeply explore the functions of MyBatisGenerator.
