1. Install package
# sudo apt-get install libappindicator1
2. Log out, and then log back in (or issue dropbox stop && dropbox start at the command line)
REF
2014年4月11日 星期五
Linux Kernel Performance Tuning and Hardening
[Security]Deactivates automatic answers to ICMP broadcasts and protects against smurf attacks.
net.ipv4.icmp_echo_ignore_broadcasts=1[Security]Enable source validation by reversed path, as specified in RFC1812
/*
0 - No source validation.
1 - Strict mode as defined in RFC3704 Strict Reverse Path.
Each incoming packet is tested against the FIB and if the interface
is not the best reverse path the packet check will fail.
By default failed packets are discarded.
2 - Loose mode as defined in RFC3704 Loose Reverse Path.
Each incoming packet's source address is also tested against the FIB
and if the source address is not reachable via any interface the packet check will fail.
*/
net.ipv4.conf.all.rp_filter = 1
[Performance]The number of possible inotify(7) watches
fs.inotify.max_user_watches = 65536[Tuning]Avoid deleting secondary IPs on deleting the primary IP.
/* If you remove the primary IP address, all secondary addresses are purged by default as well. */ net.ipv4.conf.default.promote_secondaries = 1 net.ipv4.conf.all.promote_secondaries = 1"[Security]Not allow source route
net.ipv4.conf.default.accept_source_route = 0[Tuning]Disable listen for router advertisements in order to choose an IPV6 address and router
net.ipv6.conf.all.autoconf = 0 net.ipv6.conf.all.accept_ra = 0[Security]Do not allow redirect
net.ipv4.conf.all.accept_redirects = 0 net.ipv4.conf.default.accept_redirects = 0 net.ipv4.conf.all.secure_redirects = 0 net.ipv4.conf.default.secure_redirects = 0[Tuning]Avoid tcp timeout
net.ipv4.tcp_timestamps = 0[Performance]Maximum amount for the receive socket memory
net.core.rmem_max = 33554432 net.core.wmem_max = 33554432 net.core.rmem_default = 262144 net.core.wmem_default = 262144 net.ipv4.tcp_rmem = 32768 262144 33554432 net.ipv4.tcp_wmem = 32768 262144 33554432[Performance]Max open file
fs.file-max = 200000[Performance]The number of IPC message queue resources allowed
kernel.msgmni = 1024[Performance]How many semaphore arrays, semaphores can be allocate and how many semaphores can be in a single semaphore array
kernel.sem = 400 307200 128 1024[Performance]Keepalive time
net.ipv4.tcp_keepalive_time = 900 net.ipv4.tcp_keepalive_probes = 5 net.ipv4.tcp_keepalive_intvl = 10[Performance] Page cache limit.
/*Some app use large amounts of memory for accelerated access to business data Parts of this memory are seldom accessed. When a user request then needs to access paged out memory, the response time is poor. It is even worse, when an SAP solution running on Java incurs a Java garbage collection. The system starts heavy page-in (disc I/O) activity and has a poor response time for an extended period of time.*/ vm.pagecache_limit_mb = 41000Max number of open file
* hard nofile 32768 * soft nofile 32768
2014年4月9日 星期三
Setup git server
以前在使用git的時候都是同事幫忙架設,這次剛好有機會順便紀錄一下
a. # mkdir /opt/git
b. # mkdir /opt/git/project1
# cd /opt/git/project1
# git --bare init
Git Server
1. 安裝必要套件
# apt-get install git-core2. 建立repository
假設所有的project都欲放置/opt/git 並且建立名為project1的gita. # mkdir /opt/git
b. # mkdir /opt/git/project1
# cd /opt/git/project1
# git --bare init
Git Client
在使用者端,假設project的位置是~/projectA
# mkdir ~/projectA
# cd ~/projectA
# git init
# echo "project init">>init
# git add .
# git commit -m "init project"
# git remote add origin user@[IP]:/opt/git/project1
# git push origin master
2014年4月8日 星期二
iSCSI Target and Initiator
iSCSI Target是Server端,提供iSCSI 空間。
iSCSI Initiator是Client端,連接既有的iSCSI空間來使用。
提供服務的空間可以是一個硬碟、一個partition、一個LVM的LV或是使用DD產生一個空間。
# apt-get install iscsitarget iscsitarget-dkms
iSCSI Initiator是Client端,連接既有的iSCSI空間來使用。
iSCSI Target
在Ubuntu上安裝1. 選擇要提供空間的裝置
提供服務的空間可以是一個硬碟、一個partition、一個LVM的LV或是使用DD產生一個空間。
使用以下的方法可以在/media下產生一個20G名稱為volume0的空間。
# dd if=/dev/zero of=/media/volume0 count=0 obs=1 seek=20G
2. 安裝必要套件
使用APT來安裝必要套件# apt-get install iscsitarget iscsitarget-dkms
3. 設定iSCSI
a. 設定開機自動啟動
Edit /etc/default/iscsitarget
change
ISCSITARGET_ENABLE=false
to
ISCSITARGET_ENABLE=true
b. 設定iSCSI Target
Edit /etc/iet/ietd.conf
加入
Target iqn.2010-12.nl.ytec.arbiter:arbiter.blabla.lun1
Lun 0 Path=/media/volume0,Type=fileio,ScsiId=lun0,ScsiSN=lun0
其中,需要修改的參數是:
I. Target 後面接的名字,可自訂。
II. Lun一定要從0開始。
III. PATH後面接的參數是空間的位置,如果是剛剛使用dd 產生出來的則為/media/volume0否則更改為實際的空間例如/dev/sdb1 etc.
4. 重新啟動iSCSI Target
# /etc/init.d/iscsitarget restart
iSCSI Initiator
以OpenSuse為例
1. 安裝必要套件
# yast -i open-iscsi
2. 搜尋可用iSCSI Lun
使用iscsiadm來搜尋可用的裝置
# iscsiadm -m discovery --type=st --portal=[iscsi target的IP]
sample output:
192.168.1.101:3260,1 iqn.2010-12.nl.ytec.arbiter:arbiter.blabla.lun1
3. 連接裝置
確定找的到裝置之後就可以連接iSCSI裝置
# iscsiadm -m node -T iqn.2010-12.nl.ytec.arbiter:arbiter.blabla.lun1 --login
使用lsscsi來檢查是否有連接成功
# lsscsi
Sample output:
[0:2:0:0] disk Intel MegaSR 1.0 /dev/sda
[1:2:0:0] disk Intel RMS25CB080 3.22 /dev/sdb
[18:0:0:0] disk IET VIRTUAL-DISK 0 /dev/sdc
4. 掛載裝置
假設我們欲將裝置format成XFS並掛載到/opt/iscsi
# mkfs.xfs /dev/sdc
# mkdir /opt/iscsi
# mount -t xfs /dev/sdc /opt/iscsi
2014年4月4日 星期五
大資料資料庫儲存-Memcache和Redis介紹(VI)
Memcahce和Redis都是大多數被拿來當Cache system用途的NoSQL。他們的共通點是都是以Key-Value的形式將資料存在記憶體中。因此R/W的IO非常的快。
而兩個比較大的差別是,Redis可以將資料儲存在Local Drive中,而Memcache只能存在memory。另外一點則是,Memcache的value沒有型別而Redis則支援多種型別ex. map, set, list etc.
而兩個比較大的差別是,Redis可以將資料儲存在Local Drive中,而Memcache只能存在memory。另外一點則是,Memcache的value沒有型別而Redis則支援多種型別ex. map, set, list etc.
Memcahce
Memcache Use Scenario
REDIS
REDIS Data Type
大資料資料庫儲存--MongoDB介紹(V)
前一篇介紹了HBase,接著將繼續介紹MongoDB
MongoDB
MongoDB是由10gen這一家公司開發的,與Cassandra和Hbase不同的是,MongoDB是一個document base的一個NoSQL。他支援Auto-sharding的功能另外一個比較特別的是,它內建了以javascript來利用map-reduce的概念搜尋資料。
Data Structure
MongoDB既然說是一個Document base的資料庫,那麼舉個最簡單應用的例子來說明他的優點。假設我們有一個database是紀錄post文章和每個文章的comment。以RDBMS最簡單的方式就是建立兩個table分別存放文章和comment。因此要撈出某一筆文章和其留言就必須要兩個query。
那麼MongoDB呢?既然他是Document base,那麼我們可以在一個document記錄了文章和留言,因此,撈出一篇文章和留言就只需要一個request!
Write Path
MongoDB有三個角色,分別是存放Data的mongod、Cmongod存放shard key和mongos負責做load balance和將使用者的request導到對的shard server。
When to use MongoDB?
MongoDB可以非常lightweight(有人想要取代sqlite),當你沒有複雜的transaction ex. 不是banking的系統就可以看看MongoDB。
訂閱:
文章 (Atom)