您好,欢迎访问一九零五行业门户网

Oracle RAC 负载均衡与local_listener、remote_listener两个参数的配置关系

oracle rac 负载均衡与local_listener、remote_listener两个参数的配置关系 rac的负载均衡主要由客户端和服务器端两种实现方式。
oracle rac 负载均衡与local_listener、remote_listener两个参数的配置关系
 rac的负载均衡主要由客户端和服务器端两种实现方式。
1,客户端的实现,直接在tnsnames.ora中配置load_balance参数来实现。默认值是no
 clinet_lb =
  (description =
    (load_balance = yes)
    (address = (protocol = tcp)(host = 10.4.124.243)(port = 1521))
    (address = (protocol = tcp)(host = 10.4.124.244)(port = 1521))
    (address = (protocol = tcp)(host = 10.4.124.245)(port = 1521))
    (address = (protocol = tcp)(host = 10.4.124.246)(port = 1521))
    (connect_data =
      (service_name = srv_epm1)
    )
  )
  2,服务器端的负载均衡lb设置。主要是通过两个初始化参数local_listener、remote_listener来实现的。通过这两个参数,oracle分别向这两个参数指向的listener进行注册,这样,listener就能知道各个服务的状态,,进而进行连接分发。
  11gr2版本,这两个参数默认设置为如下
sql> show parameter listener
name                                 type        value
------------------------------------ ----------- ------------------------------
listener_networks                    string
local_listener                       string      (description=(address_list=(ad
                                                 dress=(protocol=tcp)(host=10.4
                                                 .124.244)(port=1521))))
remote_listener                      string      dtydb-scan2:1521
由于以上设置,数据库实例分别向local_listener和remote_listener进行注册。
本地listener只注册了+asm2和epmdb2两个实例
lsnrctl> set current_listener listener
current listener is listener
lsnrctl> service
connecting to (description=(address=(protocol=ipc)(key=listener)))
services summary...
service +asm has 1 instance(s).
  instance +asm2, status ready, has 1 handler(s) for this service...
    handler(s):
      dedicated established:10765 refused:0 state:ready
         local server
service epmdb has 1 instance(s).
  instance epmdb2, status ready, has 1 handler(s) for this service...
    handler(s):
      dedicated established:10 refused:0 state:ready
         local server
the command completed successfully
scan listener注册了所有数据库实例默认service和运行在epmdb1实例上的服务srv_epm1
查看服务注册情况,scan
lsnrctl> set current_listener listener_scan1
current listener is listener_scan1
lsnrctl> service
connecting to (description=(address=(protocol=ipc)(key=listener_scan1)))
services summary...
service epmdb has 3 instance(s).
  instance epmdb1, status ready, has 1 handler(s) for this service...
    handler(s):
      dedicated established:0 refused:0 state:ready
         remote server
         (description=(address=(protocol=tcp)(host=10.4.124.243)(port=1521)))
  instance epmdb2, status ready, has 1 handler(s) for this service...
    handler(s):
      dedicated established:0 refused:0 state:ready
         remote server
         (description=(address=(protocol=tcp)(host=10.4.124.244)(port=1521)))
  instance epmdb3, status ready, has 1 handler(s) for this service...
    handler(s):
      dedicated established:4 refused:0 state:ready
         remote server
         (description=(address=(protocol=tcp)(host=10.4.124.245)(port=1521)))
service srv_epm1 has 1 instance(s).
  instance epmdb1, status ready, has 1 handler(s) for this service...
    handler(s):
      dedicated established:0 refused:0 state:ready
         remote server
         (description=(address=(protocol=tcp)(host=10.4.124.243)(port=1521)))
the command completed successfully
tnsnames.ora的配置如下
tydb_srv_epm1 =
  (description =
    (load_balance = no)
    (address = (protocol = tcp)(host = 10.4.124.243)(port = 1521))
    (address = (protocol = tcp)(host = 10.4.124.244)(port = 1521))
    (address = (protocol = tcp)(host = 10.4.124.245)(port = 1521))
    (address = (protocol = tcp)(host = 10.4.124.246)(port = 1521))
    (connect_data =
      (service_name = epmdb)
    )
  )
epmdb_scan =
  (description =
    (load_balance = no)
    (address = (protocol = tcp)(host = 10.4.124.230)(port = 1521))
    (connect_data =
      (service_name = epmdb)
    )
  )
其它类似信息

推荐信息