ITeye博客

Timesten在linux 上面的安装步骤

Appleses · 2016-06-06 16:57 · 数据库 · Markdown

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. # shmmax根据内存大小和系统位数设置(注意32位/64位)
  10. kernel.shmmax=7782579200
  11. kernel.sem=5000 32000 100 128
  12. 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. 没有特别说明的部分,都默认回车

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命令行则配置没有问题!

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@Timesten1 timesten]$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@Timesten1 timesten]$ttisql imdb
  2. Command> call ttRepStateSet(‘active’);
  3. [timesten@Timesten1 timesten]ttAdmin –repStart imdb

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

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

8) 启动Timesten2的replication agent

[timesten@Timesten2 timesten]$ ttAdmin –repStart imdb

9) 检查状态

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

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. . /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

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。