ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Oracle9i, 10g, 11g 负载均衡(load balance)和Fail Over

Oracle9i, 10g, 11g 负载均衡(load balance)和Fail Over

原创 Linux操作系统 作者:tolywang 时间:2009-05-05 10:08:01 0 删除 编辑

关键词:  load balance (负载均衡) , fail over (透明切换) 

以Oracle10g 为例子,Linux AS4.5 

以下是listener.ora ,  tnsnames.ora ,  spfile 中的几个配置 。

ecsrac01$cat   listener.ora  
# listener.ora.ecsrac01 Network Configuration File: /u01/product/oracle/network/admin/listener.ora.ecsrac01
# Generated by Oracle configuration tools.

LISTENER_ECSRAC01 =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = ecsvip01)(PORT = 1521)(IP = FIRST))
      )
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = 10.134.130.177)(PORT = 1521)(IP = FIRST))
      )
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
      )
    )
  )

 

ecsrac01$cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/product/oracle/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

ECSDB2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ecsvip02)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ecsdb)
      (INSTANCE_NAME = ecsdb2)
    )
  )

ECSDB1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ecsvip01)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ecsdb)
      (INSTANCE_NAME = ecsdb1)
    )
  )

ECS =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.134.130.170)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = ecsdb)
    )
  )

ECSDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ecsvip01)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = ecsvip02)(PORT = 1521))
    (LOAD_BALANCE = yes)
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ecsdb)
     (FAILOVER_MODE =
       (TYPE = SELECT)
       (METHOD = BASIC)
       (RETRIES = 180)
       (DELAY = 5)
     )
    )
  )

LISTENERS_ECSDB =
  (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ecsvip01)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = ecsvip02)(PORT = 1521))
  )


LOCAL_ECSDB =
  (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.134.130.177)(PORT = 1521))
  )

 

SQL> show parameter list

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
local_listener                       string      LOCAL_ECSDB
remote_listener                      string      LISTENERS_ECSDB

 

 

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

客户端Load Balance,Failover 设置 :

ECSDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ecsvip01)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = ecsvip02)(PORT = 1521))
    (LOAD_BALANCE = yes)
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ecsdb)
     (FAILOVER_MODE =
       (TYPE = SELECT)
       (METHOD = BASIC)
       (RETRIES = 180)
       (DELAY = 5)
     )
    )
  )

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

Server 端Load Balance,Failover 设置 :

Server 端的tnsnames.ora 中包含有

LISTENERS_ECSDB =
  (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ecsvip01)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = ecsvip02)(PORT = 1521))
  )

然后remote_listener 设置为tnsnames.ora 中的这个监听设置即可 。

SQL> show parameter list

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
local_listener                       string      LOCAL_ECSDB
remote_listener                      string      LISTENERS_ECSDB

 

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/35489/viewspace-592602/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
Oracle , MySQL, SAP IQ, SAP HANA, PostgreSQL, Tableau 技术讨论,希望在这里一起分享知识,讨论技术,畅谈人生 。

注册时间:2007-12-10

  • 博文量
    5595
  • 访问量
    13360209