2010年3月29日星期一

apache(2.2.15) +php(5.2.10) 實驗

這次測試加在php動態頁面的效果

apache pre-fork mode:

1, apache compiled

./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --with-mpm=prefork

 

2 php compiled

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php --with-mysql=/usr/local/webserver/mysql    --with-apxs2=/usr/local/apache2/bin/apxs

 

3. make 
make ZEND_EXTRA_LIBS='-liconv'

4 .make install

 

5. 編輯測試文件

[root@LB1 bin]# cd /usr/local/apache2/htdocs/

[root@LB1 htdocs]# ls

index.html

[root@LB1 htdocs]# vi index.php

[root@LB1 htdocs]# cat index.php

<?php

phpinfo();

?>

[root@LB1 htdocs]#

6, apache httpd.conf中添加:

 

設置web server環境

#載入php5的函式庫
LoadModule php5_module        modules/libphp5.so
#指定php執行的副檔名
AddType application/x-httpd-php .php .phtml .inc .php3
#原始碼副呈現的副檔名
AddType application/x-httpd-php-source .phps

<IfModule mpm_worker_module>

    StartServers          2

    MaxClients          150

    MinSpareThreads      25

    MaxSpareThreads      75

    ThreadsPerChild      25

    MaxRequestsPerChild   0

</IfModule>

7  壓力baseline收集

php 頁面部分

===prefork mode====

[root@LB1 bin]#  ./ab -n 10000 -c 10 http://172.16.1.222/index.php

This is ApacheBench, Version 2.3 <$Revision: 655654 $>

Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/

Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 172.16.1.222 (be patient)

Completed 1000 requests

Completed 2000 requests

Completed 3000 requests

Completed 4000 requests

Completed 5000 requests

Completed 6000 requests

Completed 7000 requests

Completed 8000 requests

Completed 9000 requests

Completed 10000 requests

Finished 10000 requests

Server Software:        Apache/2.2.15

Server Hostname:        172.16.1.222

Server Port:            80

Document Path:          /index.php

Document Length:        40213 bytes

Concurrency Level:      10

Time taken for tests:   5.047 seconds

Complete requests:      10000

Failed requests:        0

Write errors:           0

Total transferred:      403848771 bytes

HTML transferred:       402178437 bytes

Requests per second:    1981.49 [#/sec] (mean)

Time per request:       5.047 [ms] (mean)

Time per request:       0.505 [ms] (mean, across all concurrent requests)

Transfer rate:          78146.56 [Kbytes/sec] received

Connection Times (ms)

              min  mean[+/-sd] median   max

Connect:        0    0   0.6      0       8

Processing:     1    5   0.8      5      12

Waiting:        0    1   0.9      1       8

Total:          2    5   0.8      5      13

Percentage of the requests served within a certain time (ms)

  50%      5

  66%      5

  75%      5

  80%      6

  90%      6

  95%      6

  98%      7

  99%      7

100%     13 (longest request)

[root@LB1 bin]#

 

btw:再進行work方式的時候使用類似上面的辦法報錯了“

[root@LB1 bin]# ./apachectl start

[Mon Mar 29 23:57:53 2010] [crit] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe.  You need to recompile PHP.

Pre-configuration failed

”解決,參見 上一篇文章

worker 方式:

1, apache complied

./configure --prefix=/usr/local/httpd2 --enable-so --enable-rewrite --with-mpm=worker

2, php compiled

./configure --prefix=/usr/local/php2 --with-config-file-path=/usr/local/phpw --with-mysql=/usr/local/webserver/mysql    --with-apxs2=/usr/local/httpd2/bin/apxs  --enable-maintainer-zts

3. make 
make ZEND_EXTRA_LIBS='-liconv'

4 .make install

5. 編輯測試文件

[root@LB1 bin]# cd /usr/local/apache2/htdocs/

[root@LB1 htdocs]# ls

index.html

[root@LB1 htdocs]# vi index.php

[root@LB1 htdocs]# cat index.php

<?php

phpinfo();

?>

[root@LB1 htdocs]#

6, apache httpd.conf中添加:

 

設置web server環境

#載入php5的函式庫
LoadModule php5_module        modules/libphp5.so
#指定php執行的副檔名
AddType application/x-httpd-php .php .phtml .inc .php3
#原始碼副呈現的副檔名
AddType application/x-httpd-php-source .phps

<IfModule mpm_worker_module>

    StartServers          2

    MaxClients          150

    MinSpareThreads      25

    MaxSpareThreads      75

    ThreadsPerChild      25

    MaxRequestsPerChild   0

</IfModule>

啟動apache

7 收集壓力基準:

[root@LB1 htdocs]# cd ../bin

[root@LB1 bin]# ./ab -n 10000 -c 10 http://172.16.1.222/index.php

This is ApacheBench, Version 2.3 <$Revision: 655654 $>

Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/

Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 172.16.1.222 (be patient)

Completed 1000 requests

Completed 2000 requests

Completed 3000 requests

Completed 4000 requests

Completed 5000 requests

Completed 6000 requests

Completed 7000 requests

Completed 8000 requests

Completed 9000 requests

Completed 10000 requests

Finished 10000 requests

Server Software:        Apache/2.2.15

Server Hostname:        172.16.1.222

Server Port:            80

Document Path:          /index.php

Document Length:        40284 bytes

Concurrency Level:      10

Time taken for tests:   4.213 seconds

Complete requests:      10000

Failed requests:        3

   (Connect: 0, Receive: 0, Length: 3, Exceptions: 0)

Write errors:           0

Total transferred:      404509865 bytes

HTML transferred:       402839865 bytes

Requests per second:    2373.57 [#/sec] (mean)

Time per request:       4.213 [ms] (mean)

Time per request:       0.421 [ms] (mean, across all concurrent requests)

Transfer rate:          93762.80 [Kbytes/sec] received

Connection Times (ms)

              min  mean[+/-sd] median   max

Connect:        0    0   0.2      0       4

Processing:     1    4   1.8      4      45

Waiting:        0    3   1.5      3      30

Total:          1    4   1.8      4      46

Percentage of the requests served within a certain time (ms)

  50%      4

  66%      4

  75%      5

  80%      5

  90%      6

  95%      7

  98%      8

  99%      9

100%     46 (longest request)

[root@LB1 bin]#

對比發現 ,從動態頁面來看,worker方式的優勢就顯現出來了,處理能力明顯被pre-fork方式強。

記錄一下,備忘

Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP. Pre-configuration failed 的處理

在pre-fork mode下apache+php5運行沒有問題, 但是在worker mode, apache啟動的時候,報錯了

如何處理呢, 發現別人已經遇到這個問題

./configure --prefix=/usr/local/php2 --with-config-file-path=/usr/local/php2 --with-mysql=/usr/local/webserver/mysql    --with-apxs2=/usr/local/httpd2/bin/apxs  --enable-maintainer-zts --with-experimental-zts

紅色字體上後加入的

重新configure; make ; make install ok

Btw, php5.2.10 直接make 報錯

make使用

make ZEND_EXTRA_LIBS='-liconv'

猜想應該是php5.2.10內部的libconv可能不好用吧。

make install後, 運行apache ok.

記錄一下!

如何加快make的速度

如果您有編譯的經歷,對opensource的長時間make 一定有體會,比如php, 比如mysql的源代碼安裝

看到別人的一個安裝文檔用到了make –j 10,

man make 查了一下, 發現

[root@LB1 httpd-2.2.15]# make -j 10

-j [jobs], --jobs[=jobs]

            Specifies the number of jobs (commands) to run simultaneously.  If there  is  more than one -j option, the last one is effective.  If the -j option is given without an argument, make  will  not  limit the number of jobs that can run simultaneously.

就是啟動多個job 來運行make , 記錄一下,提高效率

類似:error while loading shared libraries: libiconv.so.2 問題的處理

安裝apache2.2以後,發現啟動不了

報類似的錯誤:

 

error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory

查找發現這個文件在/usr/local/lib下面

查看/etc/ld.so.conf 發現裏面沒有內容

將/usr/local/lib 添加在這個文件中

運行ldconfig

再次運行ok, 記錄一下備忘!

2010年3月28日星期日

apache web server 實驗

項目需要, 做了一個 apache baseline的實驗, 發現再PC上, 我的測試機器是dell optiplex 755 , apache mpm worker mode 並沒有 pre-fork mode 的效率高,可能是multi-core的優勢沒有顯示出來吧,留一個記錄備查!

[root@LB1 bin]# uname -at
Linux LB1.localdomain 2.6.18-164.el5 #1 SMP Thu Sep 3 04:15:13 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
[root@LB1 bin]#

[root@LB1 bin]# free
total used free shared buffers cached
Mem: 2015392 1099068 916324 0 131880 582036
-/+ buffers/cache: 385152 1630240
Swap: 4063224 0 4063224
[root@LB1 bin]#



[root@LB1 proc]# cat cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Core(TM)2 Duo CPU E8200 @ 2.66GHz
stepping : 6
cpu MHz : 2000.000
cache size : 6144 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx lm constant_tsc pni monitor ds_cpl vmx smx est tm2 cx16 xtpr lahf_lm
bogomips : 5319.97
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:

processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Core(TM)2 Duo CPU E8200 @ 2.66GHz
stepping : 6
cpu MHz : 2000.000
cache size : 6144 KB
physical id : 0
siblings : 2
core id : 1
cpu cores : 2
apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx lm constant_tsc pni monitor ds_cpl vmx smx est tm2 cx16 xtpr lahf_lm
bogomips : 5319.98
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:





[root@LB1 httpd-2.2.15]# ./configure --with-mpm=prefork --prefix=/usr/local/apache_prefork --with-included-apr --with-expat=builtin

[root@LB1 httpd-2.2.15]# make -j 10

-j [jobs], --jobs[=jobs]
Specifies the number of jobs (commands) to run simultaneously. If
there is more than one -j option, the last one is effective. If
the -j option is given without an argument, make will not limit
the number of jobs that can run simultaneously.


[root@LB1 httpd-2.2.15]# make install




第二组


[root@LB1 httpd-2.2.15]# ./configure --with-mpm=worker --prefix=/usr/local/apache_worker --with-included-apr --with-expat=builtin


[root@LB1 httpd-2.2.15]# make -j 10


[root@LB1 httpd-2.2.15]# make install




分别配置参数


StartServers 5
MinSpareServers 5
MaxSpareServers 75
MaxClients 150
MaxRequestsPerChild 0






StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0

[root@LB1 conf]#



测试第一组: prefork mode

[root@LB1 bin]# ./apachectl start
[root@LB1 bin]# netstat -tln |grep 80
tcp 0 0 :::80 :::* LISTEN
[root@LB1 bin]#



[root@LB1 bin]# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 16039
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 16039
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
[root@LB1 bin]# ulimit -n 102400
[root@LB1 bin]#




[root@LB1 bin]# ./ab -n 10000 -c 10 http://172.16.1.222/index.html
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 172.16.1.222 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests


Server Software: Apache/2.2.15
Server Hostname: 172.16.1.222
Server Port: 80

Document Path: /index.html
Document Length: 44 bytes

Concurrency Level: 10
Time taken for tests: 0.737 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 2950000 bytes
HTML transferred: 440000 bytes
Requests per second: 13565.19 [#/sec] (mean)
Time per request: 0.737 [ms] (mean)
Time per request: 0.074 [ms] (mean, across all concurrent requests)
Transfer rate: 3907.94 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 1
Processing: 0 1 0.1 1 8
Waiting: 0 0 0.1 0 1
Total: 0 1 0.2 1 8

Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 1
80% 1
90% 1
95% 1
98% 1
99% 1
100% 8 (longest request)
[root@LB1 bin]#





第二组 worker

[root@LB1 bin]# ./ab -n 10000 -c 10 http://172.16.1.222/index.html
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 172.16.1.222 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests


Server Software: Apache/2.2.15
Server Hostname: 172.16.1.222
Server Port: 80

Document Path: /index.html
Document Length: 44 bytes

Concurrency Level: 10
Time taken for tests: 0.790 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 2950295 bytes
HTML transferred: 440044 bytes
Requests per second: 12660.63 [#/sec] (mean)
Time per request: 0.790 [ms] (mean)
Time per request: 0.079 [ms] (mean, across all concurrent requests)
Transfer rate: 3647.71 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 1
Processing: 0 1 0.5 1 16
Waiting: 0 0 0.4 0 15
Total: 0 1 0.5 1 16

Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 1
80% 1
90% 1
95% 2
98% 2
99% 2
100% 16 (longest request)
[root@LB1 bin]#

2010年3月19日星期五

如何查找redo file?

備忘一下

SQL> select group#, members, status from v$log;

    GROUP#    MEMBERS STATUS
---------- ---------- ----------------
         1          2 INACTIVE
         2          2 CURRENT
         3          2 INACTIVE
         4          2 CURRENT

 

SQL> desc v$logfile
Name                                      Null?    Type
----------------------------------------- -------- ----------------------------
GROUP#                                             NUMBER
STATUS                                             VARCHAR2(7)
TYPE                                               VARCHAR2(7)
MEMBER                                             VARCHAR2(513)
IS_RECOVERY_DEST_FILE                              VARCHAR2(3)

SQL> col member for a30
SQL> select * from v$logfile;

 

SQL> set linesize 300
SQL> /

    GROUP# STATUS  TYPE    MEMBER                         IS_
---------- ------- ------- ------------------------------ ---
         1         ONLINE  +CRPROD_DATA/crprod/onlinelog/ NO
                           group_1.257.686193451

         1         ONLINE  +FLASH_RECOVERY_AREA/crprod/on YES
                           linelog/group_1.257.686193459

         2         ONLINE  +CRPROD_DATA/crprod/onlinelog/ NO
                           group_2.258.686193481

         2         ONLINE  +FLASH_RECOVERY_AREA/crprod/on YES
                           linelog/group_2.258.686193491

    GROUP# STATUS  TYPE    MEMBER                         IS_
---------- ------- ------- ------------------------------ ---

         3         ONLINE  +CRPROD_DATA/crprod/onlinelog/ NO
                           group_3.265.686198773

         3         ONLINE  +FLASH_RECOVERY_AREA/crprod/on YES
                           linelog/group_3.259.686198787

         4         ONLINE  +CRPROD_DATA/crprod/onlinelog/ NO
                           group_4.266.686198801

         4         ONLINE  +FLASH_RECOVERY_AREA/crprod/on YES

    GROUP# STATUS  TYPE    MEMBER                         IS_
---------- ------- ------- ------------------------------ ---
                           linelog/group_4.260.686198809

8 rows selected.

2010年3月17日星期三

solaris 7 force umount cmd

在一個超級古老的機器上mount 了一個nfs, 但是nfs server移除以後就沒有辦法 umount 這個目錄了

umount /backup

報錯如下:

nfs umount: /backup: is busy


怎麼辦呢?



google了一下,使用如下命令可以幹掉



Solaris 2.6 and Solaris 7: umount -o force /mount-point



試用了一下, 還是報錯



不過df -k的時候 發現已經很順暢了,感覺已經去掉了



當然還有另一種辦法



try following ...

unshare /backup
umount /backup


沒有測試過,等下次有機會測試一下



記錄一下備忘!

2010年3月5日星期五

How to Delete a node from RAC test

在測試環境中做一個一個RAC delete node的實驗記錄一下

環境是vmware

OS: OEL 5.2

DB: oracle 11gR1

 

http://docs.google.com/Doc?docid=0AbicX7azhQtmZGs3NzQ2Ml85NjBmbWMyZjRjZw&hl=en

2010年3月3日星期三

Awk 做url

學習了一個小技巧

ls | awk '{print "<a href="$0">"$0"</a><br />"}' > index.html 

將目錄下的東西寫道成href

ref:

http://ithelp.ithome.com.tw/question/10021489

2010年3月2日星期二

BBED complie

發現一個有用的工具BBED,處理壞塊使用的, 根據網上提供的方法,自己做了一個實驗:

我的環境是openSolaris 其他的*nix也是類似

1,源文件在哪裡?

cd $ORACLE_HOME

 

oracle@opensolaris:/opt/oracle/product/10.2.0/db_1$ find . -name ins_rdbms.mk
./rdbms/lib/ins_rdbms.mk

2,編譯:

oracle@opensolaris:/opt/oracle/product/10.2.0/db_1/rdbms/lib$ make -f ins_rdbms.mk /opt/oracle/product/10.2.0/db_1/rdbms/lib/bbed

Linking BBED utility (bbed)
rm -f /opt/oracle/product/10.2.0/db_1/rdbms/lib/bbed
/usr/ccs/bin/ld -64 -o /opt/oracle/product/10.2.0/db_1/rdbms/lib/bbed -L/opt/oracle/product/10.2.0/db_1/rdbms/lib/ -L/opt/oracle/product/10.2.0/db_1/lib/ -dy /opt/oracle/product/10.2.0/db_1/lib/prod/lib/amd64/crti.o /opt/oracle/product/10.2.0/db_1/lib/prod/lib/amd64/crt1x.o /opt/oracle/product/10.2.0/db_1/lib/s0main.o /opt/oracle/product/10.2.0/db_1/rdbms/lib/ssbbded.o /opt/oracle/product/10.2.0/db_1/rdbms/lib/sbbdpt.o `cat /opt/oracle/product/10.2.0/db_1/lib/ldflags`    -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 /opt/oracle/product/10.2.0/db_1/rdbms/lib/defopt.o  -ldbtools10 -lclntsh  `cat /opt/oracle/product/10.2.0/db_1/lib/ldflags`    -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lnro10 `cat /opt/oracle/product/10.2.0/db_1/lib/ldflags`    -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lclient10 -lnnetd10  -lvsn10  -lcommon10 -lgeneric10 -lmm -lsnls10 -lnls10  -lcore10 -lsnls10  -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10  -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10 `cat /opt/oracle/product/10.2.0/db_1/lib/ldflags`    -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lnro10 `cat /opt/oracle/product/10.2.0/db_1/lib/ldflags`    -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lclient10 -lnnetd10  -lvsn10  -lcommon10 -lgeneric10   -lsnls10 -lnls10  -lcore10 -lsnls10  -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10  -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10  -lclient10 -lnnetd10  -lvsn10  -lcommon10 -lgeneric10 -lsnls10 -lnls10  -lcore10 -lsnls10  -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10  -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10   `cat /opt/oracle/product/10.2.0/db_1/lib/sysliblist` -R /opt/SUNWcluster/lib:/opt/oracle/product/10.2.0/db_1/lib:/opt/ORCLcluster/lib/  -Y P,:/opt/SUNWcluster/lib:/opt/ORCLcluster/lib/:/usr/ccs/lib/amd64:/usr/lib/amd64  -Qy -lc  -lrt  -laio -lposix4 -lkstat -lm  /opt/oracle/product/10.2.0/db_1/lib/prod/lib/amd64/crtn.o

驗證一下:

oracle@opensolaris:/opt/oracle/product/10.2.0/db_1/rdbms/lib$ ls -al bbed
-rwxr-xr-x 1 oracle oinstall 862016 2010-03-03 10:06 bbed

執行

oracle@opensolaris:/opt/oracle/product/10.2.0/db_1/rdbms/lib$ ./bbed
Password:(blockedit 為default password)

BBED: Release 2.0.0.0.0 - Limited Production on Wed Mar 3 10:07:15 2010

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

************* !!! For Oracle Internal Use only !!! ***************

BBED>

這個工具是內部人員使用的哦

BBED> help all
SET DBA [ dba | file#, block# ]
SET FILENAME 'filename'
SET FILE file#
SET BLOCK [+/-]block#
SET OFFSET [ [+/-]byte offset | symbol | *symbol ]
SET BLOCKSIZE bytes
SET LIST[FILE] 'filename'
SET WIDTH character_count
SET COUNT bytes_to_display
SET IBASE [ HEX | OCT | DEC ]
SET OBASE [ HEX | OCT | DEC ]
SET MODE  [ BROWSE | EDIT ]
SET SPOOL [ Y | N ]
SHOW [ <SET parameter> | ALL ]
INFO
MAP[/v] [ DBA | FILENAME | FILE | BLOCK ]
DUMP[/v] [ DBA | FILENAME | FILE | BLOCK | OFFSET | COUNT ]
PRINT[/x|d|u|o|c] [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
EXAMINE[/Nuf] [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
</Nuf>:
N - a number which specifies a repeat count.
u - a letter which specifies a unit size:
  b - b1, ub1 (byte)
  h - b2, ub2 (half-word)
  w - b4, ub4(word)
  r - Oracle table/index row
f - a letter which specifies a display format:
  x - hexadecimal
  d - decimal
  u - unsigned decimal
  o - octal
  c - character (native)
  n - Oracle number
  t - Oracle date
  i - Oracle rowid
FIND[/x|d|u|o|c] numeric/character string [ TOP | CURR ]
COPY [ DBA | FILE | FILENAME | BLOCK ] TO [ DBA | FILE | FILENAME | BLOCK ]
MODIFY[/x|d|u|o|c] numeric/character string
      [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
ASSIGN[/x|d|u|o] <target spec>=<source spec>
<target spec> : [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
<source spec> : [ value | <target spec options> ]
SUM [ DBA | FILE | FILENAME | BLOCK ] [ APPLY ]
PUSH [ DBA | FILE | FILENAME | BLOCK | OFFSET ]
POP [ALL]
REVERT [ DBA | FILE | FILENAME | BLOCK ]
UNDO
HELP [ <bbed command> | ALL ]
VERIFY [ DBA | FILE | FILENAME | BLOCK ]
CORRUPT [ DBA | FILE | FILENAME | BLOCK ]

BBED>

記錄一下,備忘,繼續學習!

ref:

http://www.databasejournal.com/features/oracle/article.php/3835546/Installing-Oracle-Block-Browser-and-Editor-tool-bbed.htm

http://www.eygle.com/archives/2005/09/how_to_compile.html

add a disk to linux

在xen上增加一個disk,當人是vritual的:)


[root@Mocktrade dev]# fdisk /dev/xvdb  # xvdb 難道xen下的disk都是xvdx嗎?
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 4895.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-4895, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-4895, default 4895):
Using default value 4895
Command (m for help): p
Disk /dev/xvdb: 40.2 GB, 40265318400 bytes
255 heads, 63 sectors/track, 4895 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
    Device Boot      Start         End      Blocks   Id  System
/dev/xvdb1               1        4895    39319056   83  Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@ dev]#
[root@ dev]#
[root@ dev]# mkfs
mkfs         mkfs.cramfs  mkfs.ext2    mkfs.ext3
[root@ dev]# mkfs.ext3 -b 4096 /dev/xvdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
4915200 inodes, 9829764 blocks
491488 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
300 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information:
done
This filesystem will be automatically checked every 29 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

[root@ /]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/xvda3            26306612   7741500  17207220  32% /
/dev/xvda1              101086     19708     76159  21% /boot
tmpfs                  1572864         0   1572864   0% /dev/shm
[root@ /]# mkdir /u01


[root@/]# mount /dev/xvdb1 /u01
[root@ /]# cd /u01
[root@ u01]# touch reame.txt
[root@ u01]# ls
lost+found  reame.txt
[root@ u01]# cd /etc
[root@ etc]# vi fstab

cat /etc/fstab
LABEL=/                 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/xvdb1             /u01                   ext3    defaults        1 1
LABEL=SWAP-xvda2        swap                    swap    defaults        0 0


[root@ etc]# df -lh
Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda3             26G  7.4G   17G  32% /
/dev/xvda1             99M   20M   75M  21% /boot
tmpfs                 1.5G     0  1.5G   0% /dev/shm
/dev/xvdb1             37G  177M   35G   1% /u01
[root@]#

reboot

記錄一下,備忘!

lower_case_table_names 可以引發mysql replication 不成功

很早以前配置過一個mysql的replication, 跑的很好,突然客戶的mysql database replicaiton失效了

重新配置replication也無效

[crhk@_Slave bin]$ cat mysqld_slave.sh
#!/bin/sh
/usr/bin/mysqld_safe --skip-slave-start &
[crhk@_Slave bin]$

------------------------------------slave----------------------------------
[root@_Slave bin]# ./mysqld_slave.sh
[root@_Slave bin]# Starting mysqld daemon with databases from /var/lib/mysql

 

[root@_Slave mysql]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.45-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show slave status;
Empty set (0.00 sec)
mysql>
mysql> change master to
    -> master_host='A.B.C.D',
    -> master_port=3306,
    -> master_user='repl',
    -> master_password='password',
    -> master_log_file='mysql-bin.000031',
    -> master_log_pos=201937405;
ERROR 1201 (HY000): Could not initialize master info structure; more error messages can be found in the MySQL error log
mysql>

將同步所需文件全部刪除

rm /var/lib/mysql/relay-log.info 
rm /var/lib/mysql/master.info 
rm /var/run/mysqld/*

重新做,問題依然

只能跟蹤log了

。。。。

100301 22:26:38  mysqld started
100301 22:26:38 [Warning] /usr/libexec/mysqld: ignoring option '--innodb_file_per_table' due to invalid value 'ON'
100301 22:26:38 [Warning] /usr/libexec/mysqld: ignoring option '--innodb_file_per_table' due to invalid value 'ON'
100301 22:26:39  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
100301 22:26:39  InnoDB: Starting log scan based on checkpoint at
InnoDB: log sequence number 8 2665319758.
InnoDB: Doing recovery: scanned up to log sequence number 8 2665319758
InnoDB: Last MySQL binlog file position 0 3092, file name /var/lib/mysql/mysql-bin.000037
100301 22:26:39  InnoDB: Started; log sequence number 8 2665319758
100301 22:26:39 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.0.45-log'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  Source distribution
100301 22:27:47 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.000037' at position 3268, relay log '/var/run/mysqld/mysqld-relay-bin.000001' position: 4
100301 22:27:47 [Note] Slave I/O thread: connected to master 'repl@172.16.12.29:3306',  replication started in log 'mysql-bin.000037' at position 3268
100301 22:27:47 [ERROR] Slave: Error 'Table 'databasename.GuessFall' doesn't exist' on query. Default database: 'databasename'. Query: 'insert into GuessFall (GuessFallId,UserId,StockCode,State,StartPrice,EndPrice,CreateDate,StopDate) values ('ff52146c-81f6-4334-8920-ef3f059ff3e8','b27e0e77-9cf2-aa9b-e040-10ac0d0c2f1f', '02777', 0, -1, 0.000, '2010-03-01 22:14:40','2010-03-01 22:14:40')', Error_code: 1146
100301 22:27:47 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'mysql-bin.000037' position 3268

。。。。

發現插入不了

這是開始懷疑master/slave 的配置問題不一致了

diff一下,果然,slave庫中少了

lower_case_table_names=1

修改之slave my.cnf文件,重新配置,正常了

Myql 官方解釋:

http://dev.mysql.com/doc/refman/5.0/en/identifier-case-sensitivity.html

簡而言之就是 寫入不區分大小寫

0  --名字對大小寫敏感 ,default

1 - -table name on disk是小寫, 名字對大小寫敏感

2--存儲根據create table or create database 的語句,mysql 查詢的時候轉換小寫,對大小寫不敏感

教訓:

1. replication 方式下的 master /slave的環境配置一致很重要,

2.lower_case_table_names 這類常用參數,應該在database配置的時候設置好了,避免不必要的改動。