Linux Cassandra配置和管理平台使用

來源:互聯網
上載者:User

貼一個配置 使用cassandra的實際例子

1.配置好jdk1.6以上版本的環境
安裝後查看java版本,必須是java version "1.6.0_24" 以上,不然在啟動時會報類似out of memory的錯誤

2.建立日誌等目錄並解壓縮
mkdir -p /var/log/cassandra
mkdir -p /var/lib/cassandra
tar zxvf apache-cassandra-0.8.6-bin.tar.gz

3.啟動
cd bin
nohup ./cassandra -f &
查看127.0.0.1:9106啟動沒有

4.串連                               
./cassandra-cli
connect localhost/9160  ---也可串連其他主機

5.查看資訊
show cluster name;

6.建立keyspace
CREATE KEYSPACE demo
with placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy'
and strategy_options = [{replication_factor:1}];
use demo

7.建立列族
create column family users with comparator = UTF8Type AND key_validation_class=UTF8Type AND column_metadata = [{column_name: full_name, validation_class: UTF8Type} {column_name: email, validation_class: UTF8Type}];
查看列;族資訊
describe keyspace demo;

8.讀寫資料
寫入資料
SET users['bobbyjo']['full_name']='Robert Jones';
SET users['bobbyjo']['email']='bobjones@gmail.com';
set Manager['pig']['big']='234';
確認寫入
count users['bobbyjo'];
2 columns
讀取資料
get users['bobbyjo'];
=> (column=email, value=bobjones@gmail.com, timestamp=1318176737871000)
=> (column=full_name, value=Robert Jones, timestamp=1318176726678000)
Returned 2 results.
刪除資料 --bobbyjo的行索引值的email列
del users['bobbyjo'][email];
column removed.
del users['bobbyjo']--刪除行,沒指定列名字
管理機器軟體:
Cassandra-Cluster-Admin,通過web方式管理資料庫.部署簡單 使用方便.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.