[20190314]理解TRANSPORT_CONNECT_TIMEOUT RETRY_COUNT引數在tnsnames.ora.tx
[20190314]理解LOAD_BALANCE TRANSPORT_CONNECT_TIMEOUT RETRY_COUNT引數在tnsnames.ora.txt
--//連結:
--//以前也做過類似測試:http://blog.itpub.net/267265/viewspace-2199977/
TRANSPORT_CONNECT_TIMEOUT:
"The TRANSPORT_CONNECT_TIMEOUT parameter specifies the time, in seconds, for a client to establish a TCP connection to
the database server. The default value is 60 seconds." For more information, click here
RETRY_COUNT:
"To specify the number of times an ADDRESS list is traversed before the connection attempt is terminated." For more
information, click here
--//實際上測試次數是RETRY_COUNT+1.
--//重複測試:
1.在/tmp目錄下建立tnsnames.ora,內容如下:
$ export TNS_ADMIN=/tmp
$ cat tnsnames.ora
CLIENT_CON =
(DESCRIPTION =
(LOAD_BALANCE=ON)
(TRANSPORT_CONNECT_TIMEOUT=3)(RETRY_COUNT=2)
(ADDRESS = (PROTOCOL = TCP)(HOST =10.10.10.10)(PORT = 1522))
(ADDRESS = (PROTOCOL = TCP)(HOST =11.11.11.11)(PORT = 1522))
(ADDRESS = (PROTOCOL = TCP)(HOST =12.12.12.12)(PORT = 1522))
(ADDRESS = (PROTOCOL = TCP)(HOST =13.13.13.13)(PORT = 1522))
(ADDRESS = (PROTOCOL = TCP)(HOST =14.14.14.14)(PORT = 1522))
(ADDRESS = (PROTOCOL = TCP)(HOST =15.15.15.15)(PORT = 1522))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orclgg)
))
2.測試:
$ export TNS_ADMIN=/tmp
$ strace -tT -f tnsping client_con 2>&1 | grep 'connect'
$ strace -tT -f tnsping client_con 2>&1 | grep 'connect'
08:58:03 connect(4, {sa_family=AF_FILE, path="/var/run/nscd/socket"...}, 110) = -1 ENOENT (No such file or directory) <0.000033>
08:58:03 connect(4, {sa_family=AF_FILE, path="/var/run/nscd/socket"...}, 110) = -1 ENOENT (No such file or directory) <0.000033>
08:58:03 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("15.15.15.15")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000052>
08:58:06 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("12.12.12.12")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000042>
08:58:09 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("14.14.14.14")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000044>
08:58:12 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("11.11.11.11")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000041>
08:58:15 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("13.13.13.13")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000041>
08:58:18 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("10.10.10.10")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000042>
08:58:21 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("12.12.12.12")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000042>
08:58:24 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("10.10.10.10")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000041>
08:58:27 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("11.11.11.11")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000041>
08:58:30 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("14.14.14.14")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000043>
08:58:33 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("13.13.13.13")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000042>
08:58:36 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("15.15.15.15")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000041>
08:58:39 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("10.10.10.10")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000044>
08:58:42 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("12.12.12.12")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000043>
08:58:45 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("15.15.15.15")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000042>
08:58:48 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("11.11.11.11")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000040>
08:58:51 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("13.13.13.13")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000045>
08:58:54 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("14.14.14.14")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000041>
--//分成3組,也就是嘗試3次.每次選擇的IP不是定義的順序(LOAD_BALANCE=ON).
--//如果連線不上,時間間隔是3秒嘗試下一個.
3.修改tnsnames.ora檔案(LOAD_BALANCE=OFF):
--//重複測試:
$ strace -tT -f tnsping client_con 2>&1 | grep -E 'connect'
09:01:46 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("10.10.10.10")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000050>
09:01:49 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("11.11.11.11")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000042>
09:01:52 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("12.12.12.12")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000042>
09:01:55 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("13.13.13.13")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000043>
09:01:58 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("14.14.14.14")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000044>
09:02:01 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("15.15.15.15")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000042>
09:02:04 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("10.10.10.10")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000042>
09:02:07 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("11.11.11.11")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000046>
09:02:10 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("12.12.12.12")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000036>
09:02:13 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("13.13.13.13")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000034>
09:02:16 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("14.14.14.14")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000036>
09:02:19 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("15.15.15.15")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000038>
09:02:22 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("10.10.10.10")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000037>
09:02:25 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("11.11.11.11")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000038>
09:02:28 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("12.12.12.12")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000037>
09:02:31 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("13.13.13.13")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000038>
09:02:34 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("14.14.14.14")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000037>
09:02:37 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("15.15.15.15")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000037>
--//可以發現嘗試順便選擇的IP是定義的順序.
4.取消TRANSPORT_CONNECT_TIMEOUT設定:
$ cat tnsnames.ora
CLIENT_CON =
(DESCRIPTION =
(LOAD_BALANCE=OFF)
(RETRY_COUNT=1)
(ADDRESS = (PROTOCOL = TCP)(HOST =10.10.10.10)(PORT = 1522))
(ADDRESS = (PROTOCOL = TCP)(HOST =11.11.11.11)(PORT = 1522))
(ADDRESS = (PROTOCOL = TCP)(HOST =12.12.12.12)(PORT = 1522))
(ADDRESS = (PROTOCOL = TCP)(HOST =13.13.13.13)(PORT = 1522))
(ADDRESS = (PROTOCOL = TCP)(HOST =14.14.14.14)(PORT = 1522))
(ADDRESS = (PROTOCOL = TCP)(HOST =15.15.15.15)(PORT = 1522))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orclgg)
))
$ strace -tT -f tnsping client_con 2>&1 | grep -E 'connect'
09:05:53 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("10.10.10.10")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000052>
09:06:53 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("11.11.11.11")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000045>
09:07:53 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("12.12.12.12")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000047>
09:08:53 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("13.13.13.13")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000057>
09:09:53 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("14.14.14.14")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000057>
09:10:53 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("15.15.15.15")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000067>
09:11:53 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("10.10.10.10")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000056>
09:12:53 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("11.11.11.11")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000051>
09:13:53 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("12.12.12.12")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000042>
09:14:54 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("13.13.13.13")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000043>
09:15:54 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("14.14.14.14")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000045>
09:16:54 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("15.15.15.15")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000043>
--//可以發現間隔是60秒,也就是預設TRANSPORT_CONNECT_TIMEOUT=60.
4.取消RETRY_COUNT設定:
$ cat tnsnames.ora
CLIENT_CON =
(DESCRIPTION =
(LOAD_BALANCE=OFF)
(TRANSPORT_CONNECT_TIMEOUT=1)
(ADDRESS = (PROTOCOL = TCP)(HOST =10.10.10.10)(PORT = 1522))
(ADDRESS = (PROTOCOL = TCP)(HOST =11.11.11.11)(PORT = 1522))
(ADDRESS = (PROTOCOL = TCP)(HOST =12.12.12.12)(PORT = 1522))
(ADDRESS = (PROTOCOL = TCP)(HOST =13.13.13.13)(PORT = 1522))
(ADDRESS = (PROTOCOL = TCP)(HOST =14.14.14.14)(PORT = 1522))
(ADDRESS = (PROTOCOL = TCP)(HOST =15.15.15.15)(PORT = 1522))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orclgg)
))
$ strace -tT -f tnsping client_con 2>&1 | grep 'connect'
09:20:05 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("10.10.10.10")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000047>
09:20:06 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("11.11.11.11")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000041>
09:20:07 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("12.12.12.12")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000050>
09:20:08 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("13.13.13.13")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000042>
09:20:09 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("14.14.14.14")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000043>
09:20:10 connect(4, {sa_family=AF_INET, sin_port=htons(1522), sin_addr=inet_addr("15.15.15.15")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000042>
--//預設RETRY_COUNT=0.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2638329/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- jmeter 引數理解JMeter
- linux,mtime引數的理解Linux
- 帶你深入理解傳遞引數
- Request 接收引數亂碼原理解析
- 在 Lua 中使用引數技巧
- 1.5 - Numpy的方法中,axis引數的理解
- [20180812]TRANSPORT_CONNECT_TIMEOUT and RETRY_COUNT.txt
- 淺談對python pandas中 inplace 引數的理解Python
- 深入理解RabbitMQ中的prefetch_count引數MQ
- innodb_flush_log_at_trx_commit引數的直白理解MIT
- [20190314]使用strace注意的問題.txt
- 在Linux中,linux核心引數如何修改?Linux
- @Validated、@Valid在service層引數校驗
- 你都理解建立執行緒池的引數嗎?執行緒
- 關於 groutine 喚醒中 skipframes 引數不理解
- 在SpringBoot中使用AOP——通知中的引數Spring Boot
- 【Data Pump】理解expdp中的ESTIMATE和ESTIMATE_ONLY引數
- 20190314鮑老師對於《孟子》的解讀
- 什麼是請求引數、表單引數、url引數、header引數、Cookie引數?一文講懂HeaderCookie
- 通過原始碼理解 Java 執行緒池的核心引數原始碼Java執行緒
- LevelDB原始碼分析:理解Slice實現 - 高效的LevelDB引數物件原始碼物件
- Flutter:學會在頁面間傳遞引數Flutter
- 在Java程式中列印java執行時引數Java
- 對 “C語言指標變數作為函式引數” 的個人理解C語言指標變數函式
- python疑問5:位置引數,預設引數,可變引數,關鍵字引數,命名關鍵字引數區別Python
- 個人理解emulateJSON作用 與java後臺介面引數的關係JSONJava
- [譯] ES6:理解引數預設值的實現細節
- 12.MyBatis學習--對映檔案_引數處理_單個引數&多個引數&命名引數MyBatis
- Java對比有引數和無引數Java
- 在.Net Web Api中使用FluentValidate進行引數驗證WebAPI
- 記錄解決HttpServletResponse在引數報錯的問題HTTPServlet
- 一種在【微服務體系】下的【引數配置神器】微服務
- 引數配置
- python引數Python
- 超引數
- mt引數
- COMPATIBLE引數
- 常用的jvm配置引數 :永久區引數配置JVM