總網頁瀏覽量

2013年9月26日 星期四

adjust brightness on ubuntu

recently I'm trying Ubuntu OS which has been installed on my USB stick.

And I found that my screen brightness is too high.

In order to resolve this issue,

apt-get install xbacklight

after that, I can use my laptop's hot key to adjust the brightness of screen.

This makes me feel good,

but, while I found the touchpad isn't work well on 3, 4 finger gesture,

I was upset, again :(

2013年9月24日 星期二

How to remove an entry from efi bootloader

I was trying to setup a USB stick contents a standalone ubuntu OS which would let my win8 ultrabook more "producable".
In the end, I messed up my bootloader to have a ubuntu boot option which should be on the usb drive, and I do not even get my USB drive ready.
After several try on googling the answer on how to remove that ugly boot entry, I finally figure it out.
The way is much more than simple,
no need to delete it by efibootmgr(ubuntu), bcdedit(windows), or download the easyBCD software.

All things you gonna to do is
(1) boot your device into a ubuntu live CD which should you prepared for ubuntu installation.
(2) check which partition does EFI entry located by "gparted" (it should format in FAT32)
(3) mount it on, for example,
mount -t vfat /the-efi-partition /whatever-mount-point
(4) cd in the directory and you could find the ubuntu boot entry: EFI/ubuntu.
(5) remove the entire folder: rm -rf EFI/ubuntu

That's it, you get it.

2013年8月13日 星期二

putty快速登入設定

玩linux的人若不是用mac,多半都用過putty吧

今天分享一點小發現

一般使用時通常會把一些常用的ip或hostname取個精美好記的名字存起來

要連線時再打開putty並選擇該session連入

但如果想要更方便一點執行程式就直接連入呢

試想一個geek每秒鐘幾萬行上下可不能浪費一點時間在「click」身上阿(誤)

據此google一下後發現putty.exe也是可以下參數的

先對putty.exe建立一個捷徑

對新建出來的捷徑點右鍵 -> 選擇「捷徑」標籤

出現以下畫面



這時就可以在「目標」欄位上動手腳拉

C:\Users\aaa\Desktop\putty.exe -load YOUR_SESSION_NAME

這樣這個捷徑一啟動即自動連入YOUR_SESSION_NAME

C:\Users\aaa\Desktop\putty.exe -load YOUR_SESSION_NAME -l YOUR_USER_NAME -pw YOUR_PASSWORD

直接輸入username/password帶你登入到YOUR_SESSION_NAME

要注意的是對於不critical的開發環境這樣做還可以接受

但比較敏感的機器還是勤勞點手輸吧

2013年7月12日 星期五

使用Google Proto buffer做簡單高效的資料傳輸

Proto buffer是google原先為了方便RPC資料傳輸而發展出來的專案

一個簡單的理解是Protobuf與XML的定位相似

都是用來做資料傳輸的

只是Protobuf會以Binary的方式傳輸

相對XML一堆(噁爛)tag要來得高效

其使用方式也非常簡單

只要定義好你的.proto檔


protobuffer compiler可以幫你建出特定語言的資料存取程式

例如: protoc -I=$SRC_DIR --java_out=$DST_DIR $SRC_DIR/addressbook.proto

會依據你定義的addressbook.proto建出相對應的java code放到$SRC_DIR下

至於怎麼拿這些java code來存取protobuf資料

詳見tutorial
https://developers.google.com/protocol-buffers/docs/javatutorial?hl=zh-TW



下面先帶個起手式 - 安裝protoc

小弟我是在centos6環境上安裝的。

在安裝protobuf前需要齊備的環境有:

yum install gcc gcc-c++

接著選擇你鍾愛的protobuf版本

https://code.google.com/p/protobuf/downloads/list

我選擇的是2.4.1版
https://code.google.com/p/protobuf/downloads/detail?name=protobuf-2.4.1.tar.gz&can=2&q=

下載下來後解壓縮
tar zxvf protobuf-2.4.1.tar.gz

進入到資料夾內可以找到README.txt

前幾行就告訴你如何安裝了

./configure
make
make check
make install

基本上./configure沒有出現error的話後續安裝也就不會有問題了

安裝完輸入protoc --version

libprotoc 2.4.1

表示成功裝完,後面要繼續玩

就把上面的tutorial詳看吧,我覺得寫得很不錯唷

2013年5月25日 星期六

fair scheduler設定經驗分享

上禮拜應主管要求,想在fair scheduler加上global的mapper/reducer數量限制
查閱官方文件
http://hadoop.apache.org/docs/stable/fair_scheduler.html

不見global linitation設定蹤跡
後來請示了神人同事確定無此設定
那怎辦呢

其實還是有workaround(不過也有副作用)
那就是把scheduler吃的pool name改成MR的queue name
要enable此功能需要再mapred-site.xml設置:

<property>
<name>mapred.fairscheduler.poolnameproperty</name>
<value>mapred.job.queue.name</value>
</property>

接著只要在fair-scheduler.xml中設置pool的limitation即可
例如:

<pool name="default">
<minmaps>14</minMaps>
<minreduces>8</minReduces>
<maxmaps>25</maxMaps>
<maxreduces>12</maxReduces>
</pool>

即所有人最少有14mapper/8reducer, 最多25/12
如此一來所有沒有設定queue name的MR job(使用default queue)都會apply到
但是!!!
因為scheduler是吃queue name來做控管
在此設定下要區分priority的話
就必須設定另一組queue
mapred-site.xml:

<property>
<name>mapred.queue.names</name>
<value>default,production</value>
</property>

現在有兩組queue, default和production
要讓production有更高優先權的話需要在fair-scheduler.xml中設置:

<pool name="production">
<minmaps>100</minMaps>
<minreduces>50</minReduces>
</pool>

即最少保證mapper的fair share有100, reducer有50,沒有天花板限制(有多少拿多少)
要讓MR job submit到production queue中
需要設定queue name:

-D mapred.job.queue.name=hdfs (generic option)
setQueueName(String) (API)

但是但是!!!
還有一件事要做
每個MR job都可以設queue name為production呀
因此沒設定ACL的話也只是做一半四不像而已

在mapred-site.xml下設定ACL

<property>
<name>mapred.acls.enabled</name>
<value>true</value>
</property>
<property>

意思是讓group1和group2兩個群組的user可以submit job到production queue
這裡的group就是hadoop hdfs的group無誤
走到這一步
基本算是大功告成

如果你的hadoop cluster是用simple authentication的話...
我只能說你是白做了XDDD

2013年5月6日 星期一

screen網路斷線後再連入會hang住

這個問題困擾我好久
經請教強著同事 Jeff Hung
原因如下
因我每次連入都是用scree -rd
會把上一次連線踢掉再連進去
不過由於是網路斷線
上一個session還傻傻在等待回應
導致沒辦法detach

[RESOLVE]
使用screen -xRR
連入時不踢掉session而是同步使用

2013.5.11
改用xRR發現因為是連上共用session,所以resolution以原session為主
這就造成我這端畫面很醜的問題
再次請教J神,ctrl+F即可resize

2013年5月2日 星期四

Ganglia start failed on ambari after OS reboot

Restarted VMs and all ambari server/agent are started,

only ganglia service can not been bright up.

I think it may due to that I just power off the VM instead of stop services first.

[RESOLVE]
http://hortonworks.com/community/forums/topic/ganglia-not-working-on-hdp-1-2/

Kill the process {gmond,gmetad} and start it on web UI again.

The root cause of this issue is that ambari has its own wrapped gmond and gmetad.

The origin one will fight with ambari one.