2011年1月21日 星期五

Linux設定 vnc的解析度

1.ubuntu安裝 vnc
#apt-get install vnc4server

2.修改 xstartp
#vi ~/.vnc/xstartup
將x-window-manager &的這一行註解掉,
加入以下這二行
[ -f $HOME/.Xresources ] && xrdb $HOME/.Xresources
gnome-session &
並存檔.

#vncserver
即可啟動.

若要設定vnc的解析度
 vncserver -geometry 1024x768 :1

其中
:1 ,表示vnc port為5900 +1 => 5901
-geometry 1024x768,表示解析度為 1024*768

2011年1月17日 星期一

用dd簡單測Linux的io

read:
# time dd if=/dev/sda of=/dev/zero bs=8k count=1000000
1000000+0 records in
1000000+0 records out
8192000000 bytes (8.2 GB) copied, 73.0053 s, 112 MB/s
real    1m13.025s
user    0m0.230s
sys     0m7.700s





write:
#time dd if=/dev/zero of=/tmp/fake.file bs=8k count=1000000

1000000+0 records in
1000000+0 records out
8192000000 bytes (8.2 GB) copied, 81.6353 s, 100 MB/s

real    1m21.758s
user    0m0.160s
sys     0m8.440s

read and write:
#time dd if=/tmp/fake.file of=/tmp/fake.file.out bs=8k count=1000000
1000000+0 records in
1000000+0 records out
8192000000 bytes (8.2 GB) copied, 207.892 s, 39.4 MB/s

real    3m27.960s
user    0m0.320s
sys     0m17.310s


檢查Linux Block size
# dumpe2fs /dev/sdb1 | grep -i 'Block size'


測試 Ram Disk的速度.(:/tmp採用Ram Disk)
# time dd if=/dev/zero of=/tmp/fake.file bs=8k count=400000
400000+0 records in
400000+0 records out
3276800000 bytes (3.3 GB) copied, 1.33236 s, 2.5 GB/s

2011年1月11日 星期二

Linux 網路校時


ntpdate tock.stdtime.gov.tw 
hwclock -w

vi /etc/crontab
# 加入這一行去!
*/1 * * * * root /usr/sbin/ntpdate tock.stdtime.gov.tw && /sbin/hwclock -w

KVM會有20-30秒的中斷

問題:
當把KVM的Domain強制關機時,網路會有20-30秒的中斷,查詢 /var/log/message時.出現以下訊息.
...
Jan  6 08:59:30 ezkvm-desktop kernel: [862465.409284] br0: port 3(vnet1) entering disabled state
Jan  6 08:59:30 ezkvm-desktop kernel: [862465.487829] device vnet1 left promiscuous mode
Jan  6 08:59:30 ezkvm-desktop kernel: [862465.487835] br0: port 3(vnet1) entering disabled state
....


刪除JBoss的 DeleteWorkDirOnContextDestroy

configurable at the tomcat service level. There is an attribute that can be changed in deploy/jbossweb-tomcat55.sar/META-INF/jboss-service.xml

 <!--Flag to delete the Work Dir on Context Destroy -->
<attribute name="DeleteWorkDirOnContextDestroy">true</attribute>

then reboot jboss.














Reference:
https://issues.jboss.org/browse/JBAS-3358


http://www.contaduria.gov.co:8080/jmx-console/HtmlAdaptor?action=inspectMBean&name=jboss.web:service%3DWebServer

2011年1月2日 星期日

Linux SSH 自動登錄

說明:
使用ssh自動登入:

方法:
使用RSA key的方式.

步驟:
假設:要從192.168.1.101(Server1)用ssh自動登入192.168.1.102(Server2)
1.在Server1利用 ssh-keygen產生公鑰:
# ssh-keygen -t rsa -b 1024
操作畫面如下,全部均使用預設值即可.
{{{
root@ezkvm-desktop:~/.ssh# ssh-keygen -t rsa -b 1024
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
ac:04:30:3e:12:60:1c:70:46:d7:5c:ce:45:94:09:40 root@ezkvm-desktop
The key's randomart image is:
+--[ RSA 1024]----+
|B+B .+Eoo++o |
|.* + oo .o |
|. o . o |
| . . . . |
| . S |
| . . |
| . |
| |
| |
+-----------------+
root@ezkvm-desktop:~/.ssh#
}}}
2.把 Server1上的公鑰檔(/root/.ssh/id_rsa.put)的檔案 copy 到 Server 2上的/tmp
3.登入 Server2,把Server1的公鑰 附加 到 Server2的 authorized_keys
{{{
cat /tmp/id_rsa.pub >> /root/.ssh/authorized_keys
}}}