2013年4月30日 星期二

Host Aggregate : 用來在availability zone中進行劃分

Host aggregates are a mechanism to further partition an availability zone; while availability zones are visible to users, host aggregates are only visible to administrators. 

[Note]

Each node can have multiple aggregates, each aggregate can have multiple key-value pairs, and the same key-value pair can be assigned to multiple aggregate.

Xenserver

當使用Xenserver當作hypervisor時,可以使用host-aggregate來管理Xenserver Resource Pool以支援Live migration。

Xen / XCP / Xenserver comparison





xapi a.k.a XenAPI

XAPI is at the heart of XenServer. It manages everything – all the resources in your XenServer environment, 

  1. reads in configs, 
  2. initializes networking paths, 
  3. checks licensing, 
  4. maintains a Database with all this info (the XAPI database), 
  5. manages Storage Repositories, 
  6. manages VMs, 
  7. tracks VM states, 
  8. manages networking, 
  9. High Availability 
  10. other XenServer hosts in the pool and more……
Each XenServer request or action is done via Xapi and only by asking the Master XenServer XAPI to do so. 

A copy of the XAPI database (or you could consider this to be the state of XAPI) is synchronized among all the hosts in the pool so they all have a copy of the current XAPI database – giving them the knowledge of what is going on – and in the case of the master going down – a new master can be appointed from the pool using the XAPI state information or shared database.
When you collect a status report from XenServer – the XAPI Database is stored in the status report. It is a relational database – and shows us the state of the environment at that point in time (when the status report was captured).

Reference

2013年4月29日 星期一

SQLAlchemy



ORM與傳統SQL語句間的差異
 
   ORM的出現,相信你早已由網路資料、書籍中得知許多,但心中或有疑問,為何要捨SQL指令不用,而去學習一種新的語法,新的資料存取架構?本文嘗試由反向角度出發,探討著ORM為何會出現,SQL指令又有何不妥之處,讓ORM將其隱藏起來。在你看過的資料中,多半會列出一張表,告訴你ORM有何好處,我們就從這張表開始吧。
表1 ORM的優點

1、以物件表現列、以屬性表現欄,以純OOP的概念來操控資料庫。
2、隱藏SQL指令,以此達到跨資料庫時,不需修改應用程式的目的。
3、以單一語法,操控所有資料庫,減輕學習者的負擔。
4、自動產生SQL指令,避免因程式設計師能力不同,寫出效率不彰的應用程式。
5、自動產生SQL指令,避免程式設計師對安全性的認知程度不同,寫出不安全的應用程式。







SQLAlchemy的特色:  ORM(Object Relational Mapper) vs Core

SQLAlchemy considers the database to be a relational algebra engine, not just a collection of tables. 


  • Rows can be selected from not only tables but also joins and other select statements; any of these units can be composed into a larger structure. 
  • SQLAlchemy's expression language builds on this concept from its core.


ORM(Object Relational Mapper, 物件關係映射器) 

The SQLAlchemy Object Relational Mapper presents a method of associating user-defined Python classes with database tables, and instances of those classes (objects) with rows in their corresponding tables

SQLAlchemy features, http://www.sqlalchemy.org/features.html

http://www.keakon.net/2012/12/03/SQLAlchemy%E4%BD%BF%E7%94%A8%E7%BB%8F%E9%AA%8C

http://www.dotblogs.com.tw/code6421/archive/2009/02/10/7100.aspx

MySQL has gone away


http://jjdai.zhupiter.com/2010/10/mysql-%E8%A7%A3%E6%B1%BAmysql-server-has-gone-away%E5%95%8F%E9%A1%8C/

git clone / fetch / pull


Clone:
會把遠端的repo整個專案抓下來,放在目前路徑下的新目錄中。(所以不需要先把新目錄建立成Repo,就可以整包抓下來,隨包附上.git目錄)
Pull = Fetch + Merge : 會把遠端的repo整個專案抓下來,跟你目前所在的Repo及所用的Branch作合併(Merge),此指令等同Fetch+Merge。

Fetch
:

會把遠端的repo整個專案抓下來,但不跟你目前所用的branch合併,而是放在本地中的另一個Branch(remoteBranch)。
http://www.mrmu.com.tw/2011/05/06/git-using-dropbox-as-server/


http://kevyu.blogspot.tw/2011/08/git-push.html

git remote篇


Git remote 維護遠端檔案

  • git remote
  • git remote add new-branch http://git.example.com.tw/project.git # 增加遠端 Repository 的 branch(origin -> project)
  • git remote show # 秀出現在有多少 Repository
  • git remote rm new-branch # 刪掉遠端的new-branch
  • git remote update # 更新所有 Repository branch
  • git branch -r # 列出所有Remote Repository branch
  • git remote show <branch> 

Reference

ceilometer 安裝筆記


安裝步驟

1. Installing Central Collector

2. Installing Compute Agent

每個compute node都必須安裝ceilometer然後進行配置。

3. Installing Central Agent

4. Installing API Server

The API server needs to be able to talk to keystone and ceilometer’s database




[Note] /etc/ceilometer/ceilometer.conf

meter_sceret必須修改且每一個裝設ceilometer套件的conf中的sceret值必須相同


各功能元件的所在

/usr/local/bin/ceilometer-agent-central
/usr/local/bin/ceilometer-agent-compute
/usr/local/bin/ceilometer-api
/usr/local/bin/ceilometer-collector
/usr/local/bin/ceilometer-dbsync

MongoDB

MongoDB是document-oriented的database,是NoSQL的一員,由C++撰寫成,由10gen團隊所開發。

MongoDB使用內存對映檔案, 32位元系統上限制大小為2GB的資料 (64-位元要更大的資料)

This MongoDB instance will store its data files in the /var/lib/mongodb and its log files in /var/log/mongodb, and run using the mongodb user account.




{
  _id : ObjectId(...),
  author : 'Rei',
  content : 'content text',
  comments : [ { name : 'Asuka'
                 email : '...',
                 web_site : '...',
                 content : 'comment text'} ]
}
comments 項是內嵌在 post 項中的(作為陣列)。在 MongoDB 中,一個資料項目叫做 Document,一個文檔嵌入另一個文檔(comment 嵌入 post)叫做 Embed,儲存一系列文檔的地方叫做 Collections。順便一提,MongoDB 中也提供類似 SQL 資料庫中的表間關聯,叫做 Reference。



4. MongoDB 另外一些特點

4.1 JSON 文檔式查詢

MongoDB 的查詢語言看起來是這樣的:
> db.users.find( { x : 3, y : "abc" } ).sort({x:1});
這是在 MongoDB 內置的 JavaScript 控制臺上的查詢,表示在名為 users 的 Collections 中查找 x = 3,y = “abc” 的文檔,並且以 x 遞增的順序返回資料。
JSON 文檔式查詢會讓寫慣應用層代碼的開發者眼前一亮,但對於精通 SQL 查詢的關聯資料庫管理員來說就是一個新的挑戰了。
4.2 對分散式的支援

MongoDB 對大型網站的最大吸引力也許來源於其對分散式部署的支持。當今互聯網最流行的資料庫 MySQL 在網站擴大到一定規模之後就會遇到擴展瓶頸,解決方案通常是分表分庫、配置主從資料庫。很多互聯網開拓者前仆後繼的為資料庫擴展性奮鬥,留下了一頁頁的寶貴經驗。


PS:
在 SQL 資料庫中,為表達資料的從屬關係,通常要將表間關係分為 one-to-one,one-to-many,many-to-many 等模式進行設計,這通常會需要很多鏈結表的輔助。



Reference
http://zh.wikipedia.org/wiki/MongoDB
http://calos-tw.blogspot.tw/2010/03/mongodb.html

MongoDB的介紹,
http://atlantischiu.blog.ithome.com.tw/post/3058/110773

NoSQL的出現是否要取代RDBMS?! 選擇MongoDB的原因:
http://atlantischiu.blog.ithome.com.tw/post/3058/110773

http://www.oschina.net/p/mongodb

如何在glance上做Notifications


當有image進行create/update/delete時會進行notify的動作

而要在Glance上做"notification"目前有(以folsom版本為例)三種方法

  1. loggin ( via the log_file directive )
  2. rabbit ( via rabbitmq queue )
  3. qpid ( via qpid message queue
  4. none ( no notifications sent, 預設模式)


2013年4月28日 星期日

tar -C的用途


tar -C 就是表示Change to the directory

tar -C  <dir-to-change>

Linux pipe指令的"減號(-)"用途


關於減號 - 的用途
管線命令在 bash 的連續的處理程序中是相當重要的!另外,在 log file 的分析當中也是相當重要的一環, 所以請特別留意!另外,在管線命令當中,常常會使用到前一個指令的 stdout 作為這次的 stdin , 某些指令需要用到檔案名稱 (例如 tar) 來進行處理時,該 stdin 與 stdout 可以利用減號 "-" 來替代, 舉例來說:
[root@www ~]# tar -cvf - /home | tar -xvf -
上面這個例子是說:『我將 /home 裡面的檔案給他打包,但打包的資料不是紀錄到檔案,而是傳送到 stdout; 經過管線後,將 tar -cvf - /home 傳送給後面的 tar -xvf - 』。後面的這個 - 則是取用前一個指令的 stdout, 因此,我們就不需要使用 file 了!這是很常見的例子喔!注意注意!


Reference
http://linux.vbird.org/linux_basic/0320bash.php#pipe_7

Xen / XCP / Xenserver in OpenStack Installation




Post install steps

You are now ready to install OpenStack onto your XenServer system. This process involves the following steps:
  • For resize and migrate functionality, please perform the changes described in the Configuring Resize section of the OpenStack Compute Administration Manual.
  • Install the VIF isolation rules to help prevent mac and ip address spoofing.
  • Install the XenAPI plugins - see the next section.
  • In order to support AMI type images, you need to set up /boot/guest symlink/directory in Dom0. For detailed instructions, see next section.
  • To support resize/migration, set up an ssh trust relation between your XenServer hosts, and ensure /images is properly set up. See next section for more details.
  • Create a Paravirtualised virtual machine that can run the OpenStack compute code.
  • Install and configure the nova-compute in the above virtual machine.


Ensure you are using the EXT type of storage repository (SR). Features that require access to VHD files (such as copy on write, snapshot and migration) do not work when using the LVM SR. Storage repository (SR) is a XenAPI specific term relating to the physical storage on which virtual disks are stored.
On the XenServer/XCP installation screen, this is selected by choosing "XenDesktop Optimized" option. In case you are using an answer file, make sure you use srtype="ext" within the installation tag of the answer file.


In order to support AMI type images, you need to set up /boot/guest symlink/directory in Dom0.



Prepare for AMI Type Images

    為了讓Xenserver的dom0能夠支援Amazon的VM Image type: AMI,所以必須在dom0建立/boot/guest的資料夾,讓OpenStack能夠從解壓縮開的AMI以及ARI Image中放kernel以及ramdisk到這個資料夾。正常來說這個資料夾是由OpenStack來進行維護的,不會因為power failures 或者意外事故造成一些垃圾檔案充斥在dom0中,所以推薦的作法是做symbolic link。


In order to support AMI type images within your OpenStack installation, a directory /boot/guest needs to be created inside Dom0. The OpenStack VM will put the kernel and ramdisk extracted from the AKI and ARI images to this location.

This directory's content will be maintained by OpenStack, and its size should not increase during normal operation, however in case of power failures or accidental shutdowns, some files might be left over. In order to prevent these files to fill up Dom0's disk, it is recommended to set up this directory as a symlink pointing to a subdirectory of the local SR.
Execute the following commands in Dom0 to achieve the above mentioned setup:
# LOCAL_SR=$(xe sr-list name-label="Local storage" --minimal)
# LOCALPATH="/var/run/sr-mount/$LOCAL_SR/os-guest-kernels"
# mkdir -p "$LOCALPATH"
# ln -s "$LOCALPATH" /boot/guest

nova flavor


所謂的"flavor"就是指VM Instance Type

nova flavor-list可以看出

2013年4月27日 星期六

如何解決sed無法立即修改隱藏檔(.filename)的問題


像我們在做SSH時,~/.ssh/known_hosts會記錄ssh過的主機,但我們有時有刪除紀錄的需要

於是下達  sed -i  '/a.b.c.d/d' ~/.ssh/known_hosts,但此時會噴出 invalid command at . 的錯誤訊息


於是得改下  sed -i ""  '/a.b.c.d/d' ~/.ssh/known_hosts 就可以解決惹

Centos必須改成 sed --in-place=""

ssh-keygen -f "/root/.ssh/known_hosts" -R x.x.x.x

http://www.markhneedham.com/blog/2011/01/14/sed-sed-1-invalid-command-code-r-on-mac-os-x/

CloudStack的管理階層



  • Zone: Availability zone, aka Regions. Could be worldwide. 
  • Pod: Rack in a data center
  • Cluster: Group of machines with a common type of Hypervisor
  • Host: A Single server
  • Primary Storage: Shared storage across a cluster
  • Secondary Storage: Shared storage in a single Zone


CloudStack Networking

http://www.shapeblue.com/2013/01/07/understanding-cloudstacks-physical-networking-architecture/

CloudStack vs OpenStack的比較與發展趨勢


CloudStack vs OpenStack 的發展趨勢
http://lab.howie.tw/2013/03/the-develpoment-trend-of-cloudstack-and-openstack.html

AWS Load-balancer


AWS ELB的使用限制:

You can setup your load balancer to load balance incoming requests across EC2 instances in a single Availability Zone or multiple Availability Zones within a region. Your load balancer does not distribute traffic across regions.

-- AWS ELB可以在某一個Region來平衡一到多個availability zones
-- 但AWS ELB無法跨Region來做負載平衡

2013年4月26日 星期五

Region and Endpoint in AWS


由以下AWS的連結我們可以清楚看到所謂的Region以及Endpoint的定義與實利,而OpenStack本身就是基於AWS的架構概念去開發的

Endpoint

 An endpoint is a URL that is the entry point for a web service. For example, https://dynamodb.us-west-2.amazonaws.com is an entry point for the Amazon DynamoDB service.


http://docs.aws.amazon.com/general/latest/gr/rande.html

git bisect(對分)


git bisect就是利用binary search的方式來搜尋造成bug的commit是在哪裡。
-- find by binary search the change that introduced a bug.


git bisect <sub-command> <options>

2013年4月23日 星期二

Object-Storage vs Block-Storage Comparison in OpenStack Folsom version


Object Storage Capabilities

  • OpenStack provides redundant, scalable object storage using clusters of standardized servers capable of storing petabytes of data
  • Object Storage is not a traditional file system, but rather a distributed storage system for static data such as virtual machine images, photo storage, email storage, backups and archives. Having no central "brain" or master point of control provides greater scalability, redundancy and durability.
  • Objects and files are written to multiple disk drives spread throughout servers in the data center, with the OpenStack software responsible for ensuring data replication and integrity across the cluster.
  • Storage clusters scale horizontally simply by adding new servers. Should a server or hard drive fail, OpenStack replicates its content from other active nodes to new locations in the cluster. Because OpenStack uses software logic to ensure data replication and distribution across different devices, inexpensive commodity hard drives and servers can be used in lieu of more expensive equipment.



Block Storage Capabilities

  • OpenStack provides persistent block level storage devices for use with OpenStack compute instances.
  • The block storage system manages the creation / attaching / detaching of the block devices to servers. Block storage volumes are fully integrated into OpenStack Compute and the Dashboard allowing for cloud users to manage their own storage needs.
  • In addition to using simple Linux server storage, it has unified storage support for numerous storage platforms including Ceph, NetApp, Nexenta, SolidFire, and Zadara.
  • Block storage is appropriate for performance sensitive scenarios such as database storage, expandable file systems, or providing a server with access to raw block level storage.
  • Snapshot management provides powerful functionality for backing up data stored on block storage volumes. Snapshots can be restored or used to create a new block storage volume.


而Rackspace所提供的Cloud Block Storage服務,就是利用OpenStack去打造的。





Reference:

[1] Amazon Elastic Block Storage, http://aws.amazon.com/ebs/
[2] Rackspace  Block Store, http://www.rackspace.com/cloud/block-storage/


paste-file in OpenStack


在OpenStack當中,paste file主要是用來定義每個function處理的pipeline。

Nicira NVP with OpenStack Quantum


Network Virtualization 的發展近況

     在虛擬化所建構的高動態的服務中, 網路卻以靜態的模式支撐服務的進行, 使服務受限於現今OSI L2/L3的模組中,大幅拖延了雲服務/數據中心的發展速度及目標。 從上而知, 靜態的網路型態, 成為雲服務發展最大的阻礙. 許多數據中心服務商或是設備提供商已經開始關注這一課題, 也陸續在發展相關方案以期能解決相關課題。但是對於雲服務/數據中心這並不是一個絕對的好消息, 因為他們將被迫選擇廠家私有的專屬的硬體或是更新設備才能支持該相關方案,產生方案成本、 擴展性及相容性等不可預期的營運問題。


Nicira NVP (Network Virtualization Platform)

       Network Virtualization Platform (NVP)本身是一種分散式的網路管理控制系統,能夠管理位於網路邊緣的數萬個虛擬交換器(Open vSwitch),將傳統的實體網路進行decouple建立脫離底層實體網路的數十萬個邏輯網路(Logical Network)。NVP可以將現有的物理網路轉換成資料傳送的Fabric,而無須重新建構。它是一款能夠兼容和現有IaaS的軟體,大大降低維護成本與複雜性。


VMware收購Nicira

VMware於2012年7月以12.6億美元收購新創公司Nicira,並以其NVP作為未來「軟體定義資料中心」的虛擬網路,其中NVP是OpenFlow網路協定概念的領導產品,也是OpenStack Quantum網路平台的基礎。




Reference:

[1] VMware打破門戶之見 推出Grizzly增加與Ubuntu OpenStack雲端服務的相容性,
http://news.networkmagazine.com.tw/classification/software-application/2013/04/19/49274/

[2]  網路虛擬化公司Nicira:描繪未來的網路世界
http://wired.tw/2012/05/03/nicira-2/index.html

[3] http://www.netfos.com.tw/PDF/Nsolution/Nicura-NVP-Nsolution2011.pdf

[4] VMware官方網站對Nicira NVP的introduction,
http://www.vmware.com/products/datacenter-virtualization/nicira.html

使用dovecot來收發E-mail


http://changyy.pixnet.net/blog/post/31386673-%5Blinux%5D-%E5%BF%AB%E9%80%9F%E6%9E%B6%E8%A8%AD-imap-imaps-pop3-pop3s---%E4%BD%BF%E7%94%A8-dovecot-

2013年4月22日 星期一

undisclosed(未公開的) recipients


未公開的收件人


為啥要用這個,待補

Cloud Load Balancer


Load-balancer

Netflix Shares Cloud Load Balancing And Failover Tool: Eureka!

RESTful: REpresentational State Transfer


什麼是REST?
REST 是一種分散式超媒體系統(如WWW)的軟體架構風格,可以想像它是Web應用程式的優良設計規則:
把一組Web Page想像成為具有狀態機(state machine),當client點選hyperlink時則會進行"狀態改變"成為下一個狀態。 
REST 有什麼優點?
  • 支援快取 caching 將改善反應時間跟server的負載能力。
  • 因為不必維持連結狀態,大大改善 server 的 scalability 能力。這表示不同server可以處理同一串 requests。
  • 一個瀏覽器就可以存取任一應用程式跟資源,client 端不需使用別的軟體。
  • 在HTTP之上不依存其他機制跟軟體。
  • 跟其他連結方式相比(如RPC),可以提供相等的功能。
  • 不需要其他的 discovery 機制,因為使用超連結了。
  • 提供比RPC更好的長期相容性,因為 :
  • 如同HTML這種文件具有後前及向後的相容能力
  • 支援新的內容格式不需要丟掉舊的


REST  vs RESTful









Reference

2013年4月21日 星期日

JPG、GIF以及PNG的比較


http://mingwang0824.pixnet.net/blog/post/27833076-%5Bweb%5Djpg-%E3%80%81gif%E3%80%81png-%E4%B8%89%E7%A8%AE%E6%A0%BC%E5%BC%8F%E7%9A%84%E6%AF%94%E8%BC%83

利用sed來將shell的換行字元改成網頁的換行字元


sed 's/$/\<br\/\>/g'

L3 Routing + NAT

UDP Port 17



http://www.auditmypc.com/udp-port-17.asp

Netflow


What's Netflow

NetFlow is a network protocol developed by Cisco Systems for collecting IP traffic information. NetFlow has become an industry standard for traffic monitoring[citation needed] and is supported on various platforms


Reference:
1. http://en.wikipedia.org/wiki/NetFlow
2. http://www.netadmin.com.tw/article_content.aspx?sn=1111030003
3. http://www.tn.edu.tw/sammy/netflow/setup.htm

IRC: Internet Relay Chat基礎概念與介紹


IRC通常用的port為6667~6669

User Mode



Channel Mode




Reference:
http://en.wikipedia.org/wiki/Internet_Relay_Chat

2013年4月20日 星期六

Bass低音吉他基本知識

https://zh.wikipedia.org/wiki/%E9%9B%BB%E8%B2%9D%E6%96%AF

四弦:

空弦由粗至細為E、A、D、G

電子貝斯已經不僅只有基本的4弦,也有5弦和6弦之別,而5弦的電子貝斯,從第一弦到第五弦(由細到粗)的空弦音分別為:G、D、A、E、B,也有的空弦音分別為:C、G、D、A、E,依各大廠商自訂;至於6弦的電子貝斯,從第一弦到第六弦的空弦音分別為:C、G、D、A、E、B

Python為"強型別"的語言

在Python中,字串是不可變動的(Immutable),所以+實際會產生新的字串,在強弱型別的光譜中,Python比較偏強型別,型態較不能自行轉換,例如Python中,不能混合字串與數字進行+運算,你得自己將數字轉為字串,才可以進行字串串接:
>>> 'score: ' + 90Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Can't convert 'int' object to str implicitly
>>> 'score: ' + str(90)
'score: 90'
>>>


Python List/Set/Dict/Tuple之比較


https://docs.google.com/spreadsheet/ccc?key=0Aoj2FuNX9qdGdGNCTXE2NG9yMHRSQVBsNXdoZDJyTXc&usp=sharing

python在函式參數傳遞上的重要基礎概念: *args 與 **kwargs 到底有啥不一樣呢?



好!!為啥會談論到這個東西?!因為python跟一般所學的C/C++很不一樣


一般來說  在呼叫函式的時候  是以  argument = parameter  的方式傳入
                                                              (引數)        (參數)

而python在引數(arguments)這一塊有所謂的匹配模式(match pattern)概念在。

Q: 至於Python有那些的匹配模式呢!?
 ANS:
一般來說可以分成兩種狀況:
”位置”的方式來匹配
            ----由左到右的方式進行匹配
”關鍵字”的方式來匹配
            ---- 以引數的名稱來進行匹配
  

而引數在設定有兩種額外的方法:

1. 引數預設值
            在python的函式中可以指定引數的預設值。(以name=value的型式)
            ex:   func( x=3, y=2, z=1)

2. 變動引數(varargs)

-- python中,在函式宣告時可以利用萬用字元(*)來收集任意數量的額外引數(此概念是源自於C語言的varargs) ;

-- 而函式在呼叫時,可以用萬用字元(*)將引數集合體給分解成個別的引數,表示欲傳遞任意多個引數。




[Function定義語法格式]


def  function_name(param1=arg1, param2=arg2, ....):
      """ 
           Here is function body !!!
      """



[引數的匹配方式]

呼叫    

語法                       位置           說明                                              
func(value)                  呼叫者    普通引數: 以"位置"來匹配。
func(name=value)        呼叫者    關鍵字引數:以"名稱"來匹配。
func(*name)                呼叫者    把name之中所有物件傳遞進來,當作個別的位置引數
func(**name)              呼叫者    把name之中的所有key/value pairs傳遞進來,當成個別關鍵字引數

*/**在呼叫時,是解開任意數量之引數


定義

def  func(name)              函式     普通引數: 以"位置"或"名稱"的方式去匹配
def  func(name=value)    函式     預設引數值(如果在沒呼叫時傳遞)
def  func(*name)            函式     先匹配再收集剩餘的"位置引數"在tuple
def  func(**name)          函式     先匹配再收集剩餘的"關鍵字引數"在dict(辭典)

*/**在定義時,是建立任意數量之引數




Reference:
http://www.loliman3000.com/tech/2fe2eea4a80e94fd3811629.php




利用sed來移除空白行(列)



使用 sed 來移除整列都是空白(沒有資料)的行, 語法如下:

sed '/^$/d'
註: sed '/\n/d' 沒有用. XD

Reference

顯示出 sys.modules()


http://www.diveintopython.net/file_handling/more_on_modules.html

Associative Arrays in Bash Scripts

http://stackoverflow.com/questions/688849/associative-arrays-in-shell-scripts

http://www.artificialworlds.net/blog/2012/10/17/bash-associative-array-examples/

http://www.gnu.org/software/bash/manual/html_node/Arrays.html

http://stackoverflow.com/questions/6660010/bash-how-to-assign-an-associative-array-to-another-variable-name-e-g-rename-t

for...in迴圈的比較


Bash Scripts

Python

SFP: Small Form Pluggable

GBIC


SFP

SFPSMALL FORM PLUGGABLE的縮寫,可以簡單的理解為GBIC的升級版本。SFP模組體積比GBIC模組減少一半,可以在相同的面板上配置多出一倍以上的埠數量。SFP模組的其他功能基本和GBIC一致。有些交換機廠商稱SFP模組為小型化GBICMINI-GBIC)。 SFP模組體積比GBIC模組減少一半,可以在相同的面板上配置多出一倍以上的埠數量。SFP模組的其他功能基本和GBIC相同。

詳全文 什麼是GBIC?什麼是SFP?光纖分為哪幾種?-Optech Technology 歐普科技-新浪部落 http://blog.sina.com.tw/optech/article.php?pbgid=70553&entryid=586142



光纖:   單模光纖  vs 多模光纖

單模光纖


多模光纖




Reference:
http://blog.sina.com.tw/optech/article.php?pbgid=70553&entryid=586142

cinder-manage




Usage:

cinder-manage sm flavor_create <label> <description>
cinder-manage sm flavor_delete<label>
cinder-manage sm backend_add <flavor label> <SR type> [config connection parameters]
Note: SR type and config connection parameters are in keeping with the Xen Command Line Interface.http://support.citrix.com/article/CTX124887
cinder-manage sm backend_delete <backend-id>

Examples:

cinder-manage sm flavor_create gold “Not all that glitters”
cinder-manage sm flavor_delete gold
cinder-manage sm backend_add gold nfs name_label=toybox-renuka server=myserver serverpath=/local/scratch/myname
cinder-manage sm backend_remove 1

XCP / Citrix Xenserver Volume Drivers on OpenStack

PS: Cinder是由Folsom版本開始從原本的nova-volume這部分去進行抽離的子專案



XenAPINFS

XenAPINFS is a Block Storage (Cinder) driver which is using an NFS share through XenAPI's Storage Manager to store virtual disk images and exposing those virtual disks as volumes.

XenAPINFS不能直接存取NFS,只能透過XenAPI Storage Manager來存取NFS。
( This driver is not accessing the NFS share directly, it is only accessing the share through XenAPI Storage Manager. )

This driver should be considered as a reference implementation for using XenAPI's storage manager in OpenStack ( present in XenServer and XCP).


配置方式

  1. Local:
    推薦的做法,這樣的話可以使用qemu-img,但必須在當作Storage Controller上的XCP/Xenserver host上開啟一台PV guest VM安裝 cinder + XenAPINFS driver
  2. Remote:
    不需要使用PV guest VM,直接拿XCP/Xenserver當作Storage Controller。但這樣的話只能用VDI格式的VHD。


Source Code:

1. Grizzly cinder, https://github.com/openstack/cinder/blob/stable/grizzly/cinder/volume/drivers/xenapi/sm.py



XenAPI Storage Manager Volume Driver ( only in Folsom version, 在grizzly版中似乎已經移除 )

The Xen Storage Manager Volume driver (xensm) is a XenAPI hypervisor specific volume driver

功用:

  1. provide basic storage functionality, including volume creation and destruction, on a number of different storage back-ends.
  2. It also enables the capability of using more sophisticated storage back-ends for operations like cloning/snapshots, etc.


The list below shows some of the storage plugins already supported in Citrix XenServer and Xen Cloud Platform (XCP):

  1. NFS VHD: 
    Storage repository (SR) plugin which stores disks as Virtual Hard Disk (VHD) files on a remote Network File System (NFS).

  2. Local VHD on LVM: 
    SR plugin which represents disks as VHD disks on Logical Volumes (LVM) within a locally-attached Volume Group.

  3. HBA LUN-per-VDI driver: 
    SR plugin which represents Logical Units (LUs) as Virtual Disk Images (VDIs) sourced by host bus adapters (HBAs). E.g. hardware-based iSCSI or FC support.

  4. NetApp: 
    SR driver for mapping of LUNs to VDIs on a NETAPP server, providing use of fast snapshot and clone features on the filer.

  5. LVHD over FC: 
    SR plugin which represents disks as VHDs on Logical Volumes within a Volume Group created on an HBA LUN. E.g. hardware-based iSCSI or FC support.

  6. iSCSI: 
    Base ISCSI SR driver, provides a LUN-per-VDI. Does not support creation of VDIs but accesses existing LUNs on a target.

  7. LVHD over iSCSI: 
    SR plugin which represents disks as Logical Volumes within a Volume Group created on an iSCSI LUN.

  8. EqualLogic: 
    SR driver for mapping of LUNs to VDIs on a EQUALLOGIC array group, providing use of fast snapshot and clone features on the array.

2013年4月19日 星期五

Kafka和Storm


Kafka

Kafka 是一個用於截取與管理資料流(Data Stream)的即時框架(Real-Time Framework),也就是訊息發佈與訂閱的分散式管理系統。像 Twitter 和 Square 就是用 Kafka 來做日誌檔的管理,以便即時監控與處理事件的發生。

Storm

Storm 則是用於處理這些訊息資料流的框架,它與 Kafka 之間的關係,就像是 Hadoop 分散式系統與 MapReduce 之間的關係,也就是 Kafka 用來儲存訊息,Storm 則用來處理這些訊息,但是,Kafka 和 Storm 的速度即時多了。”

Sawzall: 一種宣告式語言,用來處理bigdata


http://en.wikipedia.org/wiki/Sawzall_(programming_language)

LVS: Linux Virtual Server

http://www.cnblogs.com/lgfeng/archive/2012/10/16/2726308.html

Linux Security Hardening



sysctl: used to modify kernel parameters at runtime

sysctl is an interface that allows you to make changes to a running Linux kernel.

With /etc/sysctl.conf you can configure various Linux networking and system settings such as:
  1. Limit network-transmitted configuration for IPv4
  2. Limit network-transmitted configuration for IPv6
  3. Turn on execshield protection
  4. Prevent against the common 'syn flood attack'
  5. Turn on source IP address verification
  6. Prevents a cracker from using a spoofing attack against the IP address of the server.
  7. Logs several types of suspicious packets, such as spoofed packets, source-routed packets, and redirects.




http://www.cyberciti.biz/faq/linux-kernel-etcsysctl-conf-security-hardening/