Timesten在linux 上面的安装步骤

Timesten在linux 上面的安装步骤(转载)  最近正在学习Timesten 以后一定会用到 先转载下来备用

安装文件:otn.oracle.com

Linux: red-hat ES3, SUSE9

CPU:intel EM64

1. 内核参数调整:

1) sysctl和limit

修改 sysctl.conf

  1. net.ipv4.tcp_rmem=4096 4194304 4194304   
  2.  net.ipv4.tcp_wmem=98304 4194304 4194304   
  3.  net.ipv4.tcp_mem=98304 4194304 4194304   
  4.  net.core.rmem_default=262144   
  5.  net.core.wmem_default=262144   
  6.  net.core.rmem_max=4194304   
  7.  net.core.wmem_max=4194304   
  8.  net.ipv4.tcp_window_scaling=1   
  9.   
  10.  # shmmax根据内存大小和系统位数设置(注意32位/64位)   
  11.  kernel.shmmax=7782579200   
  12.  kernel.sem=5000 32000 100 128   
  13.  net.ipv4.ip_local_port_range=1024 65000   

 

修改limits.conf

 

  1. echo "* hard nofile 8192" >> /etc/security/limits.conf   
  2. echo "* soft nofile 8192" >> /etc/security/limits.conf   


2. 新建timsten用户

 

  1. groupadd -g 600 timesten   
  2.  useradd -g 600 -u 600 timesten   
  3.  passwd timesten  

3. 安装

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

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

4. 环境配置

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

 

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

5. 增加数据库用户

  1. [timesten@flypig timesten]$ source ~timesten/.profile   
  2.  [timesten@flypig]$ttisql TT_tt70   
  3.  Command> create user tt_test identified by 'tt_test';   
  4.  Command> grant ddl,admin to tt_test;   
  5.  Command> grant write to tt_test;   
  6.  Command> grant SELECT to tt_test;   
  7.  Command> quit  

6. 增加用户DSN

  1. [timesten@flypig timesten]$mkdir –p /opt/TimesTen/imdb   
  2.  [timesten@flypig timesten]$vi /opt/TimesTen/tt70/info/sys.odbc.ini   
  3.  在 [ODBC Data Sources]下面增加:   
  4.  imdb=TimesTen 7.0 Driver   
  5.  在最后面增加:   
  6.  [imdb]   
  7.  Driver=/opt/TimesTen/tt70/lib/libtten.so   
  8.  DataStore=/opt/TimesTen/imdb/imdb   
  9.  DatabaseCharacterSet=US7ASCII   
  10.  Authenticate=0   
  11.  UID=tt_test   
  12.  PWD=tt_test   
  13.  #ipcs memory size(M),该内存大”匦氡萻hmmax小,否则用户DSN会进不去   
  14.  PermSize=5000   
  15.  Connections=2047   
  16.  #permsize*20%   
  17.  TempSize=1000   
  18.  CkptFrequency=600   
  19.  CkptLogVolume=256   
  20.  LogBuffSize=256000   
  21.  LogFileSize=256   
  22.  测试用户DSN:   
  23.  [timesten@flypig timesten]$ttisql imdb   
  24.  连接成功出现command命令行则配置没有问题!   
  25.   

7. 数据对象安装

 

  1. [timesten@flypig timesten]$ttisql imdb   
  2.  Command> 执行标准SQL语句   
  3.  或者:将SQL语句写在文本里,如imdb.schema.20070507   
  4.  执行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

  1. [timesten@Timestentimesten]$ttisql imdb   
  2.  Command> create active standby pair   
  3.  IMDB on "Timesten1", IMDB on Timesten2"  
  4.  store IMDB on Timesten1"  
  5.  port 20000   
  6.  store IMDB on Timesten2"  
  7.  port 21000;   

 

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

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

 

  1. [timesten@Timestentimesten]$ttisql imdb   
  2.  Command> call ttRepStateSet(‘active’);   
  3.  [timesten@Timestentimesten]ttAdmin –repStart imdb  

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

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

8) 启动Timesten2的replication agent

[timesten@Timesten2 timesten]$ ttAdmin –repStart imdb

9) 检查状态

  1. [timesten@Timestentimesten]$ ttisql imdb   
  2.  Command> call ttRepStateGet;   
  3.  < ACTIVE >   
  4.   
  5. [timesten@Timestentimesten]$ ttisql imdb   
  6.  Command> call ttRepStateGet;   
  7.  < STANDBY >   
  8.   
  9. [timesten@timestentimesten]$ ttRepAdmin -showstatus imdb   
  10.  Replication Agent Status as of: 2007-04-21 17:28:19   
  11.  DSN : imdb   
  12.  Process ID : 21805 (Started)   
  13.  Replication Agent Policy : manual   
  14.  Host : TIMESTEN2   
  15.  RepListener Port : 20000   
  16.  Last write LSN : 37.202777232   
  17.  Last LSN forced to disk : 37.202659240   
  18.  Replication hold LSN : 37.200869520   
  19.  Replication Peers:   
  20.  Name : IMDB   
  21.  Host : TIMESTEN1   
  22.  Port : 0 (Not Connected)   
  23.  Replication State : STARTED   
  24.  Communication Protocol : 23   
  25.  TRANSMITTER thread(s):   
  26.  For : IMDB   
  27.  Start/Restart count : 1   
  28.  Send LSN : 36.83383088   
  29.  Transactions sent : 0   
  30.  Total packets sent : 0   
  31.  Tick packets sent : 0   
  32.  Total Packets received: 0   
  33.  RECEIVER thread(s):   
  34.  For : IMDB   
  35.  Start/Restart count : 1   
  36.  Transactions received : 317358   
  37.  Total packets sent : 8709   
  38.  Tick packets sent : 0   
  39.  MIN sent packet size : 64   
  40.  MAX sent packet size : 128   
  41.  AVG sent packet size : 119   
  42.  Last packet sent at : 17:28:19   
  43.  Total Packets received: 2238899   
  44.  MIN rcvd packet size : 64   
  45.  MAX rcvd packet size : 426   
  46.  AVG rcvd packet size : 131   
  47.  Last packet rcvd'd at : 17:28:19   
  48.   
  49. [timesten@timesten1 test]$ ttRepAdmin -showstatus imdb   
  50.  Replication Agent Status as of: 2007-04-21 17:29:44   
  51.  DSN : imdb   
  52.  Process ID : 12368 (Started)   
  53.  Replication Agent Policy : manual   
  54.  Host : TIMESTEN1   
  55.  RepListener Port : 21000   
  56.  Last write LSN : 38.450704   
  57.  Last LSN forced to disk : 38.434608   
  58.  Replication hold LSN : 37.266666832   
  59.  Replication Peers:   
  60.  Name : IMDB   
  61.  Host : TIMESTEN2   
  62.  Port : 20000 (Connected)   
  63.  Replication State : STARTED   
  64.  Communication Protocol : 23   
  65.  TRANSMITTER thread(s):   
  66.  For : IMDB1   
  67.  Start/Restart count : 191   
  68.  Send LSN : 36.82703464   
  69.  Transactions sent : 375248   
  70.  Total packets sent : 27879   
  71.  Tick packets sent : 16   
  72.  MIN sent packet size : 15   
  73.  MAX sent packet size : 16384   
  74.  AVG sent packet size : 12443   
  75.  Last packet sent at : 17:29:44   
  76.  Total Packets received: 10634   
  77.  MIN rcvd packet size : 64   
  78.  MAX rcvd packet size : 128   
  79.  AVG rcvd packet size : 113   
  80.  Last packet rcvd'd at : 17:29:44   
  81.  Earlier errors (max 5):   
  82.  TT16224 in transmitter.c (line 5752) at 17:10:20 on 04-21-2007   
  83.  TT16224 in transmitter.c (line 5752) at 17:19:49 on 04-21-2007   
  84.  [timesten@timesten1 test]$   
  85.   

9. 客户端安装

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

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

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

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

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

SERVER就是我们上面配的Timesten Server

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

  1. [timesten@flypig timesten]$ vi .profile   
  2.   
  3. . /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

转自:http://blog.sina.com.cn/s/blog_6187f3a10100eoa8.html

猜你喜欢

转载自appleses.iteye.com/blog/2303354