IP=FIRST?
星期五, 九月 5th, 2008今天群里一个兄弟问RAC里的监听配置IP=FIRST意义,虽然以前经常看见,但是也没考虑过为什么?不过从字面含义看是首先使用IP,查了些文档确认了下,
What is IP=FIRST in the LISTENER.ORA file ?
The (IP=FIRST) statement will make the listener create a listening endpoint on the IP address to which the given HOST resolves. By default, without (IP=FIRST), the listener will listen on all network interfaces
也就说如果你指定了IP=FIRST那么,那么会首先在IP地址上建立监听,即使有HOSTNAME的也是
LISTENER_HP101 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = hp101-vip)(PORT = 1521)(IP = FIRST))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.51.101)(PORT = 1521)(IP = FIRST))
)
)
ORACLE的解释
You may use the following schema in order to interpret the listener behavior when it comes to binding to a TCP protocol address:
(1) If you provide an IP address, the listener will listen on that IP address
(2) If you provide a hostname:
(a) Oracle does a gethostbyname() on that hostname; potentially more than one IP address is returned.
The gethostbyname() library function may query the DNS server(s), the /etc/hosts file, the NIS service and perhaps other methods, based on the system configuration. How this works exactly depends on the operating system type, but usually the /etc/host.conf, /etc/nsswitch.conf and /etc/resolv.conf files are governing the functionality on the UNIX platforms.
You can find the value that is expected to be given by using the ping tool (e.g. “ping
Be careful that even the ping utility may not disclose you all the information, e.g. it will not show all the addresses associated with a hostname, if there are more than one. Best choice is to use the check-lsnrbind program, attached to this note (see below section “Checking tool”).
(b) Oracle does a gethostname() which will return the system’s configured hostname.
The gethostname() library function (notice the missing by particle) will return the standard hostname set for the system (or current processor, per manual pages); this is usually done at system startup.
You can find the value that is expected to be given by using the hostname tool, without any parameters (e.g. simply run “hostname”).
(c) Oracle does a gethostbyname() on the system’s hostname found in the previous step (2b).
(d) Oracle compares the first IP returned in (2a) to all of the IPs returned in (2c). If no match is found, then the listener will bind to the resolved IP address. The IP address is registered in the listening endpoints list.
— OR —
(e) If a match is found in (2d), the listener binds on all (working) network interfaces. The fully qualified system hostname is registered in the listening endpoints list.
You may recognize that the listener has bound to all interfaces from the “netstat -an” output: if the listener is bound to all interfaces then the IP address 0.0.0.0 will be shown — it programmers’ slang this is known as the INADDR_ANY address
(全文…)
