本篇主要介紹在linux環(huán)境下以命令行方式來準(zhǔn)備安裝sybase所需要的裸設(shè)備分區(qū)揽惹、卷組秋忙、邏輯卷等。
一. 裸設(shè)備相關(guān)的知識(shí):
1.什么叫做裸設(shè)備医咨? 裸設(shè)備枫匾,也叫裸分區(qū)(原始分區(qū)),是一種沒有經(jīng)過格式化拟淮,不被Linux通過文件系統(tǒng)來讀取的特殊字符設(shè)備干茉。它由應(yīng)用程序負(fù)責(zé)對(duì)它進(jìn)行讀寫操作。不經(jīng)過文件系統(tǒng)的緩沖很泊。
2.使用裸設(shè)備的好處 因?yàn)槭褂寐阍O(shè)備避免了再經(jīng)過操作系統(tǒng)這一層角虫,數(shù)據(jù)直接從Disk到應(yīng)用進(jìn)行傳輸,所以使用裸設(shè)備對(duì)于讀寫頻繁的數(shù)據(jù)庫(kù)應(yīng)用來說委造,可以極大地提高數(shù)據(jù)庫(kù)系統(tǒng)的性能戳鹅。當(dāng)然,這是以磁盤的 I/O 非常大昏兆,磁盤I/O已經(jīng)稱為系統(tǒng)瓶頸的情況下才成立枫虏。如果磁盤讀寫確實(shí)非常頻繁,以至于磁盤讀寫成為系統(tǒng)瓶頸的情況成立,那么采用裸設(shè)備確實(shí)可以大大提高性能隶债,最大甚至可以提高至40%腾它,非常明顯。
下面來看看我實(shí)驗(yàn)的這臺(tái)機(jī)器的磁盤:
在xenserver里掛載了2個(gè)virtual disks給這臺(tái)實(shí)驗(yàn)機(jī)器燃异,掛載hdb的分區(qū)都為文件系統(tǒng)用來安裝os以及sybase應(yīng)用携狭,掛載hdc的將建立邏輯卷來存放sybase的device。
二. 建立物理分區(qū):
先看下hdb的分區(qū):
Login as root:
DevServer-9:~ # fdisk /dev/hdb
Command (m for help): p (輸出分區(qū)表)
Disk /dev/hdb: 64.4 GB, 64424509440 bytes255 heads, 63 sectors/track, 7832 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System/dev/hdb1 1 523 4200966 82 Linux swap / Solaris/dev/hdb2 * 524 1829 10490445 83 Linux/dev/hdb3 1830 7051 41945715 83 Linux
這里一定要注意回俐,接著到我們要操作的hdc這個(gè)存儲(chǔ)去9渫取!=銎摹5ツ!
DevServer-9:~ # fdisk /dev/hdc
#輸出分區(qū)表
Command (m for help): p
Device Boot Start End Blocks Id System
#建立新分區(qū)
Command (m for help): n
Command action e extended p primary partition (1-4)
#建立新分區(qū)序號(hào)輸入1則建立/dev/hdc1
Partition number (1-4):1
First cylinder (1-23497, default 1):
(默認(rèn))Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-23497, default 23497):
(默認(rèn)全部空間都分掉)Using default value 23497
看看分區(qū)表現(xiàn)在怎么樣了
Command (m for help): p
Disk /dev/hdc: 193.2 GB, 193273528320 bytes255 heads, 63 sectors/track, 23497 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hdc1 1 23497 188739621 83 Linux(這里的83不是我們要的哦M摺)
Command (m for help): t (改分區(qū)格式)
Selected partition 1
Hex code (type L to list codes): 8e(8e才是我們要的)
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): p (再確認(rèn)一下分區(qū)表吧搁廓,雖然是實(shí)驗(yàn)環(huán)境咱也得謹(jǐn)慎點(diǎn)是不)
Disk /dev/hdc: 193.2 GB, 193273528320 bytes255 heads, 63 sectors/track, 23497 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hdc1 1 23497 188739621 8e Linux LVM
Command (m for help): w (確認(rèn)寫入,然后等susey一頓忙活…………)
The partition table has been altered!
Calling ioctl() to re-read partition table.Syncing disks.
通常耕皮,不需要重啟境蜕,但有些計(jì)算機(jī)卻要求。因此如果下面的命令不工作凌停,試試重啟粱年。
到這里我們的分區(qū)算是分完了。
三. 建立卷組以及邏輯卷:
在這節(jié)我們要建立sybase所需要的設(shè)備空間罚拟。
syb-master 300M
syb-proc 556M
syb-tempdb 4200M
syb-data1 64G
syb-log1 32G
所有邏輯卷都在syb卷組下面台诗。
Login as root:
#(建立分組。syb為組名赐俗。/dev/hdb1為上面建立的物理卷)
[root@suse10 ~]# vgcreate syb /dev/hdc1
Volume group "syb" successfully created
[root@suse10 ~]# lvcreate -L 300M -n master syb
Logical volume "master" created
[root@suse10 ~]# lvcreate -L 556M -n proc syb
Logical volume "proc" created
[root@suse10 ~]# lvcreate -L 4200M -n tempdb syb
Logical volume "tempdb" created
[root@suse10 ~]# lvcreate –L64G -n data1 syb
Logical volume "data1" created
[root@suse10 ~]# lvcreate -L 32G -n log1 syb
Logical volume "log1" created
建立完成后可用vgdisplay syb –v命令查看
創(chuàng)建完后可以看到/dev/mapper下有5個(gè)分卷設(shè)備拉队,卷名分別為:
syb-master
syb-proc
syb-tempdb
syb-data1
syb-log1
在/etc/raw添加以下內(nèi)容。如raw設(shè)備已被使用請(qǐng)自行調(diào)整阻逮,注意這里:前后都不要有坑爹的空格傲豢臁!J宥蟆J驴蕖!1依!I浩础J成搿!**
**
[root@suse10 ~]# vi /etc/raw
raw11:syb/master
raw12:syb/proc
raw13:syb/data1
raw14:syb/tempdb
raw15:syb/log1
激活裸設(shè)備, 將裸設(shè)備綁定到分區(qū)
啟動(dòng)/etc/init.d ./raw start
停止/etc/init.d ./raw stop
[root@suse10 ~]# cd /etc/init.d/
[root@suse10 ~]# sh raw start
DevServer-9:/etc/init.d # sh raw startbind
/dev/raw/raw11 to /dev/syb/master... donebind
/dev/raw/raw12 to /dev/syb/proc... donebind
/dev/raw/raw13 to /dev/syb/data1... donebind
/dev/raw/raw14 to /dev/syb/tempdb... donebind
/dev/raw/raw15 to /dev/syb/log1... done
查詢是否激活
/usr/sbin/raw -qa
配置在系統(tǒng)重啟動(dòng)后自動(dòng)激活裸設(shè)備
/sbin/chkconfig raw on
檢查
/sbin/chkconfig raw (應(yīng)為on)
數(shù)據(jù)庫(kù)初始化設(shè)備時(shí)使用/dev/raw/raw(n)設(shè)備名即可
四. 安裝jdk:
你如果suse10是像我一樣默認(rèn)安裝,那么一定會(huì)遇到這個(gè)錯(cuò)誤仅胞!
A suitable JVM could not be found. Please run the program again using the option -is:javahome <JAVA HOME DIR>
乖乖翻出你的suse10安裝盤找出下面這2個(gè)rpm包把
jpackage-utils-1.6.3-18.8.41.x86_64.rpm
java-1_4_2-ibm-1.4.2_sr13-0.7.1.x86_64.rpm
然后再乖乖的按次序裝好它們每辟!
DevServer-9: # rpm -ivh jpackage-utils-1.6.3-18.8.41.x86_64.rpm
Preparing... ########################################### [100%]
1:jpackage-utils ########################################### [100%]
DevServer-9:# rpm -ivh java-1_4_2-ibm-1.4.2_sr13-0.7.1.x86_64.rpm
Preparing... ########################################### [100%]
1:java-1_4_2-ibm ########################################### [100%]
五. 配置sybase用戶、組:
DevServer-9:# groupadd -g 1000 sybase
DevServer-9:# usermod -g sybase -G disk sybase
DevServer-9:# passwd sybase
然后把sybase安裝文件全部搬上來干旧,確保安裝文件屬主都是我們剛建立的這個(gè)sybase用戶渠欺!
這里我放到/home/sybase/sybsetup目錄下面。
下面操作都用sybase用戶咯椎眯。
sybase@DevServer-9: cd /home/sybase/sybsetup
sybase@DevServer-9: chmod +x setup
最后改下sybase的.profile
sybase@DevServer-9: vi .profile
加一下export LANG=en_US
保存后重新用sybase用戶登錄
su – sybase
下面用root登錄來把前一篇建立的邏輯卷都改給sybase用戶
DevServer-9: # chown sybase:sybase /dev/raw/raw1*
然后用sybase用戶登錄做一下實(shí)驗(yàn)看看是否成功:
sybase@DevServer-9: dd if=/dev/raw/raw11 of=/tmp/foo bs=4096 count=8
看到類似內(nèi)容說明成功:
\8+0 records in
8+0 records out
32768 bytes (33 kB) copied, 0.007031 seconds, 4.7 MB/s
五. 安裝sybase for linux:
下面大段的屏幕輸出基本都忽略了挠将,操作時(shí)候注意哦。
sybase@DevServer-9: cd /home/sybase/sybsetup
sybase@DevServer-9: ./setup –console
#向?qū)С跏蓟裁词裁础?Press 1 for Next, 3 to Cancel or 4 to Redisplay [1]
#(不管 默認(rèn)1 next)
#地區(qū)列表编整,一堆堆………
Please enter the number of the location you are installing. (1-37) [1] 24
#(選24 就是咱郭嘉)
#用戶協(xié)議一大坨…………………
Press ENTER to read the text [Type q to quit] q
#(按q不看下一頁(yè)了舔稀,你要愛看你繼續(xù))
#又是一堆協(xié)議相關(guān)……
I agree to the terms of the Sybase license for the install locationspecified.(Y/N) [N]y
#(問你同意協(xié)議不,能不同意么U撇狻)
Press 1 for Next, 2 for Previous, 3 to Cancel or 4 to Redisplay [1] 1 #
#(接著下一步)
Please enter the directory where you would like to install the products orpress ENTER to accept the default.
Destination Directory [ERROR: ServiceException: (error code = 305; severity = 0)]/home/sybase
#(這里輸入要安裝應(yīng)用的目錄)
Do you want to continue with installation into this directory? [2] 1 (1是yes 2是no)
-------------------------------------------------------------------------------Choose the setup type that best suits your needs.
[X] 1 - Typical The program will be installed with the suggested configuration. Recommended for most users.[ ] 2 - Full The program will be installed with all the products and features.[ ] 3 - Custom The program will be installed with the features you choose. Recommended for advanced users.
To select an item enter its number, or 0 when you are finished: [0] 2
#(選擇full吧 全裝少煩惱)
To select an item enter its number, or 0 when you are finished: [0]#(選完直接就繼續(xù))
-------------------------------------------------------------------------------Sybase Adaptive Server Enterprise Suite will be installed in the followinglocation:
/home/sybase
with the following features:
Sybase Servers Adaptive Server Enterprise ASE Diagnostic Server ASE Agent Plugin ASE SNMP Agent Plugin ASE Web Services Job SchedulerConnectivity Open Client Common ctlib files Common dblib files Embedded SQL/C Monitor Client Library
Press ENTER to read the text [Type q to quit]
#(確認(rèn)下要安裝的部件)
Press 1 for Next, 2 for Previous, 3 to Cancel or 4 to Redisplay [1] 1 #(next后開始裝)
Installing Sybase Adaptive Server Enterprise Suite. Please wait...
|-----------|-----------|-----------|------------|0% 25% 50% 75% 100%|||||||||||||||||||||||
#裝完后會(huì)問你licenses的事 内贮,自己看著辦吧………………
#接下來要配置那些服務(wù),我們只配1和2汞斧,其他都點(diǎn)掉吧:
[X] 1 - Configure new Adaptive Server [X] 2 - Configure new Backup Server [ ] 3 - Configure new Monitor Server [ ] 4 - Configure new XP Server [ ] 5 - Configure new Job Scheduler [ ] 6 - Enable Self Management [ ] 7 - Configure Web Services [ ] 8 - Configure Unified Agent
To select an item enter its number, or 0 when you are finished: [0] (直接next)
#next之后會(huì)再給你確認(rèn)一下:
[X] 1 - Custom configure new Adaptive Server [X] 2 - Custom configure new Backup Server
To select an item enter its number, or 0 when you are finished: [0]
#(2個(gè)都叉上后next)
#下面配置如下夜郁,悲劇的忘記了15新增了一個(gè)sybsysdb.dat,就默認(rèn)吧粘勒!
-------------------------------------------------------------------------------Please enter custom configuration values for the new Adaptive Server
Adaptive Server Name [DEVSERVER9] SYBASE9 Port Number [5000] Error Log [/home/sybase/ASE-15_0/install/SYBASE9.log] Page Size
1. 2k 2. 4k 3. 8k 4. 16k
Select a page size : [1] 3 Master Device [/home/sybase/data/master.dat] /dev/raw/raw11 Master Device Size (MB) [120] 256 Master Database Size (MB) [52] 120 System Procedure Device [/home/sybase/data/sysprocs.dat] /dev/raw/raw12 System Procedure Device Size (MB) [132] 512 System Procedure Database Size (MB) [132] 510 System Device [/home/sybase/data/sybsysdb.dat] System Device Size (MB) [2] System Database Size (MB) [2]
Press 1 for Next, 2 for Previous, 3 to Cancel or 4 to Redisplay [1] 1
-------------------------------------------------------------------------------
Please enter custom configuration values for the new Backup Server
Backup Server Name [SYBASE9_BS] Port Number [5001] Error Log [/home/sybase/ASE-15_0/install/SYBASE9_BS.log]
Press 1 for Next, 2 for Previous, 3 to Cancel or 4 to Redisplay [1]
再一路next會(huì)收到一個(gè)/home/sybase/ASE-15_0/bin/srvbuildres: cannot execute錯(cuò)誤竞端,沒關(guān)系,錯(cuò)誤是多了點(diǎn)仲义,咱能解決婶熬!為什么會(huì)錯(cuò)誤呢?
sybase@DevServer-9:~> cd ASE-15_0/bin/sybase@DevServer-9:~/ASE-15_0/bin> ./srvbuildres -r ../sqlsrv.res
The SYBASE_ASE environment variable is not set.
這里的srvbuildres是根據(jù)res文件創(chuàng)建埃撵,res文件就是保存的咱剛配置的信息赵颅。可以vi看一下暂刘。 手工去執(zhí)行一下發(fā)現(xiàn)提示是環(huán)境變量沒有饺谬。至于這個(gè)環(huán)境變量呢是安裝sybase才給提供到一個(gè)文件里,暈了暈了~~~
加一行到sybase的.profile里:
. SYBASE.sh
注意點(diǎn)和空格Rゼ稹D颊!I拔鹰!,然后再來可以了.
sybase@DevServer-9:~/ASE-15_0/bin> ./srvbuildres -r ../sqlsrv.res
Warning: Unable to verify /dev/raw/raw11 device size. Please verify that this device is not already in use and that it has sufficient space available.
Warning: Unable to verify /dev/raw/raw12 device size. Please verify that this device is not already in use and that it has sufficient space available.
Building Adaptive Server 'SYBASE9':
Writing entry into directory services...
Directory services entry complete.
Building master device...Master device complete.
Writing RUN_SYBASE9 file...RUN_SYBASE9 file complete.
Starting server...
Server started.
Building sysprocs device and sybsystemprocs database...sybprocs device and sybsystemprocs database created.
Running installmaster script to install system stored procedures...
installmaster: 10% complete.
installmaster: 20% complete.
installmaster: 30% complete.
installmaster: 40% complete.
installmaster: 50% complete.
installmaster: 60% complete.
installmaster: 70% complete.
installmaster: 80% complete.
installmaster: 90% complete.
installmaster: 100% complete.
installmaster script complete.
Creating two-phase commit database...Two phase commit database complete.Installing common character sets (Code Page 437, Code Page 850, ISO Latin-1, Macintosh and HP Roman-8)...Character sets installed.Setting server name in Adaptive Server...Server name added.Server 'SYBASE9' was successfully created.
至此sybase數(shù)據(jù)庫(kù)服務(wù)算是完成了~贵涵!
下面是backserver列肢,這個(gè)backserver如果沒有的話就不能用dump的方式來備份和恢復(fù)恰画!
sybase@DevServer-9:~/ASE-15_0/bin> ./srvbuildres -r ../bsrv.res
如果你的glibc的版本是2.4以上,可能會(huì)遇到一個(gè)錯(cuò)誤:
line 15: 4168 Segmentation fault
具體的解決辦法是去sybase用戶的環(huán)境變量里加上:export LD_POINTER_GUARD=1(或者=0瓷马,具體機(jī)器不一樣)
最終我們sybase的.profile內(nèi)容如下:
export LANG=en_US
export LD_POINTER_GUARD=1
. SYBASE.sh
這時(shí)候我們可以到ASE-15_0/install目錄下面通過下面2個(gè)命令來啟動(dòng):
./startserver –f RUN_SYBASE
./startserver –f RUN_SYBASE_BS