Timesten安装

来源:互联网 发布:成都麻将打5元算法图片 编辑:程序博客网 时间:2024/04/28 20:44

安装文件:otn.oracle.com

Linux: red-hat ES3, SUSE9

CPU:intel EM64

1. 内核参数调整:

1) sysctl和limit

修改 sysctl.conf

net.ipv4.tcp_rmem=4096 4194304 4194304
net.ipv4.tcp_wmem=98304 4194304 4194304
net.ipv4.tcp_mem=98304 4194304 4194304
net.core.rmem_default=262144
net.core.wmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_max=4194304
net.ipv4.tcp_window_scaling=1

# shmmax根据内存大小和系统位数设置(注意32位/64位)
kernel.shmmax=7782579200
kernel.sem=5000 32000 100 128
net.ipv4.ip_local_port_range=1024 65000

修改limits.conf

echo “* hard nofile 8192″ >> /etc/security/limits.conf
echo “* soft nofile 8192″ >> /etc/security/limits.conf


2. 新建timsten用户

groupadd -g 600 timesten
useradd -g 600 -u 600 timesten
passwd timesten

3. 安装

首先安装JDK(64位系统需安装JDK 64版本)

[root@flypig timesten]#mkdir /etc/TimesTen/
[root@flypig timesten]#chown timesten:timesten /etc/TimesTen/
su – timesten
cd $TIMESTEN_PRODUCT
./setup.sh
Please choose an instance name for this installation? [ tt70 ]
Timesten版本选择:安装AMD64和Intel EM64的版本
Timesten产品选择:Oracle TimesTen In-Memory Database
Timesten组件选择:Client/Server and Data Manager
安装目录:/opt
是否打开 access control:yes
daemon log位置:/opt/TimesTen/log
没有特别说明的部分,都默认回车

4. 环境配置

在/home/timesten/.bash_profile中添加以下行(SUSE9下面是.profile)

. /opt/TimesTen/tt70/bin/ttenv.sh
export JAVA_HOME=/opt/java

5. 增加数据库用户

[timesten@flypig timesten]$ source ~timesten/.profile
[timesten@flypig]$ttisql TT_tt70
Command> create user tt_test identified by ‘tt_test’;
Command> grant ddl,admin to tt_test;
Command> grant write to tt_test;
Command> grant Select to tt_test;
Command> quit

6. 增加用户DSN

[timesten@flypig timesten]$mkdir –p /opt/TimesTen/imdb
[timesten@flypig timesten]$vi /opt/TimesTen/tt70/info/sys.odbc.ini
在 [ODBC Data Sources]下面增加:
imdb=TimesTen 7.0 Driver
在最后面增加:
[imdb]
Driver=/opt/TimesTen/tt70/lib/libtten.so
DataStore=/opt/TimesTen/imdb/imdb
DatabaseCharacterSet=US7ASCII
Authenticate=0
UID=tt_test
PWD=tt_test
#ipcs memory size(M),该内存大小必须比shmmax小,否则用户DSN会进不去
PermSize=5000
Connections=2047
#permsize*20%
TempSize=1000
CkptFrequency=600
CkptLogVolume=256
LogBuffSize=256000
LogFileSize=256
测试用户DSN:
[timesten@flypig timesten]$ttisql imdb
连接成功出现command命令行则配置没有问题!

7. 数据对象安装

[timesten@flypig timesten]$ttisql imdb
Command> 执行标准SQL语句
或者:将SQL语句写在文本里,如imdb.schema.20070507
执行ttisql –f imdb.schema.20070507

8. Active/Standby数据库配置

1) 在另外台服务器上安装新的一套Timesten,配置同上,两台Timesten记为Timesten1和Timesten2,准备将Timesten1为Active,Timesten2为Standby
2) 在/etc/hosts里面加入各台Timesten
3) 同步Timesten1和Timesten2的时间,最好用ntp之类的定时(20分钟)同步一下时钟,否则replication就会失败
4) 在Timesten1上安装好所有的用户数据库对象
5) 创建replication的schema

[timesten@Timesten1 timesten]$ttisql imdb
Command> create active standby pair
IMDB on “Timesten1″, IMDB on ” Timesten2″
store IMDB on ” Timesten1″
port 20000
store IMDB on ” Timesten2″
port 21000;

说明:
Timesten1、Timesten2为hostname
IMDB为用户DSN

6) 将Timesten1置为active,启动replication agent

[timesten@Timesten1 timesten]$ttisql imdb
Command> call ttRepStateSet(‘active’);
[timesten@Timesten1 timesten]ttAdmin –repStart imdb

7) 退出连到imdb(Timesten2)的所有连接,从imdb(Timesten1)复制数据库

[timesten@Timesten2 timesten]$ ttRepAdmin -duplicate -from imdb -host timesten1 -UID tt_test -PWD tt_test imdb
如果出现imdb为in use错误,用ttDestory删除imdb,再试
[timesten@Timesten2 timesten]$ ttDestroy imdb

 启动Timesten2的replication agent

[timesten@Timesten2 timesten]$ ttAdmin –repStart imdb

9) 检查状态

[timesten@Timesten1 timesten]$ ttisql imdb
Command> call ttRepStateGet;
< ACTIVE >

[timesten@Timesten2 timesten]$ ttisql imdb
Command> call ttRepStateGet;
< STANDBY >

[timesten@timesten2 timesten]$ ttRepAdmin -showstatus imdb
Replication Agent Status as of: 2007-04-21 17:28:19
DSN : imdb
Process ID : 21805 (Started)
Replication Agent Policy : manual
Host : TIMESTEN2
RepListener Port : 20000
Last write LSN : 37.202777232
Last LSN forced to disk : 37.202659240
Replication hold LSN : 37.200869520
Replication Peers:
Name : IMDB
Host : TIMESTEN1
Port : 0 (Not Connected)
Replication State : STARTED
Communication Protocol : 23
TRANSMITTER thread(s):
For : IMDB
Start/Restart count : 1
Send LSN : 36.83383088
Transactions sent : 0
Total packets sent : 0
Tick packets sent : 0
Total Packets received: 0
RECEIVER thread(s):
For : IMDB
Start/Restart count : 1
Transactions received : 317358
Total packets sent : 8709
Tick packets sent : 0
MIN sent packet size : 64
MAX sent packet size : 128
AVG sent packet size : 119
Last packet sent at : 17:28:19
Total Packets received: 2238899
MIN rcvd packet size : 64
MAX rcvd packet size : 426
AVG rcvd packet size : 131
Last packet rcvd’d at : 17:28:19

[timesten@timesten1 test]$ ttRepAdmin -showstatus imdb
Replication Agent Status as of: 2007-04-21 17:29:44
DSN : imdb
Process ID : 12368 (Started)
Replication Agent Policy : manual
Host : TIMESTEN1
RepListener Port : 21000
Last write LSN : 38.450704
Last LSN forced to disk : 38.434608
Replication hold LSN : 37.266666832
Replication Peers:
Name : IMDB
Host : TIMESTEN2
Port : 20000 (Connected)
Replication State : STARTED
Communication Protocol : 23
TRANSMITTER thread(s):
For : IMDB1
Start/Restart count : 191
Send LSN : 36.82703464
Transactions sent : 375248
Total packets sent : 27879
Tick packets sent : 16
MIN sent packet size : 15
MAX sent packet size : 16384
AVG sent packet size : 12443
Last packet sent at : 17:29:44
Total Packets received: 10634
MIN rcvd packet size : 64
MAX rcvd packet size : 128
AVG rcvd packet size : 113
Last packet rcvd’d at : 17:29:44
Earlier errors (max 5):
TT16224 in transmitter.c (line 5752) at 17:10:20 on 04-21-2007
TT16224 in transmitter.c (line 5752) at 17:19:49 on 04-21-2007
[timesten@timesten1 test]$

9. 客户端安装

参考以上服务器的安装过程,安装组件选择:[3] Client Only,配置ODBC:

1) 在sys.ttconnect.ini增加Timesten Server

[timesten@flypig timesten]$ vi /opt/TimesTen/tt70/info/sys.ttconnect.ini
增加Timesten Server:
[imdb]
Description=TimesTen Server
Network_Address=10.2.0.99
TCP_PORT=17003

默认情况下,64位Timesten的port是17003,32位试17002
2) 在sys.odbc.ini增加DSN配置

[timesten@flypig timesten]$ vi /opt/TimesTen/tt70/info/sys.odbc.ini
增加DSN:
[imdb]
TTC_SERVER=imdb
TTC_SERVER_DSN=imdb

SERVER就是我们上面配的Timesten Server

3) 在客户机的profile中增加:

[timesten@flypig timesten]$ vi .profile

. /opt/TimesTen/tt70/bin/ttenv.sh

4) 测试配置:

[timesten@flypig timesten]$ ttisqlcs imdb
ttisql在自身服务器上使用,ttisqlcs在客户机上使用

10. 常用命令列表

/opt/TimesTen/tt70/startup/tt_tt70:Timesten起停 
ttSize:计算表大小,如 ttSize -tbl tt_ref imdb 
ipcs:共享内存查看 
ttAdmin –repStop:停replication agent,如 ttAdmin –repStop imdb 
ttAdmin –repStart:起replication agent,如 ttAdmin –repStart imdb 
drop ACTIVE STANDBY PAIR:删除replication配置,ttisql命令 
ttRepAdmin -showconfig:显示repliation配置信息,如ttRepAdmin –showconfig imdb 
ttRepAdmin -showstatus:显示repliation配置信息,如ttRepAdmin –showstatus imdb 
CALL ttRepStateSet(’ACTIVE’);:Replication状态置为active,ttisql命令 
ttDestroy:删除用户DSN所有数据,如ttDestroy imdb 
ttRepAdmin -duplicat:数据库之间复制,如ttRepAdmin -duplicate -from imdb1 -host timesten1 -UID tt_test -PWD tt_test imdb2 
Alter ACTIVE STANDBY PAIR:加复制表,standby机子需要重新复制数据库,如Alter ACTIVE STANDBY PAIR 
INCLUDE TABLE tab1 ttisql

call ttRepStateGet; :获取Replication状态(active/standby),ttisql命令 
ttDaemonLog:Timesten的日志查看,-f可以tail日志 
tables 显示数据库表,ttisql命令 
ttAdmin -ramPolicy:修改ram策略,如 ttAdmin -ramPolicy always imdb 
ttAdmin -repPolicy:修改replication策略,如 ttAdmin -repPolicy always imdb 
11. 已知问题和处理方法

Replication失效: 
1) 确认各台机子的replication agent都在,可以用ttRepAdmin –showstatus命令
2) 确认两台主机的时间一致,不一样的话日志中会有错误信息:
ttDaemonLog | grep Err
17:13:27.61 Err : REP: 12368: IMDB1:transmitter.c(5752): TT16224: Transmitter thread failure due to high clock skew 943 with peer store IMDB3

无法在netapp上使用Timesten 
1) mount参数加exec
2) 修改/opt/TimesTen/tt70/info/ttendaemon.options,在里面加-allowNetworkFiles

原创粉丝点击