一、 准備
操作系統 :Linux, 內核版本2.6
需要軟件:tpccuva-1.2.3, postgresql-8.1.15, gnuplot-4.2.5。
tccuva是實現標准TPC-C。
Postgresql是最穩定的開源sql數據庫。
gunplot是一個數學軟件,可以根據數據畫出相應的函數圖形。
二、 安裝
1. 創建用戶
[root@RedHat /]# useradd -m tpcctest
[root@RedHat /]# passwd tpcctest(密碼自行創建)
以tpcctest身份登錄到系統
[root@RedHat /]# su tpcctest
[tpcctest@RedHat /]$
創建相關目錄
tpcctest@linux:>mkdir $HOME/tpcc-uva
tpcctest@linux:>mkdir $HOME/tpcc-uva/pgsql
tpcctest@linux:>mkdir $HOME/tpcc-uva/bin
2. 安裝PostgreSQL
1)執行下列命令安裝PostgreSQL數據庫
tpcctest@linux:> ./configure --prefix=$HOME/tpcc-uva/pgsql
tpcctest@linux:>gmake
tpcctest@linux:>gmake install
2)修改PATH和LD_LIBRARY_PATH環境變量。
3)編輯~/.bash_profile文件,添加以下內容
PATH=/usr/local/pgsql/bin:$PATH
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/pgsql/lib
export PATH LD_LIBRARY_PATH
4)執行下面的命令,使修改的環境變量生效。
tpcctest@linux :> source ~/.bash_profile
5)輸入以下命令,檢驗環境變量的修改是否生效
tpcctest@linux:> which initdb
如果修改正確,則會輸出以下信息
$HOME/tpcc-uva/bin/initdb
6) 啟動PostgreSQL
tpcctest@linux:>initdb -D $HOME/tpcc-uva/pgsql/data
tpcctest@linux:> postmaster -D $HOME/tpcc-uva/pgsql/data >log.out 2>log.err&
每次重啟系統後都要執行上面的命令來啟動PostgreSQL。
7)修改PostgreSQL的參數
修改$HOME/tpcc-uva/pgsql/data/postgresql.conf
將#checkpoint_segments = 3 # in logfile segments (16MB each), min 1
替換為checkpoint_segments = 10 # in logfile segments (16MB each), min 1
將#checkpoint_timeout = 300 # in seconds, range 30-3600
替換為checkpoint_timeout = 3600 # in seconds, range 30-3600
8)強制PostgreSQL重新讀取配置文件
tpcctest@linux:>killall -HUP postmaster
3. 安裝gnuplot
解壓gnuplot後,進入gnuplot的源代碼的目錄,執行下列命令安裝
tpcctest@linux:> ./configure --prefix=$HOME/tpcc-uva/bin --without-x
tpcctest@linux:> make
tpcctest@linux:> make install
4. 安裝tpcc-uva.
將tpcc-uva的安裝包放在$HOME/tpcc-uva目錄下
解壓,進入解壓後的目錄,執行下列命令安裝
tpcctest@linux:> make
tpcctest@linux:> make install
更多見下一頁: http://www.linuxidc.com/Linux/2013-07/87987p2.htm