Load Balance)

Source: Internet
Author: User

Load Balance is one of the most important features of Oracle RAC. It distributes the load evenly to each node in the cluster to improve the overall throughput of the system. Generally, there are two methods to achieve load balancing. One is Load Balancing Based on Client connection, and the other is based on the server listener (listener) the collected information is used to allocate new connection requests to instances with fewer connections. This article mainly discusses Server Load balancer based on client connections and provides a demonstration.

For more information about listener configurations before Server Load balancer configuration, see
Oracle RAC Listener Configuration (listener. ora tnsnames. ora)
Non-Default port listening configuration in Oracle RAC (listener. ora tnsnames. ora)

 

I. Client Server Load balancer
The server Load balancer on the client is implemented by adding load_balance = yes to tnsnames. ora. Let's take a look at the explanation of Oracle (Note: 226880.1 ).

The client load balancing feature enables clients to randomize connection requests among the listeners. Oracle Net progresses through the list
Protocol addresses in a random sequence, balancing the load on the varous listeners. Without client load balancing, Oracle Net progresses through
List of Protocol addresses sequentially until one succeeds. This normally is referred to connect-time load balance.

As described above, if load_balance = yes is not enabled, Oracle Net selects a connection based on the address list in order until the connection is successful.
If the connection to the first host fails, in the case of multiple addresses, select the second address to connect, and so on until the connection is successful.
When load_balance = yes is enabled, Oracle Net selects a random address from multiple addresses for connection until the connection is successful.
Note: This connection method is randomly selected based on the address list, and does not take into account the number of real connections on each instance, that is, the actual connection load of each node is not considered.

 

Ii. server and client configurations

1. Configure Oracle @ bo2dbp on the server listener: ~> More $ ORACLE_HOME/Network/admin/listener. ora -- # listener on node bo2dbp # listener. ora. bo2dbp network configuration file:/u01/Oracle/DB/Network/admin/listener. ora. bo2dbp # generated by Oracle configuration tools. listener_new_bo2dbp = (description_list = (description = (address = (Protocol = TCP) (host = bo2dbp-vip.2gotrade.com) (Port = 1314) (IP = first) (address = (Protocol = TCP) (host = 192.168.7.51) (PO RT = 1314) (IP = first ))))........................... -- # The rest part is omitted. Note that the configuration here uses the non-default listener Port Number of 1314 Oracle @ bo2dbs:/u01/Oracle/DB/Network/admin> More listener. ora -- # listener on node bo2dbs # listener. ora. bo2dbs network configuration file:/u01/Oracle/DB/Network/admin/listener. ora. bo2dbs # generated by Oracle configuration tools. listener_new_bo2dbs = (description_list = (description = (address = (Protocol = TCP) (Ho St = bo2dbs-vip.2gotrade.com) (Port = 1314) (IP = first) (address = (Protocol = TCP) (host = 192.168.7.52) (Port = 1314) (IP = first ))))............... 2. parameter configuration --> parameter configuration SQL on Upgrade ance ora10g1> show parameter instance_naname type value =----------- #instance_name string ora10g1sql> show parameter listenername type value ----------------------- ------------- ----------- Parameter local_listener string parameter --> parameter configuration SQL> show parameter instance_namename type value parameter ----------- instance_name string parameter> show parameter listenername type value parameter -------------------------------------- --------- ---------------------------- Local_listener string listener string remote_lsnr_ora10g --> Monitoring Information SQL> Ho PS-Ef | grep lsnroracle 17372 1 0? 00:00:00/u01/Oracle/DB/bin/tnslsnr listener_new_bo2dbs-inheritoracle 17502 24301 17504 0 00:00:00 pts/0/bin/bash-c ps-Ef | grep lsnroracle 17502 pts/ 0 00:00:00 grep lsnrsql> Ho LSNRCTL status listener_new_bo2dbslistening endpoints summary... (description = (address = (Protocol = TCP) (host = 192.168.7.62) (Port = 1314) (description = (address = (Protocol = TCP) (host = 192.168.7.52) (Port = 1314) se Rvices summary... service "ora10g" has 2 instance (s ). instance "ora10g1", status ready, has 1 handler (s) for this service... instance "ora10g2", status ready, has 2 handler (s) for this service ............. --> only test the client-based load balance. Therefore, remove the remote_listener parameter SQL> alter system reset remote_listener scope = both SID = '*'; alter system reset remote_listener scope = both SID = '* error at line 1: ORA-32009: cannot Reset the memory value for instance * from instance ora10g2sql> alter system reset remote_listener scope = spfile SID = '*'; System altered. SQL> Ho srvctl stop database-D ora10g --> close database ora10gsql> Ho srvctl start database-D ora10g --> Start database ora10g to make the modified remote_listener take effect SQL> Ho LSNRCTL status ready --> at this time, we can see that only ora10g2 is registered to the listener listening endpoints summary... (description = (address = (Protocol = TCP) (Host = 192.168.7.62) (Port = 1314) (description = (address = (Protocol = TCP) (host = 192.168.7.52) (Port = 1314 ))) services summary... service "plsextproc" has 1 instance (s ). instance "plsextproc", status unknown, has 1 handler (s) for this service... service "ora10g" has 1 instance (s ). instance "ora10g2", status ready, has 1 handler (s) for this service ............. oracle @ bo2dbp: ~> LSNRCTL status listener_new_bo2dbp # Similarly, only ora10g1 registered with listening endpoints summary on the node bo2dbp... (description = (address = (Protocol = TCP) (host = 192.168.7.61) (Port = 1314) (description = (address = (Protocol = TCP) (host = 192.168.7.51) (Port = 1314) Services summary... service "ora10g" has 1 instance (s ). instance "ora10g1", status ready, has 1 handler (s) for this service ............ 3. Configure szdb on the client :~ # Ifconfig eth1 | grep "Inet ADDR" | cut-d ""-F12 | cut-D:-F2 # ip192.168.7.2szdb: ~ of the client host :~ # Su-oracleoracle @ szdb: ~> CAT/etc/hosts -- # client host added IP information of two virtual nodes on RAC 192.168.7.61 bo2dbp-vip.2gotrade.com bo2dbp-vip192.168.7.62 bo2dbs-vip.2gotrade.com bo2dbs-viporacle @ szdb: ~> Tail-12 $ ORACLE_HOME/Network/admin/tnsnames. oraora10g = (description = (address = (Protocol = TCP) (host = bo2dbp-vip.2gotrade.com) (Port = 1314) (address = (Protocol = TCP) (host = bo2dbs-vip.2gotrade.com) (Port = 1314) (load_balance = yes) (CONNECT_DATA = (Server = dedicated) (SERVICE_NAME = ora10g )))

Iii. Test Load Balancing)

1. Enable the load balance test Oracle @ szdb: ~> More load_balance.sh #! /Bin/bashfor I in {1 .. 100} doecho $ ISQLPLUS-S system/Oracle @ ora10g <eofselect instance_name from V \ $ instance; eofsleep 1 doneexit 0 # Author: Robinson Cheng # blog: http://blog.csdn.net/robinson_0612 Oracle @ szdb: ~> ./Load_balance.sh> load_bal.logoracle @ szdb: ~> Head-20 load_bal.log1instance_name ---------------- ora10g22instance_name ---------------- ora10g13instance_name -------------- ora10g24oracle @ szdb: ~> Grep ora10g1 load_bal.log | WC-l47oracle @ szdb: ~> Grep ora10g2 load_bal.log | WC-l53 from the log above, we can see that enabling the client's Server Load balancer basically ensures a balanced connection from the client. 2. If the load balance test is not enabled, remove the (load_balance = yes) option from tnsnames. ora of the client, and continue to use the above script to test Oracle @ szdb: ~> Grep ora10g1 no_load_bal.log | WC-l100oracle @ szdb: ~> Grep ora10g2 no_load_bal.log | WC-l0 from the above log, we can see that when load_balance = yes is removed, all user connection requests are set to ora10g1, because the connection request is from tnsnames. in ora, select the position of the column in the first row in the address item. Next we will close the instance ora10g1 and test the connection situation Oracle @ bo2dbp: ~> Srvctl stop instance-D ora10g-I ora10g1oracle @ szdb: ~> ./Load_balance.sh> no_load_bal_new.logoracle @ szdb: ~> Grep ora10g1 no_load_bal_new.log | WC-l0oracle @ szdb: ~> Grep ora10g2 no_load_bal_new.log | WC-l100 because the instance ora10g1 has been closed, all connection requests are allocated to ora10g2.

Iv. Summary
1. The Server Load balancer configuration on the client is simple. You only need to add load_balance = Yes | on
2. The connection allocation principle is to randomly select the address list under the connection identifier in tnsnames. ora to connect to the server.
3. If the listener or instance of a node in the selected list is unavailable, the listener or instance is randomly selected from the remaining address list until the list is successful.

V. More references

For more information about user-managed backup and recovery, see

Oracle cold backup

Oracle Hot Backup

Concept of Oracle backup recovery

Oracle instance recovery

Oracle recovery based on user management (describes media recovery and processing in detail)

System tablespace management and Backup Recovery

Sysaux tablespace management and recovery

Oracle backup control file recovery (unsing backup controlfile)

 

For information on RMAN backup recovery and management, see

RMAN overview and architecture

RMAN configuration, Monitoring and Management

Detailed description of RMAN backup

RMAN restoration and recovery

Create and use RMAN catalog

Create RMAN storage script based on catalog

Catalog-based RMAN backup and recovery

RMAN backup path confusion

 

For the Oracle architecture, see

Oracle tablespace and data files

Oracle Password File

Oracle parameter file

Oracle online redo log file)

Oracle Control File)

Oracle archiving logs

Oracle rollback and undo)

Oracle database instance startup and Shutdown Process

Automated Management of Oracle 10g SGA

Oracle instances and Oracle databases (Oracle Architecture)

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.