<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 88, comments - 3, trackbacks - 0, articles - 0
      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理


    1. install vncserver
    sudo yum install vnc-server

    2. set password for login user
      
    vncpasswd
    3. start one server to generate setting file ~/.vnc/xstartup
     
    vncserver :1
    4. edit ~/.vnc/xstartup as suggestion of comments to uncomment two lines:
      unset SESSION_MANAGER
      
    exec /etc/X11/xinit/xinitrc

    5. restart the server
     vncserver -kill :1
     vncserver -geometry 1200x900 -depth 16 :1
    寬屏的話
     vncserver -geometry 1366x768 -depth 16 :1, 如果不順眼 可以微調,我當前的最佳分辨率是
     vncserver -geometry 1346x680 -depth 16 :1

    6. access by vncviewer
     vncviewer SERVER_IP:5901

    Ref: VNC How TO

    posted @ 2012-03-20 11:06 Milo的海域 閱讀(359) | 評論 (0)編輯 收藏

    # parepare test database
    createDB="drop database if exists $database; create database if not exists $database;"
    mysql -$vip --port=$port -uadmin -padmin -"$createDB"

    # prepare data
    prepare="$sysbench --test=oltp --mysql-table-engine=innodb --oltp-table-size=$row"
    prepare
    ="$prepare --mysql-port=$port --mysql-host=$vip --mysql-db=$database"
    prepare
    ="$prepare --mysql-password=admin --mysql-user=admin prepare"
    $prepare

    # run sysbench
    #
     http://sysbench.sourceforge.net/docs/#database_mode see this link for more options
    run="$sysbench --test=oltp --mysql-table-engine=innodb --init-rng --oltp-table-size=$row"
    run
    ="$run --max-requests=0 --max-time=900 --num-threads=128 --oltp-test-mode=complex"
    run
    ="$run --oltp-point-selects=2 --oltp-simple-ranges=1 --oltp-sum-ranges=2"
    run
    ="$run --oltp-index-updates=10 --oltp-non-index-updates=5 --mysql-port=$port"
    run
    ="$run --mysql-db=$database --mysql-host=$vip --mysql-password=admin --mysql-user=admin"

    # support oltp-user-delay-min to add delay for each sysbench request
    if [[ "$lag" != "nolag" ]]
    then
        run
    ="$run --oltp-user-delay-min=$lag"
    fi
    run
    ="$run run"

    posted @ 2012-03-19 16:35 Milo的海域 閱讀(357) | 評論 (0)編輯 收藏

    參考 jmap & jhat
    通過分析heap中對象的數量還有大小可以定位哪個類出了問題。

    posted @ 2012-03-16 09:45 Milo的海域 閱讀(302) | 評論 (0)編輯 收藏

    1. 盡量避免拋出異常
        異常是有代價的,比如盡量避免使用異常來實現流程控制
    2. 盡量處理異常
        有能力處理異常則處理掉,不然外層函數會累積太多的異常
    3. 處理不了則拋出異常
        自己問自己,這個異常能夠處理么,不行的話直接拋出,可以參考原則4
    4. Throw early and catch late
        一般底層函數不會處理異常,外層函數會根據上下文捕獲異常進行處理或者轉換
    5. 不要覆蓋異常
    6. try塊不應該太大(代碼規范)
    7. 函數拋出的異常不應該太多(代碼規范)

    參考

    posted @ 2012-03-12 16:35 Milo的海域 閱讀(250) | 評論 (0)編輯 收藏

    Ref http://ubuntudaily.net/archives/15

    Enhanced version
    trim()
    {
        trimmed
    =$1
        trimmed
    =${trimmed%%\s*}
        trimmed
    =${trimmed##\s*}
        echo "$trimmed"
    }
    var=" a bc   "
    var=$(trim $var)

    posted @ 2012-03-07 18:58 Milo的海域 閱讀(412) | 評論 (0)編輯 收藏

    同事寫的auto ssh login script:

    #!/usr/bin/expect -f
    # by gwang

    # default password list
    array set passwd {
        
    0 "password1"
        
    1 "password2"
        
    2 "password3"
    }

    # try login
    spawn $env(SHELL)
    match_max 
    100000
    send 
    -- "ssh -p $port $user@$ip\r"
    foreach i [array names passwd] {
        expect {
            
    "(yes/no)" {
                send 
    -- "yes\r"
                    exp_continue
            }
            
    "password:" {
                send 
    -- "$passwd($i)\r"
            }
            
    "Last login" {
                
    break
            }
        }
    }
    interact

    由于ssh client默認支持的密碼錯誤重試是3, 所以這里只支持3個備選密碼。
    Google for "ssh client password retry" and find link which could help:
    ssh login retry  介紹了只要修改ssh client配置文件里/etc/ssh/ssh_config的NumberOfPasswordPrompts選項就可以了。無需重啟sshd...

    posted @ 2012-03-02 15:35 Milo的海域 閱讀(1079) | 評論 (0)編輯 收藏

    Disable/Enable PORT
    #disable port 29600
    iptables -I INPUT -p tcp --dport 
    29600 -j DROP
    iptables -I OUTPUT -p tcp --dport 
    29600 -j DROP

    #enable port 29600 after disabled
    iptables -D INPUT -p tcp --dport 29600 -j DROP
    iptables -D OUTPUT -p tcp --dport 
    29600 -j DROP

    Block Ipaddress
    # Block comming packets of ipaddress, then all packets come from this address will be dropped
    iptables -A INPUT -s 192.168.1.5 -j DROP

    # Block outgoing packets of ipaddress, then all packets sent to that address will be dropped
    iptables -A OUTPUT -p tcp -d 192.168.1.2  -j DROP

    Disable NIC traffic
    # disable
    iptables -A INPUT -jDROP -i eth1
    iptables -A OUTPUT -jDROP -o eth1

    # enable back
    iptables -D INPUT -jDROP -i eth1
    iptables -D OUTPUT -jDROP -o eth1

    links
    http://wiki.centos.org/HowTos/Network/IPTables
    http://www.thegeekstuff.com/2011/06/iptables-rules-examples/

    posted @ 2012-02-27 10:41 Milo的海域 閱讀(229) | 評論 (0)編輯 收藏

    Official ref: innodb_flush_log_at_trx_commit

    這個參數的配置涉及trax提交寫trax log文件的行為
    innodb_flush_log_at_trx_commit = 0
    # 每秒寫一次trax log
    ,并執行fsync

    innodb_flush_log_at_trx_commit 
    = 1
    # 每次trax 提交的時候寫一次trax log
    , 并執行fsync

    innodb_flush_log_at_trx_commit 
    = 2
    # 每次trax 提交的時候寫一次trax log
    , 不會執行fsync

    posted @ 2012-02-23 16:28 Milo的海域 閱讀(663) | 評論 (0)編輯 收藏

    改壞/etc/fstab文件會導致linux系統啟動時fsck失敗,從而進入"repair filesystem". 解決方法是:
        1. 執行 
             mount -o remount rw /
           進入讀寫模式
        
    2. edit /etc/fstab to correct typo or invalid setting
        
    3. exit repair filesystem to reboot


    posted @ 2012-02-21 17:09 Milo的海域 閱讀(322) | 評論 (0)編輯 收藏

    This is gnome behavior if you find some device volumes created on your gnome desktop.
    Ref:
    fedora 8/9/10的gnome下解決自動掛載windows分區的最佳辦法

    posted @ 2012-02-21 17:02 Milo的海域 閱讀(293) | 評論 (0)編輯 收藏

    僅列出標題
    共9頁: 上一頁 1 2 3 4 5 6 7 8 9 下一頁 
    主站蜘蛛池模板: 成人免费a级毛片| a级毛片免费在线观看| 免费国产黄网站在线观看可以下载 | 亚洲精品无码MV在线观看| 蜜桃传媒一区二区亚洲AV| 亚洲电影在线免费观看| 亚洲精品一品区二品区三品区| 婷婷亚洲综合一区二区| 女人让男人免费桶爽30分钟| 亚洲视频免费在线播放| 久久精品免费观看| 亚洲精品国产字幕久久不卡| 一级中文字幕乱码免费| 亚洲国产aⅴ综合网| 亚洲欧美第一成人网站7777| 亚洲免费网站观看视频| 亚洲Av无码一区二区二三区| 四虎在线最新永久免费| 亚洲午夜电影在线观看| 精品免费久久久久久久| 亚洲系列国产精品制服丝袜第| 国产亚洲免费的视频看| 亚洲av永久无码精品网站| 91免费在线视频| 久久夜色精品国产亚洲| 国产精品99久久免费观看| 亚洲AV无码乱码在线观看富二代| 怡红院免费全部视频在线视频| 亚洲性猛交XXXX| 大地资源网高清在线观看免费| 亚洲国产一二三精品无码| 黄网站免费在线观看| 久久久亚洲欧洲日产国码农村| 三年片在线观看免费| 亚洲精品高清国产一久久| 精品熟女少妇a∨免费久久| 亚洲成年人电影在线观看| 国产精品免费观看久久| 国产亚洲人成在线播放| 亚洲欧洲精品成人久久奇米网| 青柠影视在线观看免费|