TimesTen Scaleout 18.1 安装配置

1.环境检查(xag200,201,202,203,204 合计5台电脑)

数据实例规划
主机名 elementId#(元素) replicasetId#(复制集) dataspaceId#(数据空间)
xag201 1 1 1
xag202 2 1 2
xag203 3 2 1
xag204 4 2 2

理解 复制集:
如果设置k为2,则每个复制集包含两个元素(其中每个元素是副本集中另一个元素的精确副本),等同于双主,如下图 instance 1、instance 2 为一个复制集
理解 数据空间:
如完整的数据库由两个数据中心A、B组成(每个数据中心都有完整的数据),但A数据中心瘫痪时,在B数据中心还保存完整的数据,业务继续运行。

image.png
规划:
 xag200:管理实例(Management instances) +  ZooKeeper 服务
 xag201、xag202 、xag203、xag204 :数据实例(Data instances)

[root@xag200 java]# hostname
xag200.com

[root@xag200 java]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.40.200 xag200  xag200.com
192.168.40.201 xag201  xag201.com
192.168.40.202 xag202  xag202.com
192.168.40.203 xag203  xag203.com
192.168.40.204 xag204  xag204.com

[root@xag200 java]# java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
  1. 添加用户、组
#xag200,201,202,203,204 
groupadd oinstall
useradd -g oinstall -d /home/timesten timesten
passwd timesten

[timesten@xag204 ~]$ pwd
/home/timesten
[timesten@xag204 ~]$ vim .bash_profile 
#加如下行
. /grid/instance1/bin/ttenv.sh

[timesten@xag204 ~]$ source .bash_profile 

#xag200
mkdir -p /grid/tmp
mkdir -p /grid/installation1

#xag201,202,203,204
mkdir -p /grid

#all
chown -R timesten:oinstall /grid/
chmod -R 775 /grid/

3.解压缩(xag200 [ 未特别说明以下都是在xag200中运行 ] )

[timesten@xag200 tmp]$ pwd
/grid/tmp
[timesten@xag200 tmp]$ ls
timesten181320.server.linux8664.zip
[timesten@xag200 tmp]$ unzip timesten181320.server.linux8664.zip -d /grid/installation1

[timesten@xag200 installation1]$ pwd
/grid/installation1
[timesten@xag200 installation1]$ ls
tt18.1.3.2.0

4.配置参数

#xag200 (物理内存2.5g 【shmmax =2.5*0.8=2g】)
[root@xag200 java]# id timesten
uid=1000(timesten) gid=1000(oinstall) groups=1000(oinstall)

[root@xag200 java]# cat /etc/sysctl.conf
kernel.shmmax = 2147483648
kernel.shmall = 524288
kernel.sem = 4000 10240000 2000 2560
vm.nr_hugepages=512
vm.hugetlb_shm_group = 1000

cat /etc/security/limits.conf
...
timesten soft memlock 2097152   # =kernel.shmmax /1024 【单位k】
timesten hard memlock 2097152 #同上

#xag201,202,203,204 (物理内存1024m 【shmmax =1024*0.8=516m】)
[root@xag201 java]# id timesten
uid=1000(timesten) gid=1000(oinstall) groups=1000(oinstall)

[root@xag201 java]# cat /etc/sysctl.conf
kernel.shmmax = 536870912
kernel.shmall = 131072
kernel.sem = 4000 10240000 2000 2560
vm.nr_hugepages=256
vm.hugetlb_shm_group = 1000

cat /etc/security/limits.conf
...
timesten soft memlock 524288
timesten hard memlock 524288
  1. 验证安装
[timesten@xag200 tmp]$ cd /grid/installation1/tt18.1.3.2.0/bin/
[timesten@xag200 bin]$ pwd
/grid/installation1/tt18.1.3.2.0/bin

[timesten@xag200 bin]$ ./ttInstallationCheck
This installation has been verified.
  1. 配置ssh
[timesten@xag200 bin]$ /grid/installation1/tt18.1.3.2.0/bin/ttGridAdmin gridSshConfig -mgmtAddress xag200 -dataAddress xag201 xag202 xag203 xag204
Enter password:
Setup ssh configuration on local system...............................OK
Setup ssh configuration on xag200.....................................OK
Setup ssh configuration on xag201.....................................OK
Setup ssh configuration on xag202.....................................OK
Setup ssh configuration on xag203.....................................OK
Setup ssh configuration on xag204.....................................OK
Setup passwordless ssh from local system to xag200....................OK
Setup passwordless ssh from local system to xag201....................OK
Setup passwordless ssh from local system to xag202....................OK
Setup passwordless ssh from local system to xag203....................OK
Setup passwordless ssh from local system to xag204....................OK
Setup passwordless ssh from xag200 to xag200..........................OK
Setup passwordless ssh from xag200 to xag201..........................OK
Setup passwordless ssh from xag200 to xag202..........................OK
Setup passwordless ssh from xag200 to xag203..........................OK
Setup passwordless ssh from xag200 to xag204..........................OK
Setup passwordless ssh from xag201 to xag200..........................OK
Setup passwordless ssh from xag202 to xag200..........................OK
Setup passwordless ssh from xag203 to xag200..........................OK
Setup passwordless ssh from xag204 to xag200..........................OK

Passwordless ssh working between hosts:

From\To xag200 xag201 xag202 xag203 xag204 
------- ------ ------ ------ ------ ------ 
*us*    Yes    Yes    Yes    Yes    Yes    
xag200  Yes    Yes    Yes    Yes    Yes    
xag201  Yes    N/A    N/A    N/A    N/A    
xag202  Yes    N/A    N/A    N/A    N/A    
xag203  Yes    N/A    N/A    N/A    N/A    
xag204  Yes    N/A    N/A    N/A    N/A

7.Install ZooKeeper for TimesTen Scaleout

[timesten@XAG200 grid]$ mkdir -p /grid/membership
[timesten@xag200 grid]$ tar -zvxf /grid/installation1/tt18.1.3.2.0/3rdparty/zookeeper-3.4.14.tar.gz -C /grid/membership

vim /grid/membership/zookeeper-3.4.14/conf/zoo.cfg
------------------------------------------------
tickTime=250
initLimit=40
syncLimit=12
dataDir=/grid/membership/data
clientPort=2181
autopurge.snapRetainCount=3
autopurge.purgeInterval=1
server.1=xag200:2888:3888
-------------------------------------------------

vim  /grid/membership/membership.conf
-------------------------------------------------
Servers xag200.com!2181
-------------------------------------------------

[timesten@XAG200 grid]$ mkdir -p /grid/membership/data

#启动
[timesten@xag200 grid]$ /grid/membership/zookeeper-3.4.14/bin/zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /grid/membership/zookeeper-3.4.14/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

[timesten@xag200 grid]$ /grid/membership/zookeeper-3.4.14/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /grid/membership/zookeeper-3.4.14/bin/../conf/zoo.cfg
Mode: standalone

8.Rollout a 2x2 grid

[timesten@xag200 grid]$ /grid/installation1/tt18.1.3.2.0/bin/ttInstanceCreate -name instance1 -location /grid -grid

[timesten@xag200 grid]$ source /grid/instance1/bin/ttenv.sh

[timesten@xag200 grid]$ ttGridAdmin gridCreate grid1 -k 2 -internalAddress xag200 -externalAddress xag200.com -membershipConfig /grid/membership/membership.conf
-------------------------------------------------------------------------------------------
  1. Adding data instances
#( [dataSpaceGroup 1:xag201,xag203] , [dataSpaceGroup 1:xag202,xag204] )
[timesten@xag200 grid]$ 
ttGridAdmin hostCreate -internalAddress xag201 -externalAddress xag201.com -dataSpaceGroup 1
Host xag201 created in Model

[timesten@xag200 grid]$ 
ttGridAdmin installationCreate xag201 -location /grid
Installation installation1 on Host xag201 created in Model

[timesten@xag200 grid]$ 
ttGridAdmin instanceCreate xag201 -location /grid
Instance instance1 on Host xag201 created in Model

[timesten@xag200 grid]$ 
ttGridAdmin hostCreate -internalAddress xag202 -externalAddress xag202.com -like xag201 -cascade -dataSpaceGroup 2
Host xag202 created in Model
Installation installation1 created in Model
Instance instance1 created in Model

[timesten@xag200 grid]$ 
ttGridAdmin hostCreate -internalAddress xag203 -externalAddress xag203.com -like xag201 -cascade

[timesten@xag200 grid]$ 
ttGridAdmin hostCreate -internalAddress xag204 -externalAddress xag204.com -like xag202 -cascade 
  1. Apply the latest version of the model
[timesten@xag200 grid]$ ttGridAdmin modelApply
Creating new model version............................................OK
Exporting current model (version 1)...................................OK
Identifying any changed management instances..........................OK
Identifying any deleted objects.......................................OK
Verifying installations...............................................OK
Creating new installations............................................OK
Verifying instances...................................................OK
Creating new instances................................................OK
Updating grid state...................................................OK
Configuring instance authentication...................................OK
Pushing new configuration files to each instance......................OK
Making model version 1 current, version 2 writable....................OK
Verifying ssh connectivity of new instances...........................OK
Starting new data instances...........................................OK
ttGridAdmin modelApply complete
  1. Setting instances to automatically start at system startup(可选项)
#每台管理+数据实例(xag200,xag201,xag202,xag203,xag204)
[root@xag201 grid]# /grid/instance1/bin/setuproot -install
  1. 检查&创建database
[timesten@xag200 ~]$ /grid/instance1/bin/ttenv ttGridAdmin dbStatus
Error 2: No databases exist

[timesten@xag200 ~]$ mkdir -p /grid/config/
#所有数据主机
[timesten@xag201 ~]$ mkdir -p /grid/db
[timesten@xag201 ~]$ mkdir -p /grid/logs

[timesten@xag200 ~]$ vim /grid/config/database1.dbdef
[timesten@xag200 ~]$ cat /grid/config/database1.dbdef
DataStore=/grid/db/database1
LogDir=/grid/logs
DatabaseCharacterSet=AL32UTF8
Durability=0
PermSize=64
TempSize=64
LogBufMB=32
Connections=128

[timesten@xag200 ~]$ ttGridAdmin dbdefCreate /grid/config/database1.dbdef
Database Definition database1 created.

[timesten@xag200 grid]$ ttGridAdmin modelApply
Creating new model version............................................OK
Exporting current model (version 2)...................................OK
Identifying any changed management instances..........................OK
Identifying any deleted objects.......................................OK
Verifying installations...............................................OK
Verifying instances...................................................OK
Updating grid state...................................................OK
Pushing new configuration files to each instance......................OK
Making model version 2 current, version 3 writable....................OK
ttGridAdmin modelApply complete

[timesten@xag200 ~]$ ttGridAdmin dbCreate database1
Database database1 creation started

[timesten@xag200 grid]$ ttGridAdmin dbStatus database1 -element
Database database1 element level status as of Thu Feb 20 18:17:11 CST 2020

Host   Instance  Elem Status   Date/Time of Event  Message 
------ --------- ---- -------- ------------------- ------- 
xag201 instance1    1 creating 2020-02-20 18:16:54         
xag202 instance1    2 creating 2020-02-20 18:16:54         
xag203 instance1    3 creating 2020-02-20 18:16:54         
xag204 instance1    4 creating 2020-02-20 18:16:54         

[timesten@xag200 grid]$ ttGridAdmin dbStatus database1 -element
Database database1 element level status as of Thu Feb 20 18:17:19 CST 2020
Host   Instance  Elem Status   Date/Time of Event  Message 
------ --------- ---- -------- ------------------- ------- 
xag201 instance1    1 loaded   2020-02-20 18:17:16         
xag202 instance1    2 loaded   2020-02-20 18:17:18         
xag203 instance1    3 loaded   2020-02-20 18:17:16         
xag204 instance1    4 loaded   2020-02-20 18:17:16

# Define the distribution map of the database
[timesten@xag200 ~]$ ttGridAdmin dbDistribute database1 -add all -apply
Distribution map updated

[timesten@xag200 grid]$ ttGridAdmin dbOpen database1
Database database1 open started

[timesten@xag200 grid]$ ttGridAdmin dbStatus database1 -element
Database database1 element level status as of Thu Feb 20 18:20:46 CST 2020
Host   Instance  Elem Status Date/Time of Event  Message 
------ --------- ---- ------ ------------------- ------- 
xag201 instance1    1 opened 2020-02-20 18:20:42         
xag202 instance1    2 opened 2020-02-20 18:20:43         
xag203 instance1    3 opened 2020-02-20 18:20:43         
xag204 instance1    4 opened 2020-02-20 18:20:42      
  1. 连接测试(各数据实例xag201 .. xag204)
#可连接的客户端/服务器测试
[timesten@xag200 config]$ cat /grid/config/database1CS.connect 
ConnectionCharacterSet = AL32UTF8
UID = terry

[timesten@xag200 config]$ ttGridAdmin connectableCreate -dbdef database1 -cs /grid/config/database1CS.connect
Connectable database1CS created.

[timesten@xag200 config]$ ttGridAdmin modelApply
Creating new model version............................................OK
Exporting current model (version 5)...................................OK
Identifying any changed management instances..........................OK
Identifying any deleted objects.......................................OK
Verifying installations...............................................OK
Verifying instances...................................................OK
Updating grid state...................................................OK
Pushing new configuration files to each instance......................OK
Making model version 5 current, version 6 writable....................OK
ttGridAdmin modelApply complete

[timesten@xag200 config]$ ttGridAdmin gridClientExport /grid/config/sys.odbc.ini

[timesten@xag200 config]$ cat /grid/config/sys.odbc.ini
-----------------------------------------
[ODBC Data Sources]
database1CS=TimesTen 18.1 Client Driver
 
[database1CS]
TTC_SERVER_DSN=DATABASE1
# External address/port info for xag201.instance1
TTC_SERVER1=xag201.com/6625
# External address/port info for xag202.instance1
TTC_SERVER2=xag202.com/6625
# External address/port info for xag203.instance1
TTC_SERVER3=xag203.com/6625
# External address/port info for xag204.instance1
TTC_SERVER4=xag204.com/6625
ConnectionCharacterSet=AL32UTF8
UID=terry
--------------------------------------------

[timesten@xag201 ~]$ ttIsqlCS -connStr "DSN=database1CS"
Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.
connect "DSN=database1CS";
 7001: User authentication failed
The command failed.
Done.

[timesten@XAG816 hrschema]$ ttIsql -v1 -connStr "DSN=database1"
Command> create user terry identified by timesten;
Command> grant create session,create table,create view,create sequence to terry;

#xag201,xag202,xag203,xag204 效果一致
[timesten@xag201 ~]$ ttIsqlCS -connStr "DSN=database1CS"
Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.
connect "DSN=database1CS";
Enter password for 'terry': 
Connection successful: DSN=database1CS;TTC_SERVER=xag201.com;TTC_SERVER_DSN=DATABASE1;UID=terry;DURABILITY=0;DATASTORE=/grid/db/database1;DATABASECHARACTERSET=AL32UTF8;CONNECTIONCHARACTERSET=AL32UTF8;WAITFORCONNECT=0;LOGBUFMB=32;LOGDIR=/grid/logs;PERMSIZE=64;TEMPSIZE=64;CONNECTIONS=128;
(Default setting AutoCommit=1)
----------------------------------------------------------------------------------------------------

#直连测试
[timesten@xag201 grid]$ source /grid/instance1/bin/ttenv.sh
[timesten@xag201 config]$ ttIsql -connStr "DSN=database1"

Command> CALL ttConfiguration('ttGridEnable');
< TTGridEnable, 1 >
1 row found.

CREATE TABLE test1 
(
    cust_id            NUMBER(10,0) NOT NULL PRIMARY KEY,
    cust_name          VARCHAR2(30) NOT NULL   
) DISTRIBUTE BY HASH;

#xag201
insert into test1 values(1,'xag1');
insert into test1 values(11,'xag11');
insert into test1 values(12,'xag12');

#xag202
insert into test1 values(2,'xag2');
#xag203
insert into test1 values(3,'xag3');
#xag204
insert into test1 values(4,'xag4');

Command> select * from test1;
< 1, xag1 >
< 2, xag2 >
< 4, xag4 >
< 3, xag3 >
< 11, xag11 >
< 12, xag12 >
  1. 停程序
[timesten@xag200 grid]$  /grid/instance1/bin/ttenv ttGridAdmin dbStatus
Database database1 summary status as of Thu Feb 20 18:39:28 CST 2020
created,loaded-complete,open
Completely created elements: 4 (of 4)
Completely loaded elements: 4 (of 4) 
Completely created replica sets: 2 (of 2) 
Completely loaded replica sets: 2 (of 2) 
Open elements: 4 (of 4) 

[timesten@xag200 grid]$ ttGridAdmin dbclose -wait database1
Database database1 closed

#关闭连接
[timesten@xag200 grid]$ ttGridAdmin dbDisconnect database1 -transactional
Database database1 dbDisconnect started

[timesten@xag200 grid]$ ttGridAdmin dbDisconnectStatus database1
Database  Host   Instance  Elem State         Started                  
--------- ------ --------- ---- ------------- ------------------------ 
database1                       Disconnecting 2020-02-20T19:07:39.000Z 
          xag201 instance1    1 Disconnecting                          
          xag202 instance1    2 Disconnecting                          
          xag203 instance1    3 Disconnecting                          
          xag204 instance1    4 Disconnecting 

[timesten@xag200 grid]$ ttGridAdmin dbStatus database1 -connections
Host   Instance  ConnId Name      Pid   Type   CHost CAddr CPid 
------ --------- ------ --------- ----- ------ ----- ----- ---- 
xag201 instance1      1 database1  3211 Server                  
xag202 instance1      1 database1 12313 Server                  
xag203 instance1      1 database1 12285 Server                  
xag204 instance1      1 database1 12301 Server 

[timesten@xag200 grid]$ ttGridAdmin dbStatus database1 -element
Database database1 element level status as of Thu Feb 20 18:43:15 CST 2020
Host   Instance  Elem Status Date/Time of Event  Message 
------ --------- ---- ------ ------------------- ------- 
xag201 instance1    1 loaded 2020-02-20 18:41:34         
xag202 instance1    2 loaded 2020-02-20 18:41:34         
xag203 instance1    3 loaded 2020-02-20 18:41:34         
xag204 instance1    4 loaded 2020-02-20 18:41:34         

[[timesten@xag200 grid]$ ttGridAdmin dbunload -wait database1
Error 92: Database cannot be unloaded. Database has open user connections.

[timesten@xag200 grid]$ ttGridAdmin dbDisconnect database1 -immediate 
Database database1 dbDisconnect started

[timesten@xag200 grid]$ ttGridAdmin dbDisconnectStatus database1
Database  Host   Instance  Elem State        Started                  
--------- ------ --------- ---- ------------ ------------------------ 
database1                       Complete     2020-02-20T19:14:38.000Z 
          xag201 instance1    1 Disconnected                          
          xag202 instance1    2 Disconnected                          
          xag203 instance1    3 Disconnected                          
          xag204 instance1    4 Disconnected                          

[timesten@xag200 grid]$ ttGridAdmin dbStatus database1 -connections
Host Instance ConnId Name Pid Type CHost CAddr CPid 
---- -------- ------ ---- --- ---- ----- ----- ---- 

[timesten@xag200 grid]$ ttGridAdmin dbunload -wait database1
Database database1 unloaded

[timesten@xag200 grid]$ ttGridAdmin dbStatus database1 -element
Database database1 element level status as of Thu Feb 20 19:17:23 CST 2020
Host   Instance  Elem Status   Date/Time of Event  Message 
------ --------- ---- -------- ------------------- ------- 
xag201 instance1    1 unloaded 2020-02-20 19:17:12         
xag202 instance1    2 unloaded 2020-02-20 19:17:11         
xag203 instance1    3 unloaded 2020-02-20 19:17:12         
xag204 instance1    4 unloaded 2020-02-20 19:17:12 

#Stop all data instances.
[timesten@xag200 grid]$ ttGridAdmin instanceExec -type data ttDaemonAdmin -stop
Overall return code: 0
Commands executed on:
  - xag203.instance1 rc 0
  - xag204.instance1 rc 0
  - xag202.instance1 rc 0
  - xag201.instance1 rc 0
Return code from xag203.instance1: 0
Output from xag203.instance1:
TimesTen Daemon (PID: 11532, port: 6624) stopped.
Return code from xag204.instance1: 0
Output from xag204.instance1:
TimesTen Daemon (PID: 11533, port: 6624) stopped.
Return code from xag202.instance1: 0
Output from xag202.instance1:
TimesTen Daemon (PID: 11573, port: 6624) stopped.
Return code from xag201.instance1: 0
Output from xag201.instance1:
TimesTen Daemon (PID: 2273, port: 6624) stopped.

#If there is an standby management instance, stop it.(可选)
ttGridAdmin mgmtStandbyStop

#Stop the active management instance.
[timesten@xag200 grid]$ ttGridAdmin mgmtActiveStop
Active management instance stopped and reconfigured

[timesten@xag200 grid]$ /grid/membership/zookeeper-3.4.14/bin/zkServer.sh stop
ZooKeeper JMX enabled by default
Using config: /grid/membership/zookeeper-3.4.14/bin/../conf/zoo.cfg
Stopping zookeeper ... STOPPED
  1. 启动程序
[timesten@xag200 grid]$ /grid/membership/zookeeper-3.4.14/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /grid/membership/zookeeper-3.4.14/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.

[timesten@xag200 grid]$ /grid/membership/zookeeper-3.4.14/bin/zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /grid/membership/zookeeper-3.4.14/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

[timesten@xag200 grid]$ /grid/membership/zookeeper-3.4.14/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /grid/membership/zookeeper-3.4.14/bin/../conf/zoo.cfg
Mode: standalone

[timesten@xag200 grid]$ source /grid/instance1/bin/ttenv.sh

[timesten@xag200 grid]$ ttGridAdmin dbStatus
Error 252: Can not get membership: this instance is down

[timesten@xag200 grid]$ ttGridAdmin mgmtStatus
Host   Instance  Reachable RepRole(Self) Role(Self) Seq RepAgent RepActive Message                              
------ --------- --------- ------------- ---------- --- -------- --------- ------------------------------------ 
xag200 instance1 No        Only          Unknown        N/A      N/A       Management database is not available 

[timesten@xag200 ~]$ ttGridAdmin mgmtExamine
The only defined management instance is down. Start it.
Recommendation: define a second management instance
Host   Instance  Reachable RepRole(Self) Role(Self) Seq RepAgent RepActive Message                              
------ --------- --------- ------------- ---------- --- -------- --------- --------------------------- 
xag200 instance1 No        Only          Unknown        N/A      N/A       Management database is not available 
Recommended commands:
ssh -o StrictHostKeyChecking=yes -o PasswordAuthentication=no -x xag200 /grid/instance1/bin/ttenv ttDaemonAdmin -start

[timesten@xag200 ~]$ ssh -o StrictHostKeyChecking=yes -o PasswordAuthentication=no -x xag200 /grid/instance1/bin/ttenv ttDaemonAdmin -start
TimesTen Daemon (PID: 3943, port: 6624) startup OK.

[timesten@xag200 ~]$ ttGridAdmin mgmtExamine
The only defined management instance is up. No action required.
Recommendation: define a second management instance
Host   Instance  Reachable RepRole(Self) Role(Self) Seq  RepAgent RepActive Message 
------ --------- --------- ------------- ---------- ---- -------- --------- ------- 
xag200 instance1 Yes       Only          Active     1601 N/A      N/A   

#If your grid has a single management instance configuration
#如已执行上面 ttGridAdmin mgmtExamine 命令输出的推荐命令则下面的启动命令无需再做
[timesten@xag200 grid]$ ttGridAdmin mgmtActiveStart
This management instance is now the active

#Start your data instances
[timesten@xag200 grid]$ ttGridAdmin instanceExec -type data ttDaemonAdmin -start
Overall return code: 0
Commands executed on:
  - xag204.instance1 rc 0
  - xag203.instance1 rc 0
  - xag201.instance1 rc 0
  - xag202.instance1 rc 0
Return code from xag204.instance1: 0
Output from xag204.instance1:
TimesTen Daemon (PID: 12063, port: 6624) startup OK.
Return code from xag203.instance1: 0
Output from xag203.instance1:
TimesTen Daemon (PID: 12055, port: 6624) startup OK.
Return code from xag201.instance1: 0
Output from xag201.instance1:
TimesTen Daemon (PID: 2968, port: 6624) startup OK.
Return code from xag202.instance1: 0
Output from xag202.instance1:
TimesTen Daemon (PID: 12094, port: 6624) startup OK.

[timesten@xag200 grid]$ ttGridAdmin dbStatus database1 -element
Database database1 element level status as of Thu Feb 20 18:59:56 CST 2020
Host   Instance  Elem Status   Date/Time of Event  Message 
------ --------- ---- -------- ------------------- ------- 
xag201 instance1    1 unloaded 2020-02-20 18:44:24         
xag202 instance1    2 unloaded 2020-02-20 18:44:24         
xag203 instance1    3 unloaded 2020-02-20 18:44:24         
xag204 instance1    4 unloaded 2020-02-20 18:44:24 

[timesten@xag200 grid]$ ttGridAdmin dbload -wait database1
Database database1 loaded

[timesten@xag200 grid]$ ttGridAdmin dbopen -wait database1
Database database1 opened

[timesten@xag200 grid]$ ttGridAdmin dbStatus database1 -element
Database database1 element level status as of Thu Feb 20 19:02:41 CST 2020
Host   Instance  Elem Status Date/Time of Event  Message 
------ --------- ---- ------ ------------------- ------- 
xag201 instance1    1 opened 2020-02-20 19:02:34         
xag202 instance1    2 opened 2020-02-20 19:02:34         
xag203 instance1    3 opened 2020-02-20 19:02:34         
xag204 instance1    4 opened 2020-02-20 19:02:34 
  1. 其他维护
# 停某个实例
[timesten@xag200 ~]$ ttGridAdmin instanceExec -only xag201.instance1 ttDaemonAdmin -stop
Overall return code: 0
Commands executed on:
  - xag201.instance1 rc 0
Return code from xag201.instance1: 0
Output from xag201.instance1:
TimesTen Daemon (PID: 1162, port: 6624) stopped.

#启动单个实例 
[timesten@xag200 ~]$ ttGridAdmin instanceExec -only xag202.instance1 ttDaemonAdmin -start
Overall return code: 0
Commands executed on:
  - xag202.instance1 rc 0
Return code from xag202.instance1: 0
Output from xag202.instance1:
TimesTen Daemon (PID: 1586, port: 6624) startup OK.

---------------------------------------------------------------------------------------------------
#RS:复制集    DS:数据空间     Elem:元素
[timesten@xag200 ~]$ ttGridAdmin dbStatus database1 -all 
Database database1 summary status as of Sat Feb 22 17:21:06 CST 2020

created,loaded-complete,open
Completely created elements: 4 (of 4)
Completely loaded elements: 4 (of 4) 
Completely created replica sets: 2 (of 2) 
Completely loaded replica sets: 2 (of 2) 

Open elements: 4 (of 4) 

Database database1 element level status as of Sat Feb 22 17:21:06 CST 2020

Host   Instance  Elem Status Date/Time of Event  Message 
------ --------- ---- ------ ------------------- ------- 
xag201 instance1    1 opened 2020-02-22 17:20:34         
xag202 instance1    2 opened 2020-02-22 17:20:34         
xag203 instance1    3 opened 2020-02-22 17:20:33         
xag204 instance1    4 opened 2020-02-22 17:20:34         

Database database1 Replica Set status as of Sat Feb 22 17:21:06 CST 2020

RS DS Elem Host   Instance  Status Date/Time of Event  Message 
-- -- ---- ------ --------- ------ ------------------- ------- 
 1  1    1 xag201 instance1 opened 2020-02-22 17:20:34         
 1  2    2 xag202 instance1 opened 2020-02-22 17:20:34         
 2  1    3 xag203 instance1 opened 2020-02-22 17:20:33         
 2  2    4 xag204 instance1 opened 2020-02-22 17:20:34         

Database database1 Data Space Group status as of Sat Feb 22 17:21:06 CST 2020

DS RS Elem Host   Instance  Status Date/Time of Event  Message 
-- -- ---- ------ --------- ------ ------------------- ------- 
 1  1    1 xag201 instance1 opened 2020-02-22 17:20:34         
 1  2    3 xag203 instance1 opened 2020-02-22 17:20:33         
 2  1    2 xag202 instance1 opened 2020-02-22 17:20:34         
 2  2    4 xag204 instance1 opened 2020-02-22 17:20:34 
----------------------------------------------------------------------------------------------------
  1. 数据查询
timesten@xag201 ~]$ ttIsql -connStr "DSN=database1"
Command> select elementId#,replicasetId#,dataspaceId# from dual;
< 1, 1, 1 >
Command> select elementId#,replicasetId#,dataspaceId#,t.* from test1 t order by cust_id;
< 1, 1, 1, 1, xag01 >
< 1, 1, 1, 2, xag2 >
< 3, 2, 1, 3, xag3 >
< 1, 1, 1, 4, xag4 >
< 3, 2, 1, 11, xag11 >
< 3, 2, 1, 12, xag12 >
Command> select /*+TT_GridQueryExec(LOCAL)*/ elementId#,replicasetId#,dataspaceId#,t.* from test1 t order by cust_id;
< 1, 1, 1, 1, xag01 >
< 1, 1, 1, 2, xag2 >
< 1, 1, 1, 4, xag4 >
Command> select /*+TT_GridQueryExec(GLOBAL)*/elementId#,replicasetId#,dataspaceId#,t.* from test1 t order by cust_id;
< 1, 1, 1, 1, xag01 >
< 2, 1, 2, 1, xag01 >
< 1, 1, 1, 2, xag2 >
< 2, 1, 2, 2, xag2 >
< 4, 2, 2, 3, xag3 >
< 3, 2, 1, 3, xag3 >
< 1, 1, 1, 4, xag4 >
< 2, 1, 2, 4, xag4 >
< 4, 2, 2, 11, xag11 >
< 3, 2, 1, 11, xag11 >
< 4, 2, 2, 12, xag12 >
< 3, 2, 1, 12, xag12 >

# /*+TT_PartialResult(0)*/ 是缺省配置
Command> select /*+TT_PartialResult(0)*/ elementId#,replicasetId#,dataspaceId#,t.* from test1 t order by cust_id;
< 1, 1, 1, 1, xag01 >
< 1, 1, 1, 2, xag2 >
< 3, 2, 1, 3, xag3 >
< 1, 1, 1, 4, xag4 >
< 3, 2, 1, 11, xag11 >
< 3, 2, 1, 12, xag12 >
[timesten@xag200 ~]$ ttGridAdmin instanceExec -only xag203.instance1 ttDaemonAdmin -stop
Command> select /*+TT_PartialResult(0)*/ elementId#,replicasetId#,dataspaceId#,t.* from test1 t order by cust_id;
< 1, 1, 1, 1, xag01 >
< 1, 1, 1, 2, xag2 >
< 4, 2, 2, 3, xag3 >
< 1, 1, 1, 4, xag4 >
< 4, 2, 2, 11, xag11 >
< 4, 2, 2, 12, xag12 >
[timesten@xag200 ~]$ ttGridAdmin instanceExec -only xag204.instance1 ttDaemonAdmin -stop
Command> select /*+TT_PartialResult(0)*/ elementId#,replicasetId#,dataspaceId#,t.* from test1 t order by cust_id;
 3723: Replica set 2 down
The command failed.

Command> select /*+TT_PartialResult(1)*/ elementId#,replicasetId#,dataspaceId#,t.* from test1 t order by cust_id;
< 1, 1, 1, 1, xag01 >
< 1, 1, 1, 2, xag2 >
< 1, 1, 1, 4, xag4 >

-------------------------------------------------------------------------------------------------
timesten@xag202 ~]$ ttIsql -connStr "DSN=database1"
Command> select elementId#,replicasetId#,dataspaceId# from dual;
< 2, 1, 2 >
Command> select elementId#,replicasetId#,dataspaceId#,t.* from test1 t order by cust_id;
< 2, 1, 2, 1, xag01 >
< 2, 1, 2, 2, xag2 >
< 4, 2, 2, 3, xag3 >
< 2, 1, 2, 4, xag4 >
< 4, 2, 2, 11, xag11 >
< 4, 2, 2, 12, xag12 >
Command> select /*+TT_GridQueryExec(LOCAL)*/ elementId#,replicasetId#,dataspaceId#,t.* from test1 t order by cust_id;
< 2, 1, 2, 1, xag01 >
< 2, 1, 2, 2, xag2 >
< 2, 1, 2, 4, xag4 >
-------------------------------------------------------------------------------------------------

timesten@xag203 ~]$ ttIsql -connStr "DSN=database1"
Command> select elementId#,replicasetId#,dataspaceId# from dual;
< 3, 2, 1 >
Command> select elementId#,replicasetId#,dataspaceId#,t.* from test1 t order by cust_id;
< 1, 1, 1, 1, xag01 >
< 1, 1, 1, 2, xag2 >
< 3, 2, 1, 3, xag3 >
< 1, 1, 1, 4, xag4 >
< 3, 2, 1, 11, xag11 >
< 3, 2, 1, 12, xag12 >
Command> select /*+TT_GridQueryExec(LOCAL)*/ elementId#,replicasetId#,dataspaceId#,t.* from test1 t order by cust_id;
< 3, 2, 1, 3, xag3 >
< 3, 2, 1, 11, xag11 >
< 3, 2, 1, 12, xag12 >
-------------------------------------------------------------------------------------------------

timesten@xag204 ~]$ ttIsql -connStr "DSN=database1"
Command> select elementId#,replicasetId#,dataspaceId# from dual;
< 4, 2, 2 >
Command> select elementId#,replicasetId#,dataspaceId#,t.* from test1 t order by cust_id;
< 2, 1, 2, 1, xag01 >
< 2, 1, 2, 2, xag2 >
< 4, 2, 2, 3, xag3 >
< 2, 1, 2, 4, xag4 >
< 4, 2, 2, 11, xag11 >
< 4, 2, 2, 12, xag12 >
Command> select /*+TT_GridQueryExec(LOCAL)*/ elementId#,replicasetId#,dataspaceId#,t.* from test1 t order by cust_id;
< 4, 2, 2, 3, xag3 >
< 4, 2, 2, 11, xag11 >
< 4, 2, 2, 12, xag12 >

你可能感兴趣的:(TimesTen Scaleout 18.1 安装配置)