- 編輯 docker daemon 設定檔,設定 docker daemon 的 proxy
# vim /etc/sysconfig/docker other_args= export HTTP_PROXY="http://<ip>:<port>" export HTTPS_PROXY="https://<ip>:<port>"
- 重新啟動 docker daemon
# service docker restart
- 搜尋 coreos image
# docker search coreos NAME DESCRIPTION STARS OFFICIAL AUTOMATED tnolet/mesos-on-coreos 2 [OK] monder/coreos-nginx 2 [OK] million12/linode-coreos-api Deploy CoreOS on Linode. 1 [OK] shift/coreos-ubuntu-etcd 1 [OK]
- 下載 coreos image
# docker pull tnolet/mesos-on-coreos
黃小瀞的學習筆記
2015年1月26日 星期一
docker daemon proxy 設定 on CentOS 6
2015年1月9日 星期五
Install Docker on CentOS 6.4
- 安裝 EPEL repository repository
# wget http://mirror-fpt-telecom.fpt.net/fedora/epel/6/i386/epel-release-6-8.noarch.rpm # rpm -ivh epel-release-6-8.noarch.rpm
- 執行 yum update 出現錯誤訊息:Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again
# yum update Loaded plugins: fastestmirror, security Determining fastest mirrors Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again
- 修改「/etc/yum.repos.d/epel.repo」設定
將 baseurl 前面的 # 拿掉,mirrirlist 前面加上 #
baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
- 安裝 Docker
# yum install docker-io
- 啟動 Docker
# service docker start
- 設定開機時自動啟動 Docker
# chkconfig docker on
2014年12月30日 星期二
用 iphone 啟用 chromecast
參考 chromecast 包裝上的 Getting Started 步驟,將 chromecast 裝置連結電源,插入電視的 HDMI 插槽,切換電視的輸入設定後,開始進行 chromecast 裝置初始設定。
- 開啟 iphone Chrome app ,網址列輸入「chromecast.com/setup」
- 安裝 iphone Chromecast app
- 安裝完成後,開啟 Chromecast app
- Chromecast app 會自動尋找你的 Chromecast 裝置,第一次設定請選設定新的 CHROMECAST
- 根據提示選擇 chromecast 裝置的 Wi-Fi,與 chromecast 裝置連線
- 返回 iphone Chromecast app 會發現已與 chromecast 裝置連線。接著驗證 chromecast,確認手機與電視是否看到一樣的代碼,如是的話,點選「我看到這個驗證碼了」
- 開始 chromecast 裝置初始設定,設定區域「台灣」,設定名稱,設定網路
- chromecast 裝置連上網路後會進行更新,更新後會重新啟動,需要等待一下
- 完成後開啟 iphone Chromecast app 選取你的 chromecast 裝置,即可開始投放
- 更多 chromecast 資訊可以參考「chromecast.com/learn」
標籤:
chromecast,
iphone
2014年9月17日 星期三
Norikra 試用紀錄
Norikra is a open source server software provides "Stream Processing" with SQL, written in JRuby, runs on JVM, licensed under GPLv2.
心得:
- install JRuby (downloads)
- install Norikra (要等個幾分鐘才會開始裝)
- start Norikra (要等個幾分鐘才會啟動成功)
- Norikra web UI :http://IP:26578
- 以 web service 的 log 為例,首先定義 target 的欄位 (minimal fields set for variations of 'www' events),定義最基本的欄位就好,可再修改
- 加入 query 指令:查詢首頁(path="/")被存取的次數
- 加入 query 指令 with Views (Windows)。Views are used to define time windows or to control timing to fire events. With views, norikra controls the range of events for each queries.
- 開始將資料送到 norikra
- script
- log
- 查看 query 結果
- 取得 query 結果,取到的結果會被刪除,如沒有新的事件發生,再查看 query 結果是沒有資料的
# tar xzvf jruby-bin-1.7.15.tar.gz # mv jruby-1.7.15 /opt # echo "PATH=$PATH:/opt/jruby-1.7.15/bin" > ~/.bashrc # jruby -v jruby 1.7.15 (1.9.3p392) 2014-09-03 82b5cc3 on Java HotSpot(TM) 64-Bit Server VM 1.6.0_33-b04 +jit [linux-amd64]
# gem install norikra
# norikra start
# norikra-client target open www path:string status:integer referer:string agent:string userid:integer # norikra-client target list TARGET AUTO_FIELD www true 1 targets found.
# norikra-client query add www.toppage 'SELECT count(*) AS cnt FROM www WHERE path="/" AND status=200'
# norikra-client query add www.toppageviews 'SELECT count(*) AS cnt FROM www.win:time_batch(3 sec) WHERE path="/" AND status=200'
#!/bin/sh for i in `seq 1 1 3`; do data1='{"path":"/", "status":200, "referer":"", "agent":"MSIE", "userid":3}' echo `date +"%Y/%m/%d-%H:%M:%S"` $data1 echo $data1 | norikra-client event send www sleep 3 # data2='{"path":"/login", "status":301, "referer":"/", "agent":"MSIE", "userid":3}' echo `date +"%Y/%m/%d-%H:%M:%S"` $data2 echo $data2 | norikra-client event send www sleep 3 # done
2014/09/17-23:07:58 {"path":"/", "status":200, "referer":"", "agent":"MSIE", "userid":3} 2014/09/17-23:08:13 {"path":"/login", "status":301, "referer":"/", "agent":"MSIE", "userid":3} 2014/09/17-23:08:29 {"path":"/", "status":200, "referer":"", "agent":"MSIE", "userid":3} 2014/09/17-23:08:45 {"path":"/login", "status":301, "referer":"/", "agent":"MSIE", "userid":3} 2014/09/17-23:09:00 {"path":"/", "status":200, "referer":"", "agent":"MSIE", "userid":3} 2014/09/17-23:09:16 {"path":"/login", "status":301, "referer":"/", "agent":"MSIE", "userid":3}
# norikra-client event see www.toppage {"time":"2014/09/17 23:08:10","cnt":1} {"time":"2014/09/17 23:08:41","cnt":2} {"time":"2014/09/17 23:09:13","cnt":3} # norikra-client event see www.toppageviews {"time":"2014/09/17 23:08:13","cnt":1} {"time":"2014/09/17 23:08:16","cnt":0} {"time":"2014/09/17 23:08:43","cnt":1} {"time":"2014/09/17 23:08:46","cnt":0} {"time":"2014/09/17 23:09:16","cnt":1} {"time":"2014/09/17 23:09:19","cnt":0}
# norikra-client event fetch www.toppageviews {"time":"2014/09/17 23:08:13","cnt":1} {"time":"2014/09/17 23:08:16","cnt":0} {"time":"2014/09/17 23:08:43","cnt":1} {"time":"2014/09/17 23:08:46","cnt":0} {"time":"2014/09/17 23:09:16","cnt":1} {"time":"2014/09/17 23:09:19","cnt":0} # norikra-client event fetch www.toppageviews
心得:
- 易上手,定義 data set 後,寫少少的程式(SQL)就可開始做資料處理。
- 具備排程功能,資料處理的動作可以 run forever,可設定對全部的資料做處理或者一次處理一段時間內的資料,因資料皆存在 memory 中,對全部的資料做處理時要注意 out of memory 的問題。
- 安裝簡單,單機作業,無資料分散 or 運算分散的架構(ex: storm)。
- 目前無考慮 HA,作者說也不需要考慮。
- 想想適合用在哪裡?複雜多樣的小資料收集與前處理,定期 fetch 處理結果 or 一前處理完就往其他地方匯出,清空主機 memory。
install python 2.7 & virtualenv on CentOS 6
- 安裝 gcc
- Build Python-2.7 (downloads)
- 載入動態資料庫
- install virtualenv
- 利用 virtualenv 建立 python 2.7 的開發環境 (因為 CentOS 6 預設的 python 版本為 2.6,預設的版本最好不要亂改)
- 離開 python 2.7 開發環境
# yum install gcc gcc-c++.x86_64 compat-gcc-34-c++.x86_64 openssl-devel.x86_64 zlib*.x86_64
# wget https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz # tar zxvf Python-2.7.8.tgz # cd Python-2.7.8 # ./configure --enable-shared # make # make install
# touch /etc/ld.so.conf.d/python2.7.conf # vim /etc/ld.so.conf.d/python2.7.conf /usr/local/lib # ldconfig
# python-pip install virtualenv
# virtualenv fayeENV --python=python2.7 # source fayeENV/bin/activate # python Python 2.7.8 (default, Sep 17 2014, 15:35:06) [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>
# deactivate
參考資料:
標籤:
centos,
python,
python 2.7,
virtualenv
2014年9月16日 星期二
install python-pip on CentOS 6
- turn on EPEL repo for CentOS
- install python-pip
- 完成安裝,之後可用下列指令安裝 python 套件
# wget http://mirror-fpt-telecom.fpt.net/fedora/epel/6/i386/epel-release-6-8.noarch.rpm # rpm -ivh epel-release-6-8.noarch.rpm
# yum install python-pip
# python-pip install <package_name>
參考資料:
標籤:
centos,
pip,
python,
python-pip
訂閱:
文章 (Atom)