TimesTen的逻辑服务器名概念

2024-02-04 13:38

本文主要是介绍TimesTen的逻辑服务器名概念,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

概念

TimesTen中逻辑服务器名(logical server name)的概念用的很少,但是了解一下还是必要的。
首先,logical server是在客户端定义,指向服务器端。
其次,当用非TCP/IP的通讯协议或者TimesTen Server不在缺省的端口监听时,必须使用logical server name。

A logical server name is a definition for a server system on the TimesTen Client. In some cases, such as when using a communication protocol other than TCP/IP for local client/server or the TimesTen Server process is not listening on the default TCP/IP port, you must define a logical server name on the client system. In these cases, the Client DSN must refer to the logical server name. However, in most cases when the communication protocol used is TCP/IP, the Client DSN can refer directly to the server host name without having to define a logical server name.

logical server的配置在sys.ttconnect.ini文件中定义。例如:

$ cat sys.ttconnect.ini
# Copyright (c) 1999, 2009, Oracle and/or its affiliates.All rights reserved. ###############################################################
# This is a sample sys.ttconnect.ini file that is used for the
# TimesTen Client.  It contains entries for each server.
###############################################################[ttLocalHost_tt1122]
Description=TimesTen Server
Network_Address=ttLocalHost
TCP_PORT=53393

在本例中, 由于是32位版本,因此TCP_PORT中的53393是缺省端口。
值得一说的是Network_Address:
ttLocalHost表示使用Unix Domain socket通讯
ttShmHost表示使用shared memory进行IPC通讯
Network_Address也可以定义为主机名或IP地址

示例

在本例中我们在一台VM中安装了两个TimesTen示例tt1122和ttnew,第一个使用缺省的端口53392。由于缺省端口已占用,第二个使用的是另外的端口号55555。

$ cat /etc/TimesTen/instance_info 
#SUM 55602     1
[ tt1122 ]
Product=TimesTen11.2.2.6.2
InstallDir=/home/oracle/TimesTen/tt1122
InstanceAdministrator=oracle
DaemonHome=/home/oracle/TimesTen/tt1122/info
BitLevel=64
Component=Client/Server and DataManager
TT_PORT=53392[ ttnew ]
Product=TimesTen11.2.2.8.11
InstallDir=/u01/TimesTen/ttnew
InstanceAdministrator=oracle
DaemonHome=/u01/TimesTen/ttnew/info
BitLevel=64
Component=Client/Server and DataManager
TT_PORT=55555$ ttversion
TimesTen Release 11.2.2.6.2 (64 bit Linux/x86_64) (tt1122:53392) 2014-01-03T07:01:05ZInstance admin: oracleInstance home directory: /home/oracle/TimesTen/tt1122Group owner: oracleDaemon home directory: /home/oracle/TimesTen/tt1122/infoPL/SQL enabled.$ . /u01/TimesTen/ttnew/bin/ttenv.sh
$ ttversion
TimesTen Release 11.2.2.8.11 (64 bit Linux/x86_64) (ttnew:55555) 2016-02-09T19:36:50ZInstance admin: oracleInstance home directory: /u01/TimesTen/ttnewGroup owner: oracleDaemon home directory: /u01/TimesTen/ttnew/infoPL/SQL enabled.

再看一下tt1122的ttstatus:

[oracle@timesten-hol info]$ ttstatus
TimesTen status report as of Wed Jun 29 04:20:17 2016Daemon pid 2644 port 53392 instance tt1122
TimesTen server pid 2653 started on port 53393
------------------------------------------------------------------------
Data store /home/oracle/TimesTen/tt1122/info/DemoDataStore/cachedb1
There are no connections to the data store
Replication policy  : Manual
Cache Agent policy  : Manual
PL/SQL enabled.
------------------------------------------------------------------------
Accessible by group oracle
End of report

另起一个终端,看一下ttnew的ttstatus

$ . /u01/TimesTen/ttnew/bin/ttenv.sh
$ export TT_HOME=/u01/TimesTen/ttnew[oracle@timesten-hol info]$ ttstatus
TimesTen status report as of Wed Jun 29 04:21:38 2016Daemon pid 4494 port 55555 instance ttnew
TimesTen server pid 4503 started on port 55556
------------------------------------------------------------------------
Data store /home/oracle/TimesTen/tt1122/info/DemoDataStore/cachedb2
There are no connections to the data store
Replication policy  : Manual
Cache Agent policy  : Manual
PL/SQL enabled.
------------------------------------------------------------------------
Accessible by group oracle
End of report

注意Daemon pid和TimesTen server pid两行,Daemon 指的是 TimesTen Data Manager daemon, 负责Data Manager service 。Daemon的端口不能重。
TimesTen server是Daemon的子进程,或称为subdaemon。

安装TimesTen后,系统自动产生了sys.ttconnect.ini文件,先看tt1122的, 由于是主机第一个安装,因此使用的都是缺省值:

[oracle@timesten-hol info]$ cat sys.ttconnect.ini 
# Copyright (c) 1999, 2009, Oracle and/or its affiliates.All rights reserved. ###############################################################
# This is a sample sys.ttconnect.ini file that is used for the
# TimesTen Client.  It contains entries for each server.
###############################################################[ttLocalHost_tt1122]
Description=TimesTen Server
Network_Address=ttLocalHost
TCP_PORT=53393

再看一下第二个非缺省安装ttnew的:

[tt1122]$ cat sys.ttconnect.ini 
# Copyright (c) 1999, 2009, Oracle and/or its affiliates.All rights reserved. ###############################################################
# This is a sample sys.ttconnect.ini file that is used for the
# TimesTen Client.  It contains entries for each server.
###############################################################[ttLocalHost_ttnew]
Description=TimesTen Server
Network_Address=ttLocalHost
TCP_PORT=55556
[tt1122]$ ttisql -v1 -e 'set prompt "tt1122>"' repdb1_1122
tt1122>create user tthr identified by timesten;
tt1122>grant create session to tthr;tt1122>call ttconfiguration('ConnectionName');
< ConnectionName, repdb1_1122 >[ttnew]$ ttisql -v1 -e 'set prompt "ttnew>"' repdb2_1122
ttnew>create user tthr identified by timesten;
ttnew>grant create session to tthr;ttnew>call ttconfiguration('ConnectionName');
< ConnectionName, repdb2_1122 >

接下来测试从ttnew上的repdb2_1122访问tt1122上的repdb1_1122
sys.odbc.ini中已经有了一个repdb1CS_1122的定义:

repdb1CS_1122=TimesTen 11.2.2 Client Driver[repdb1CS_1122]
TTC_SERVER=ttLocalHost_ttnew
TTC_SERVER_DSN=repdb1_1122

但由于ttLocalHost_ttnew实际上指向本实例,因此无法连接到对方。
因此我们必须修改TTC_SERVER指向的logical server,涉及到sys.odbc.ini和sys.ttconnect.ini, 这里不妨把对方实例的sys.ttconnect.ini拷贝过来

[ttnew]$ cat sys.odbc.ini
...
[repdb1CS_1122]
TTC_SERVER=ttLocalHost_tt1122
TTC_SERVER_DSN=repdb1_1122
...[ttnew]$ hostname
timesten-hol[ttnew]$ cat sys.ttconnect.ini
# Copyright (c) 1999, 2009, Oracle and/or its affiliates.All rights reserved. ###############################################################
# This is a sample sys.ttconnect.ini file that is used for the
# TimesTen Client.  It contains entries for each server.
###############################################################[ttLocalHost_ttnew]
Description=TimesTen Server
Network_Address=ttLocalHost
TCP_PORT=55556####### ADDED BY STEVEN,COPIED FROM INSTANCE TT1122 ########
[ttLocalHost_tt1122]
Description=TimesTen Server
Network_Address=timesten-hol
TCP_PORT=53393

然后测试连通性,成功了:
[ttnew]$ ttisqlcs “dsn=repdb1CS_1122;uid=tthr;pwd=timesten”
Command> call ttconfiguration(‘ConnectionName’);
< ConnectionName, repdb1cs_1122 >
1 row found.
Command> call ttconfiguration(‘datastore’);
< DataStore, /home/oracle/TimesTen/tt1122/info/DemoDataStore/repdb1_1122 >

更简洁的方法

除了在sys.ttconnect.ini中定义外,还可以在连接属性中直接定义。
使用的属性有ttc_server, ttc_server_dsn和tcp_port
关键是tcp_port,指的是timesten server port,即daemon port + 1。

从任意客户端连接到tt1122的cachedb1可以用:

$ ttIsqlCS -connstr "ttc_server=timesten-hol;tcp_port=53393;ttc_server_dsn=cachedb1;uid=tthr;pwd=timesten" 

从任意客户端连接到ttnew的cachedb2可以用:

ttIsqlCS -connstr "ttc_server=timesten-hol;tcp_port=55556;ttc_server_dsn=cachedb2;uid=tthr;pwd=timesten"

总结

逻辑服务器名用于使用非TCP/IP的通讯协议或者TimesTen Server不在缺省的端口监听时。
逻辑服务器名在sys.ttconnect.ini中定义,指向的是目标服务器的网络地址和Daemon使用的端口。而实际的DSN则在对方的DSN文件中定义。
逻辑服务器名在客户端的DSN文件中使用,用TTC_SERVER指定逻辑服务器名,用TTC_SERVER_DSN指定对方的DSN。
逻辑服务器的属性还可以直接在连接属性中定义。

参考

  • TimesTen Operation Guide | Working with the TimesTen Client and Server | Configuring TimesTen Client and Server | Defining a logical server name
  • TimesTen Client Connection Failed With Error: (Doc ID 1571037.1)

这篇关于TimesTen的逻辑服务器名概念的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/677693

相关文章

Linux查询服务器 IP 地址的命令详解

《Linux查询服务器IP地址的命令详解》在服务器管理和网络运维中,快速准确地获取服务器的IP地址是一项基本但至关重要的技能,下面我们来看看Linux中查询服务器IP的相关命令使用吧... 目录一、hostname 命令:简单高效的 IP 查询工具命令详解实际应用技巧注意事项二、ip 命令:新一代网络配置全

一文带你迅速搞懂路由器/交换机/光猫三者概念区别

《一文带你迅速搞懂路由器/交换机/光猫三者概念区别》讨论网络设备时,常提及路由器、交换机及光猫等词汇,日常生活、工作中,这些设备至关重要,居家上网、企业内部沟通乃至互联网冲浪皆无法脱离其影响力,本文将... 当谈论网络设备时,我们常常会听到路由器、交换机和光猫这几个名词。它们是构建现代网络基础设施的关键组成

Python开发简易网络服务器的示例详解(新手入门)

《Python开发简易网络服务器的示例详解(新手入门)》网络服务器是互联网基础设施的核心组件,它本质上是一个持续运行的程序,负责监听特定端口,本文将使用Python开发一个简单的网络服务器,感兴趣的小... 目录网络服务器基础概念python内置服务器模块1. HTTP服务器模块2. Socket服务器模块

Linux查询服务器系统版本号的多种方法

《Linux查询服务器系统版本号的多种方法》在Linux系统管理和维护工作中,了解当前操作系统的版本信息是最基础也是最重要的操作之一,系统版本不仅关系到软件兼容性、安全更新策略,还直接影响到故障排查和... 目录一、引言:系统版本查询的重要性二、基础命令解析:cat /etc/Centos-release详

Python WSGI HTTP服务器Gunicorn使用详解

《PythonWSGIHTTP服务器Gunicorn使用详解》Gunicorn是Python的WSGI服务器,用于部署Flask/Django应用,性能高且稳定,支持多Worker类型与配置,可处... 目录一、什么是 Gunicorn?二、为什么需要Gunicorn?三、安装Gunicorn四、基本使用启

mybatisplus的逻辑删除过程

《mybatisplus的逻辑删除过程》:本文主要介绍mybatisplus的逻辑删除过程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录myBATisplus的逻辑删除1、在配置文件中添加逻辑删除的字段2、在实体类上加上@TableLogic3、业务层正常删除即

通过配置nginx访问服务器静态资源的过程

《通过配置nginx访问服务器静态资源的过程》文章介绍了图片存储路径设置、Nginx服务器配置及通过http://192.168.206.170:8007/a.png访问图片的方法,涵盖图片管理与服务... 目录1.图片存储路径2.nginx配置3.访问图片方式总结1.图片存储路径2.nginx配置

Python极速搭建局域网文件共享服务器完整指南

《Python极速搭建局域网文件共享服务器完整指南》在办公室或家庭局域网中快速共享文件时,许多人会选择第三方工具或云存储服务,但这些方案往往存在隐私泄露风险或需要复杂配置,下面我们就来看看如何使用Py... 目录一、android基础版:HTTP文件共享的魔法命令1. 一行代码启动HTTP服务器2. 关键参

SpringBoot改造MCP服务器的详细说明(StreamableHTTP 类型)

《SpringBoot改造MCP服务器的详细说明(StreamableHTTP类型)》本文介绍了SpringBoot如何实现MCPStreamableHTTP服务器,并且使用CherryStudio... 目录SpringBoot改造MCP服务器(StreamableHTTP)1 项目说明2 使用说明2.1

MySQL逻辑删除与唯一索引冲突解决方案

《MySQL逻辑删除与唯一索引冲突解决方案》本文探讨MySQL逻辑删除与唯一索引冲突问题,提出四种解决方案:复合索引+时间戳、修改唯一字段、历史表、业务层校验,推荐方案1和方案3,适用于不同场景,感兴... 目录问题背景问题复现解决方案解决方案1.复合唯一索引 + 时间戳删除字段解决方案2:删除后修改唯一字