TimesTen学习(一)安装篇

TimesTen学习(一)安装篇

一.Linux平台安装准备工作。
1.大页设置
1).修改HugePage配置值:
echo 32 > /proc/sys/vm/nr_hugepages

2).查看HugePage值:
[root@ttdb ~]# cat /proc/meminfo | grep Huge
HugePages_Total:    28
HugePages_Free:     28
HugePages_Rsvd:      0
Hugepagesize:     2048 kB

2.信号量
1).查看当前值:
[root@ttdb ~]# /sbin/sysctl -a | grep sem
kernel.sem = 250        32000   32      128

2).推荐值:
kernel.sem = 400 32000 100 128

3).使设置生效:
/sbin/sysctl -p

3.共享内存
        kernel.shmmax=2147483648(单位:字节byte)。如果配置大于8GB,那么也应该增加shmall参数的值,这个值应该等于SHMMAX/PAGE_SIZE,在x86系统Page的大小通常为4K,在安腾平台通常为16K,例如,在安腾64GB的数据库,应该指定以下的参数值:
kernel.shmmax=68719476736
kernel.shmall=4194304

1).配置shmmax和shmall参数:
在没有重启的情况下,执行以下的命令修改共享内存的值:
/sbin/sysctl -w kernel.shmmax=2147483648
也可以通过以下命令修改这个值:
echo 2147483648 > /proc/sys/kernel/shmmax
这个命令与执行sysctl命令有相同的效果。

2).查看共享内存值:
cat /proc/sys/kernel/shmmax

        注意:如果操作系统使用的是Redhat,从Redhat Enterprise 5.4开始,shmmax和shmall这两个值已经足够的大,默认不需要修改。

4.复制
1).配置网络参数
针对复制,TCP发送和接收buffers应该增加到4MB,在/etc/sysctl.conf文件加入以下行:
net.ipv4.tcp_rmem=4096 4194304 4194304
net.ipv4.tcp_wmem=98304 4194304 4194304
net.core.rmem_default=65535
net.core.wmem_default=65535
net.core.rmem_max=4194304
net.core.wmem_max=4194304
net.ipv4.tcp_window_scaling=1

2).使配置生效
重启服务器或者运行以下命令:
#/sbin/sysctl -p

5.IMDB Cache
1).配置网络参数
针对IMDB Cache,TCP发送和接收buffers应该增加得更大,修改/etc/sysctl.conf文件添加以下行:
net.ipv4.tcp_rmem=4096 4194304 4194304
net.ipv4.tcp_wmem=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
net.ipv4.ip_local_port_range=1024 65000

2).使配置生效
重启或者运行以下命令:
#/sbin/sysctl -p

6.有关目录
        在UNIX平台TimesTen的默认安装目录是:$HOME/TimesTen。TimesTen在安装过程中会创建临时文件,其他大的操作,例如,大的删除操作、拷贝文件也会使用到临时目录。临时目录依赖于操作系统,Solaris和Linux通常是/tmp目录,AIX通常是/var/tmp目录。在Windows平台通过设置TMP环境变量可以改变临时目录的位置,在UNIX平台,通过设置TMPDIR环境变量可以改变临时目录的位置。

7.有关系统组
        在UNIX平台,TimesTen实例管理组和TimesTen用户组是相同的或者不同的操作系统组。

1).TimesTen实例管理组。
        任何安装TimesTen的用户必须是这个组的成员,这个组必须被授予读和写访问/etc/TimesTen目录的权限,/etc/TimesTen目录包括安装在这台电脑上所有TimesTen实例的信息。

2).TimesTen用户组。
         实例管理员必须也是这个组的成员,去安装TimesTen。安装完成之后,只有这个操作系统组的成员被允许直接驱动连接到TimesTen,在TimesTen数据库上执行操作。

8.目录和文件权限
        在UNIX平台,TimesTen在/etc/TimesTen目录中维护着在服务器上安装的所有TimesTen实例的注册信息。实例注册不是必须要求这步操作,但是正确安装和卸载TimesTen这个文件是必不可少的。在安装之前,确保安装TimesTen的系统用户是管理组的成员,对/etc/TimesTen目录有正确的读写权限。

1).创建TimesTen用户组
#groupadd timesten

2).创建TimesTen实例注册表和管理员组
#mkdir /etc/TimesTen
#groupadd ttadmin
#chgrp -R ttadmin /etc/TimesTen
#chmod 770 /etc/TimesTen/
#chmod 660 /etc/TimesTen/*

3).创建TimesTen安装用户
#useradd -g ttadmin -G timesten timesten

tt管理员组应该是主组。

二.安装TimesTen。
        TimesTen的安装文件只有200多M,可以看出跟Oracle Database的安装介质相比还是有差距的,TimesTen的安装是文本的方式。下面是安装过程:
[timesten@ttdb linux8664]$ ./setup.sh

NOTE: Each TimesTen installation is identified by a unique instance name.
      The instance name must be a non-null alphanumeric string, not longer
      than 255 characters.

Please choose an instance name for this installation? [ tt1122 ] 
Instance name will be 'tt1122'.
Is this correct? [ yes ] 

Of the three components:

  [1] Client/Server and Data Manager
  [2] Data Manager Only
  [3] Client Only

Which would you like to install? [ 1 ] 

Of the following options :

  [1] /home/timesten
  [2] /opt/soft
  [3] Specify a location
  [q] Quit the installation

Where would you like to install the tt1122 instance of TimesTen? [ 1 ] (TimesTen实例安装的位置)
Where would you like to create the daemon home directory? [ /home/timesten/TimesTen/tt1122/info ](守护进程目录位置) 

The daemon logs will be located in /home/timesten/TimesTen/tt1122/info
Would you like to specify a different location for the daemon logs? [ no ] (守护进程日志目录位置)
Installing into /home/timesten/TimesTen/tt1122 ...
Uncompressing ...

NOTE: If you are configuring TimesTen for use with Oracle Clusterware, the
      daemon port number must be the same across all TimesTen installations
      managed within the same Oracle Clusterware cluster.

NOTE: All installations that replicate to each other must use the same daemon
      port number that is set at installation time. The daemon port number can
      be verified by running 'ttVersion'.

The default port number is 53396.

Do you want to use the default port number for the TimesTen daemon? [ yes ] (守护进程的端口号)
The daemon will run on the default port number (53396).

NOTE: For security, we recommend that you restrict access to the
      TimesTen installation to members of a single OS group. Only members of
      that OS group will be allowed to perform. direct mode connections to
      TimesTen, and only members of that OS group will be allowed to perform
      operations that access TimesTen data stores, TimesTen files and shared
      memory. The OS group defaults to the primary group of the instance
      administrator. You can default to this group, choose another OS group
      or you can make this instance world-accessible. If you choose to make
      this instance world-accessible, all database files and shared memory
      are readable and writable by all users.

Restrict access to the the TimesTen installation to the group 'ttadmin'? [ yes ] 

NOTE: Enabling PL/SQL will increase the size of some TimesTen libraries.

Would you like to enable PL/SQL for this instance? [ yes ] (可以通过ttmodadmin工具之后再启用)

In order to use the 'In-Memory Database Cache' feature in any databases
created within this installation, you must set a value for the TNS_ADMIN
environment variable. It can be left blank, and a value can be supplied later
using <install_dir>/bin/ttModInstall.

Please enter a value for TNS_ADMIN (s=skip)? [  ] /home/timesten/TimesTen/(和Oracle Database的含义相同,在指定的位置查找tnsnames.ora文件,可以保留为空,如果在安装的时候未指定TNS_ADMIN环境变量,可以使用ttmodadmin工具修改该值,在使用In-Memory Database Cache之前必须设置好这个环境变量)

TNS_ADMIN will be set to /home/timesten/TimesTen
You can change TNS_ADMIN later by running <install_dir>/bin/ttmodinstall.


Installing server components ...
What is the TCP/IP port number that you want the TimesTen Server to listen on? [ 53397 ] (TimesTen服务器端口号)
Do you want to install QuickStart and the TimesTen Documentation? [ no ] 
Would you like to install the documentation (without QuickStart)? [ yes ] 
Where would you like to create the doc directory (s=skip)? [ /home/timesten/TimesTen/tt1122/doc ] 
The TimesTen documentation has been installed in /home/timesten/TimesTen/tt1122/doc.
Installing client components ...

Would you like to use TimesTen Replication with Oracle Clusterware? [ no ] 

NOTE: The TimesTen daemon startup/shutdown scripts have not been installed.

Run the 'setuproot' script.:
cd /home/timesten/TimesTen/tt1122/bin
./setuproot -install(timesten自动执行这个命令,执行这个命令之后,服务器被重启之后,TimesTen实例能被自动启动)
This will move the TimesTen startup script. into its appropriate location.

The startup script. is currently located here :
  '/home/timesten/TimesTen/tt1122/startup/tt_tt1122'.

The 11.2.2.2 Release Notes are located here :
  '/home/timesten/TimesTen/tt1122/README.html'

Starting the daemon ...(启动守护进程,守护进程在守护进程的启动目录下写一个timestend.pid文件,默认是install_dir/info,这个文件包含守护进程的进程ID。当停止守护进程,这个ID用于确定终止的进程,当进程被终止,timestend.pid文件被移除)
TimesTen Daemon startup OK.
End of TimesTen installation.

下面是setup.sh脚本的参数:
TimesTen学习(一)安装篇

三.TimesTen守护进程。
        当操作系统被引导,TimesTen主守护进程(timestend)自动启动,在后台频繁的操作。TimesTen主守护进程启动脚本,如果安装的是TimesTen服务器,当TimesTen守护进程被开始,该脚本被自动开始。当TimesTen守护进程被停止,该脚本被自动停止。

        注意:必须是TimesTen实例的管理员或者root权限起停TimesTen守护进程。

1).使用以下的命令手动停止守护进程:
ttDaemonAdmin -stop
2).使用以下的命令手动启动守护进程:
ttDaemonAdmin -start

四.TimesTen常用的管理工具。

1).查看版本:
[timesten@ttdb bin]$ ./ttVersion
TimesTen Release 11.2.2.2.0 (64 bit Linux/x86_64) (tt1122:12345) 2011-12-23T09:26:28Z
  Instance admin: timesten
  Instance home directory: /home/timesten/TimesTen/tt1122
  Group owner: ttadmin
  Daemon home directory: /home/timesten/TimesTen/tt1122/info
  PL/SQL enabled.

2).修改守护进程端口号:
[timesten@ttdb bin]$ ./ttmodinstall -port 12345
Are you sure you want to change the daemon port number from 53396 to 12345? [ yes ]          
NOTE: The daemon will be stopped before changing port numbers.
Would you like to proceed with modifying the installation? [ yes ] 
TimesTen Daemon stopped.
Changing the daemon port number ...
Patching successful ...
The daemon will now run on port 12345 ...
Restarting the daemon ...
ttDaemonAdmin: daemon is not running
TimesTen Daemon startup OK.
NOTE: To change the server port, run ttmodinstall without the -port option.

注意:守护进程端口号和服务器端口号是不同的。

五.卸载TimesTen。
        在UNIX卸载TimesTen以TimesTen实例管理员登录,执行以下的命令卸载TimesTen:
$install_dir/bin/setup.sh -uninstall

TimesTen学习(一)安装篇setup参数.jpg

上一篇:【HeadFirst 设计模式学习笔记】21 备忘录(Memento)模式拾零


下一篇:重构——47以明确函数取代参数(Replace Parameter with Explicit Methods)