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

相关文章

MySQL MCP 服务器安装配置最佳实践

《MySQLMCP服务器安装配置最佳实践》本文介绍MySQLMCP服务器的安装配置方法,本文结合实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下... 目录mysql MCP 服务器安装配置指南简介功能特点安装方法数据库配置使用MCP Inspector进行调试开发指

在Windows上使用qemu安装ubuntu24.04服务器的详细指南

《在Windows上使用qemu安装ubuntu24.04服务器的详细指南》本文介绍了在Windows上使用QEMU安装Ubuntu24.04的全流程:安装QEMU、准备ISO镜像、创建虚拟磁盘、配置... 目录1. 安装QEMU环境2. 准备Ubuntu 24.04镜像3. 启动QEMU安装Ubuntu4

MySQL 事务的概念及ACID属性和使用详解

《MySQL事务的概念及ACID属性和使用详解》MySQL通过多线程实现存储工作,因此在并发访问场景中,事务确保了数据操作的一致性和可靠性,下面通过本文给大家介绍MySQL事务的概念及ACID属性和... 目录一、什么是事务二、事务的属性及使用2.1 事务的 ACID 属性2.2 为什么存在事务2.3 事务

Windows Server 2025 搭建NPS-Radius服务器的步骤

《WindowsServer2025搭建NPS-Radius服务器的步骤》本文主要介绍了通过微软的NPS角色实现一个Radius服务器,身份验证和证书使用微软ADCS、ADDS,具有一定的参考价... 目录简介示意图什么是 802.1X?核心作用802.1X的组成角色工作流程简述802.1X常见应用802.

使用Nginx配置文件服务器方式

《使用Nginx配置文件服务器方式》:本文主要介绍使用Nginx配置文件服务器方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录1. 为什么选择 Nginx 作为文件服务器?2. 环境准备3. 配置 Nginx 文件服务器4. 将文件放入服务器目录5. 启动 N

Go语言开发实现查询IP信息的MCP服务器

《Go语言开发实现查询IP信息的MCP服务器》随着MCP的快速普及和广泛应用,MCP服务器也层出不穷,本文将详细介绍如何在Go语言中使用go-mcp库来开发一个查询IP信息的MCP... 目录前言mcp-ip-geo 服务器目录结构说明查询 IP 信息功能实现工具实现工具管理查询单个 IP 信息工具的实现服

springboot上传zip包并解压至服务器nginx目录方式

《springboot上传zip包并解压至服务器nginx目录方式》:本文主要介绍springboot上传zip包并解压至服务器nginx目录方式,具有很好的参考价值,希望对大家有所帮助,如有错误... 目录springboot上传zip包并解压至服务器nginx目录1.首先需要引入zip相关jar包2.然

将Java项目提交到云服务器的流程步骤

《将Java项目提交到云服务器的流程步骤》所谓将项目提交到云服务器即将你的项目打成一个jar包然后提交到云服务器即可,因此我们需要准备服务器环境为:Linux+JDK+MariDB(MySQL)+Gi... 目录1. 安装 jdk1.1 查看 jdk 版本1.2 下载 jdk2. 安装 mariadb(my

Python 迭代器和生成器概念及场景分析

《Python迭代器和生成器概念及场景分析》yield是Python中实现惰性计算和协程的核心工具,结合send()、throw()、close()等方法,能够构建高效、灵活的数据流和控制流模型,这... 目录迭代器的介绍自定义迭代器省略的迭代器生产器的介绍yield的普通用法yield的高级用法yidle

基于Python打造一个可视化FTP服务器

《基于Python打造一个可视化FTP服务器》在日常办公和团队协作中,文件共享是一个不可或缺的需求,所以本文将使用Python+Tkinter+pyftpdlib开发一款可视化FTP服务器,有需要的小... 目录1. 概述2. 功能介绍3. 如何使用4. 代码解析5. 运行效果6.相关源码7. 总结与展望1