Oracle12c应用如何实现连接VIP轮训负载均衡的

下文给大家带来Oracle 12c应用如何实现连接VIP轮训负载均衡的,希望能够给大家在实际运用中带来一定的帮助,负载均衡涉及的东西比较多,理论也不多,网上有很多书籍,今天我们就用创新互联在行业内累计的经验来做一个解答。

站在用户的角度思考问题,与客户深入沟通,找到古蔺网站设计与古蔺网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:成都网站建设、网站制作、企业官网、英文网站、手机端网站、网站推广、域名注册雅安服务器托管、企业邮箱。业务覆盖古蔺地区。

目前很多生产数据库都是两节点RAC,应用连接的数据库通常会连接SCAN IP或者VIP,这里做一个小实验,如果我们使用VIP连接,

应该怎样配置我们的客户端,负载均衡是否是严格意义上的轮训机制,只有通过自己的测试才能得到准备的答案。

Oracle 12c应用如何实现连接VIP轮训负载均衡的

  1. tnsnames.ora配置

$less tnsnames.ora 

# tnsnames.ora Network Configuration File: /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

orcl =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = rac-scan)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = orcl)

    )

  )

vip =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.203)(PORT = 1521))

    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.204)(PORT = 1521))

    (LOAD_BALANCE = yes) 

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = orcl)

    )

  )

2.测试脚本如下

$

$less load_balance.sh 

#!/bin/bash  

for i in {1..100}  

do  

echo $i

sqlplus -S system/oracle@vip <

select instance_name from v\$instance;

select count(*) from t1;

EOF

sleep 1  

done  

exit 0 

3.开始测试,观察

$sh load_balance.sh 

1

INSTANCE_NAME

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

orcl1

  COUNT(*)

----------

   2910624

2

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

3

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

4

INSTANCE_NAME

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

orcl1

  COUNT(*)

----------

   2910624

5

INSTANCE_NAME

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

orcl1

  COUNT(*)

----------

   2910624

6

INSTANCE_NAME

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

orcl1

  COUNT(*)

----------

   2910624

7

INSTANCE_NAME

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

orcl1

  COUNT(*)

----------

   2910624

8

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

9

INSTANCE_NAME

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

orcl1

  COUNT(*)

----------

   2910624

10

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

11

INSTANCE_NAME

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

orcl1

  COUNT(*)

----------

   2910624

12

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

13

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

14

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

15

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

16

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

17

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

18

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

19

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

20

INSTANCE_NAME

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

orcl1

  COUNT(*)

----------

   2910624

21

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

22

INSTANCE_NAME

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

orcl1

  COUNT(*)

----------

   2910624

23

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

24

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

25

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

26

INSTANCE_NAME

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

orcl1

  COUNT(*)

----------

   2910624

27

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

28

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

29

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

30

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

31

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

32

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

33

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

34

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

35

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

36

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

37

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

38

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

39

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

40

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

41

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

42

INSTANCE_NAME

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

orcl1

  COUNT(*)

----------

   2910624

43

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

44

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

45

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

46

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

47

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

48

INSTANCE_NAME

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

orcl2

  COUNT(*)

----------

   2910624

49

INSTANCE_NAME

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

orcl1

  COUNT(*)

----------

   2910624

50

INSTANCE_N

....省略...............

  COUNT(*)

----------

   2910624

100

INSTANCE_NAME

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

orcl1

  COUNT(*)

----------

   2910624

看了以上关于Oracle 12c应用如何实现连接VIP轮训负载均衡的,如果大家还有什么地方需要了解的可以在创新互联行业资讯里查找自己感兴趣的或者找我们的专业技术工程师解答的,创新互联技术工程师在行业内拥有十几年的经验了。


文章题目:Oracle12c应用如何实现连接VIP轮训负载均衡的
转载源于:http://azwzsj.com/article/pcgipe.html