<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 下一頁 
    主站蜘蛛池模板: 午夜老司机免费视频| 8x成人永久免费视频| 在线视频免费国产成人| 亚洲国产成人久久精品app| 120秒男女动态视频免费| 亚洲a一级免费视频| 午夜视频在线免费观看| 亚洲日韩aⅴ在线视频| 久久精品视频免费| 91亚洲国产成人久久精品网站| 一级毛片免费观看| 亚洲伊人久久大香线蕉| 免费的涩涩视频在线播放| 羞羞网站免费观看| 亚洲精品无码久久久久| 91精品成人免费国产片| 亚洲午夜无码久久久久小说 | 羞羞视频在线免费观看| 亚洲无线码在线一区观看| 亚洲免费视频在线观看| 亚洲日本久久久午夜精品| 国产乱子伦精品免费无码专区| 一个人免费观看视频在线中文| 亚洲成A∨人片在线观看不卡 | 日韩精品无码区免费专区| 亚洲日本VA午夜在线电影| 亚洲成A人片在线观看无码3D| 三上悠亚电影全集免费| 亚洲最大在线视频| 免费黄网在线观看| 国产在线观看免费av站| 亚洲伊人久久大香线蕉影院| 亚洲国产中文字幕在线观看| 久操视频免费观看| 亚洲GV天堂GV无码男同| 久久国产亚洲精品麻豆| 日韩视频免费在线| a在线观看免费网址大全| 亚洲欧美日韩综合久久久久| 色噜噜AV亚洲色一区二区| 在线观看视频免费完整版|