博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Oracle 12c应用连接VIP轮训负载均衡?
阅读量:5952 次
发布时间:2019-06-19

本文共 4706 字,大约阅读时间需要 15 分钟。

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

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

  1. tnsnames.ora配置

<rac01:orcl1:/u01/app/oracle/product/12.1.0/dbhome_1/network/admin>$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.测试脚本如下

<rac01:orcl1:/u01/app/oracle/product/12.1.0/dbhome_1/network/admin>$

<rac01:orcl1:/u01/app/oracle/product/12.1.0/dbhome_1/network/admin>$less load_balance.sh 

#!/bin/bash  

for i in {1..100}  

do  

echo $i

sqlplus -S system/oracle@vip <<EOF

select instance_name from v\$instance;

select count(*) from t1;

EOF

sleep 1  

done  

exit 0 

3.开始测试,观察

<rac01:orcl1:/u01/app/oracle/product/12.1.0/dbhome_1/network/admin>$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

本文转自 roidba 51CTO博客,原文链接:http://blog.51cto.com/roidba/2044144,如需转载请自行联系原作者
你可能感兴趣的文章
2012年最佳免费网站和移动应用 PSD 界面素材揭晓
查看>>
墨菲定律、二八法则、马修、手表定理、“不肖”法、彼得原理、零和游戏、华盛顿合作规律、酒与污水定律、水桶定律、蘑菇管理原则、钱的问题、奥卡姆剃刀等。13文章是关于生活的金科玉律...
查看>>
Android中轴旋转特效实现,制作别样的图片浏览器
查看>>
Xcode6中添加pch文件
查看>>
变形课(dfs)
查看>>
Drawing with GoogLeNet
查看>>
frequentism-and-bayesianism-chs-ii
查看>>
AutoLayout的三种设置方式之——NSLayoutConstraint代码篇
查看>>
JBoss AS
查看>>
NetWorkUtil
查看>>
listview复用机制研究
查看>>
ASP.NET 5 WebApi 返回 HttpResponseMessage
查看>>
【NIO】dawn在buffer用法
查看>>
Mac下配置PHP+Apache+phpMyAdmin+MySql远程链接
查看>>
sqlserver 批量删除相同前缀名的表
查看>>
ssh-copy-id password
查看>>
【Testin实验室】MoiMark安卓中国终端体验性能排行榜(11月报)
查看>>
Wireshark入门与进阶---数据包捕获与保存的最基本流程
查看>>
讲义笔记
查看>>
Spring中HibernateCallback的用法(转)
查看>>