How to use SCAN and node listeners with different ports? (文档 ID 1585786.1) | 转到底部 |
修改时间:2014-2-17类型:BULLETIN |
|
In this Document
Purpose |
Scope |
Details |
References |
This note describes how to use SCAN and listeners with different port numbers for various purposes. There is no general requirement to do this using an Oracle RAC 11g Release 2, as the overall idea is that any client will use the SCAN as its initial entry point and will then be connected to the respective instance and service on the node this service is most suitably served on using the node listener on this node. However, there may be reasons to support applications to maintain a distinguishable connect string on host / port level, which can be established in multiple ways, of which some are described in the following.
For the purpose of allowing applications to maintain a distinguishable connect string on host / port level using one SCAN as the host or to enable port-based firewall configurations, SCAN can be set up to support more than one port. It needs to be noticed that different ports are only used for an initial connect. Once a connection using SCAN on any SCAN port has been established, port assignment is not maintained and routing of connections within the Oracle RAC cluster is performed using database services registered with one or more local listeners. This means that all SCAN ports are treated the same, so that a connection that comes in on any SCAN port can be directed to any registered local listener on any port.
DBCA Default Configuration
Any Oracle 11g Rel. 2 database that is created using the DBCA will use a default configuration, which in short can be described as follows:
A simple configuration is used, regarding the ports and numbers of listeners in the cluster. Basically, the assumption is that 1 SCAN listener, running on 1-3 nodes in the cluster, will work with 1 node listener, running on all of the nodes in the cluster. In addition, most examples assume that both listeners actually use the same port (default 1521). At times, it seems desirable to use dedicated listeners per database either on the same or a different port. There is no general requirement to do this using an Oracle RAC 11g Release 2, as the overall idea is that any client will use the SCAN as its initial entry point and will then be connected to the respective instance and service on the node this service is most suitably served on using the node listener on this node.
This assumes that the respective database that the instance belongs to and that the service is assigned to uses the correct entries for the LOCAL_LISTENER and REMOTE_LISTENER instance parameters. The defaults for the case described would be: LOCAL_LISTENER points to the node listener on the respective node and the REMOTE_LISTENER points to the SCAN. Example:
Some listener and listener architecture used in in Oracle RAC 11g Release 2 fundamentals
Using multiple ports with SCAN is subject to version restrictions as follows: 11.2.0.3 does not allow for setting up multiple ports on one SCAN. With 11.2.0.2 this setup would have been possible. Starting with 11.2.0.3.6 (and higher) setting up multiple ports for one SCAN is possible again and supported for the purpose stated above. This issue is tracked in unpublished BUG 13798847.
A typical client TNSNAMES entry for the client to connect to any database in the cluster would by default look like the following:
testscan1521 =
(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = cluster1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORCL) ) )
remote_listener: cluster1:1521
If the motivation to have dedicated listeners for the database is so that clients would get different connection strings to connect to the database (e.g. different host entries or ports) SCAN cannot be used and the node listeners need to be addressed directly, as it used to be the case with previous versions of Oracle RAC. In this case, the SCAN is basically not used for client connections. Oracle does not recommend this configuration, but this entry will explain its configuration later on.
testscan1541 =
(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = cluster1)(PORT = 1541)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORCL) ) )
Note 1: The srvctl command "add listener" does allow specifying an Oracle Home that the newly added listener will be running from and yet have this listener be managed by Oracle Clusterware. This entry does not elaborate on these advanced configurations.
In order for clients to connect to the databases ORCL and FOOBAR, but not using SCAN, a TNSNAME.ora entry for each database must be used. The pre-Oracle 11g Rel. 2 RAC paradigm must be followed in this case. Hence, one typical TNSNAMES.ora entry for the example used here would look like the following:
ORCL =
(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = node1-vip)(PORT = 2011)) (ADDRESS = (PROTOCOL = TCP)(HOST = node2-vip)(PORT = 2011)) (ADDRESS = (PROTOCOL = TCP)(HOST = node...)(PORT = 2011)) (ADDRESS = (PROTOCOL = TCP)(HOST = nodeN-vip)(PORT = 2011)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORCL) ) ) FOOBAR = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = node1-vip)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = node2-vip)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = node...)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = nodeN-vip)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = FOOBAR) ) )
local_listener:(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=node1-vip)(PORT=2011))))
local_listener:(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=node1-vip)(PORT=1521))))
remote_listener:(DESCRIPTION=(ADDRESS_LIST=(ADDRESS = (PROTOCOL = TCP)(HOST = node2-vip)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = node...)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = nodeN-vip)(PORT = 1521))))
|