Timesten安裝筆記 參考

season0891發表於2009-04-27
本文轉自 :http://www.itpub.net/archiver/tid-884574.html

Timesten安裝筆記 參考


安裝檔案: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

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/90618/viewspace-591974/,如需轉載,請註明出處,否則將追究法律責任。

相關文章