瞭解系統
#查看CPU core數量:
more /proc/cpuinfo | grep 'processor' | wc -l
#查看CPU位數
getconf LONG_BIT
#查看操作系統位數
uname -a
#查看內存大小
free -m
資料篇:
#cassandra文檔
http://www.datastax.com/docs/1.2/index
#官方運維文檔
http://wiki.apache.org/cassandra/Operations
井上天花篇:
OpsCenter(cassandra運維工具)
#下載與安裝
http://www.datastax.com/docs/opscenter/install/install_tar
#介紹
http://www.datastax.com/what-we-offer/products-services/datastax-opscenter
救命稻草篇篇:
#去社區找答案
①https://groups.google.com/forum/#!forum/hector-users
② 官方mail list
最佳實踐篇
-
通過commitlog_directory配置commit log路徑,請線上應用請不要與數據放到一塊磁盤
-
通過data_file_directories配置多個磁盤存放數據
-
Java Heap Size在6GB到8GB是不錯的配置,絕對不要超過16GB
-
batch mutations:1000個mutations可以啓動10個併發線程,每個100個mutations來實現,太大mutations會導致回滾成本很高
-
不使用OPP、BOP分區器
-
Always specify your initial token.
-
have at more than one seed node per data center.
書中過時部分內容
副本存放策略SimpleStrategy、NetworkTopologyStrategy
cassandra學習路線圖
客戶端使用、CQL、監控、調優、Datastatx的管理工具(http://planetcassandra.org/)
windows下運行:
-
解壓tar包
-
apache-cassandra-1.2.2\bin\cassandra.bat:啓動服務,不出問題9160端口就啓動了。
-
apache-cassandra-1.2.2\bin\cassandra-cli.bat:客戶端程序
# 啓動客戶端同時連接到遠程(本地)服務器,cassandra-cli.bat connect localhost/9160
客戶端命令:
-
? #幫助
-
exit; #退出
-
connect localhost/9160 #連接到本地(遠程)服務器
-
創建keyspace
create keyspace MyKeyspace;
-
1
2
3
create keyspace my_keyspace
with placement_strategy =
'org.apache.cassandra.locator.SimpleStrategy'
and strategy_options = {replication_factor:2};
drop keyspace my_keyspace ;
-
show keyspaces;
-
use MyKeyspace;
-
create column family Users
with key_validation_class = 'UTF8Type'
and comparator = 'UTF8Type'
and default_validation_class = 'UTF8Type';
-
set Users['yue.zhang']['email']='[email protected]';
-
set Users['yue.zhang']['gender']='F';
-
get Users['yue.zhang']['email'];
-
list Users;
-
count Users['yue.zhang'];
-
set Users['yue.zhang']['email']='[email protected]';
-
list Users;
-
--------------華麗分割線-------
-
create column family fc
with default_validation_class=CounterColumnType
and key_validation_class=UTF8Type
and comparator=UTF8Type;
-
incr fc ['20120203_img.autohome.com.cn']['trffice'] by 111;
-
incr fc ['20120203_img.autohome.com.cn']['trffice'] by 111;
-
list fc;