<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的海域 閱讀(370) | 評論 (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的海域 閱讀(363) | 評論 (0)編輯 收藏

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

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

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

    參考

    posted @ 2012-03-12 16:35 Milo的海域 閱讀(257) | 評論 (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的海域 閱讀(416) | 評論 (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的海域 閱讀(1080) | 評論 (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的海域 閱讀(232) | 評論 (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的海域 閱讀(671) | 評論 (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的海域 閱讀(325) | 評論 (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的海域 閱讀(300) | 評論 (0)編輯 收藏

    僅列出標題
    共9頁: 上一頁 1 2 3 4 5 6 7 8 9 下一頁 
    主站蜘蛛池模板: 亚洲欧洲免费无码| 麻豆国产精品免费视频| 国产成人免费全部网站| 亚洲综合一区二区三区四区五区| 成年人免费的视频| 亚洲国产成人久久99精品| 一级毛片**不卡免费播| 亚洲色欲www综合网| 国产电影午夜成年免费视频| 亚洲成人黄色网址| 欧美好看的免费电影在线观看| 久久久久se色偷偷亚洲精品av| 无码国产精品一区二区免费式影视 | 三年片在线观看免费| 久久精品国产亚洲香蕉| 99精品在线免费观看| 激情五月亚洲色图| 日本一道在线日本一道高清不卡免费 | 哒哒哒免费视频观看在线www| 激情无码亚洲一区二区三区 | 亚洲免费视频播放| 成年私人影院免费视频网站| 成人婷婷网色偷偷亚洲男人的天堂 | 日韩毛片免费一二三| 亚洲日韩欧洲乱码AV夜夜摸| 95免费观看体验区视频| 亚洲一区精品视频在线| 日本高清免费网站| caoporn国产精品免费| 久久精品国产亚洲| 九九九精品成人免费视频| 国产成人精品日本亚洲语音 | 亚洲人成www在线播放| 一区国严二区亚洲三区| 中文在线免费看视频| 亚洲精品美女在线观看播放| 免费看www视频| 曰批全过程免费视频在线观看无码 | 亚洲一区二区三区乱码在线欧洲| 免费一级国产生活片| 无码少妇精品一区二区免费动态|