下載本文檔
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、Cassandra 1.1.2入門指南Cassandra is a highly scalable, eventually consistent, distributed, structured key-value store. Cassandra是高擴(kuò)展性的、最終一致性的、分布式的、結(jié)構(gòu)化的key/value存儲(chǔ)系統(tǒng)。For more information see //cassandra/Project description-Cassandra brings together the distr
2、ibuted systems technologies from Dynamo and the data model from Google's BigTable. Like Dynamo, Cassandra is eventually consistent. Like BigTable, Cassandra provides a ColumnFamily-baseddata model richer than typical key/value systems.Cassandra結(jié)合了源自Dynamo的分布式系統(tǒng)技術(shù)(存儲(chǔ)模型)與源自Google BigTable的數(shù)據(jù)組織結(jié)構(gòu)和訪
3、問(wèn)控制技術(shù)(數(shù)據(jù)模型)。Cassandra采用了Dynamo的最終一致性原則,采用了BigTable的基于ColumnFamily的數(shù)據(jù)模型(優(yōu)于典型的key/value系統(tǒng)數(shù)據(jù)模型)。keyspace類似于關(guān)系數(shù)據(jù)庫(kù)中的database。ColumnFamily類似于關(guān)系數(shù)據(jù)庫(kù)中的關(guān)系relation。key類似于關(guān)系數(shù)據(jù)庫(kù)中的主鍵primary key。column類似于關(guān)系數(shù)據(jù)庫(kù)中的列名column name。value類似于關(guān)系數(shù)據(jù)庫(kù)中一個(gè)行列交匯處的值value。Requirements- * Java >= 1.6 (OpenJDK and Sun have been tes
4、ted)Getting started-This short guide will walk you through getting a basic one node cluster upand running, and demonstrate some simple reads and writes.構(gòu)建并運(yùn)行只有一個(gè)節(jié)點(diǎn)的集群,然后演示簡(jiǎn)單的讀寫。在Linux下執(zhí)行命令如下: * tar -zxvf apache-cassandra-$VERSION.tar.gz * cd apache-cassandra-$VERSION * sudo mkdir -p /var/log/cassand
5、ra * sudo chown -R whoami /var/log/cassandra * sudo mkdir -p /var/lib/cassandra * sudo chown -R whoami /var/lib/cassandraNote: The sample configuration files in conf/ determine the file-system locations Cassandra uses for logging and data storage. You are free tochange these to suit your own environ
6、ment and adjust the path namesused here accordingly.$cassandra_HOME/conf/目錄下的cassandra.yaml配置文件設(shè)置了用于記錄日志和數(shù)據(jù)存儲(chǔ)的文件系統(tǒng)的位置??梢匀我庑薷牡狡渌窂健? directories where Cassandra should store data on disk.data_file_directories: - /var/lib/cassandra/data# commit logcommitlog_directory: /var/lib/cassandra/commitlog補(bǔ)充:Li
7、nux下執(zhí)行bin/cassandra啟動(dòng)Cassandra之前,需要設(shè)置如下環(huán)境變量,否則會(huì)拋出NoClassDefFoundError等異常:# CLASSPATH - A Java classpath containing everything necessary to run.Java類路徑,包含運(yùn)行所需的所有jar(通過(guò)bin/cassandra.in.sh設(shè)置)# JVM_OPTS - Additional arguments to the JVM for heap size, etcJVM的其他參數(shù),如堆大小等(通過(guò)conf/cassandra-env.sh設(shè)置,執(zhí)行bin/ca
8、ssandra會(huì)調(diào)用該腳本)。# CASSANDRA_CONF - Directory containing Cassandra configuration files.Cassandra配置文件目錄(通過(guò)bin/cassandra.in.sh設(shè)置)使環(huán)境變量立刻生效:source bin/cassandra.in.sh查看環(huán)境變量:echo $CLASSPATHNow that we're ready, let's start it up!Linux下打開(kāi)終端窗口,通過(guò)腳本啟動(dòng)Cassandra,執(zhí)行如下: * bin/cassandra -fUnix: Running th
9、e startup script with the -f argument will causeCassandra to remain in the foreground and log to standard out.注意:Linux下啟動(dòng)Cassandra使用-f參數(shù),可以使Cassandra前臺(tái)運(yùn)行,以方便查看輸出日志。其他還有如下兩個(gè)參數(shù):# -p <filename>: log the pid to a file (useful to kill it later)將Cassandra的進(jìn)程ID(pid)記錄到日志文件(后續(xù)可以通過(guò)kill <pid>停止Cas
10、sandra)# -v: print version string and exit打印出版本信息并停止Windows: bincassandra.bat runs in the foreground by default. Toinstall Cassandra as a Windows service, download Procrun from/daemon/procrun.html, set the PRUNSRVenvironment variable to the full path of prunsrv (e.g.,C:procru
11、nprunsrv.exe), and run "bincassandra.bat install".Similarly, "uninstall" will remove the service.Now let's try to read and write some data using the command line client.下面就可以使用命令行客戶端讀寫數(shù)據(jù)了。打開(kāi)新的終端窗口,執(zhí)行如下命令: * bin/cassandra-cli -host localhostThe command line client is interacti
12、ve so if everything worked you shouldbe sitting in front of a prompt.該命令行客戶端具有交互性,如果一切正常,將會(huì)出現(xiàn)如下提示。 Connected to: "Test Cluster" on localhost/9160 Welcome to cassandra CLI. Type 'help;' or '?' for help. Type 'quit;' or 'exit;' to quit. defaultunknown As the b
13、anner says, you can use 'help;' or '?' to see what the CLI has tooffer, and 'quit;' or 'exit;' when you've had enough fun. But lets trysomething slightly more interesting.在出現(xiàn)的提示符后面執(zhí)行如下操作: defaultunknown create keyspace Keyspace1; ece86bde-dc55-11df-8240-e700f669bc
14、fc defaultunknown use Keyspace1; Authenticated to keyspace: Keyspace1 defaultKeyspace1 create column family Users with comparator=UTF8Type and default_validation_class=UTF8Type and key_validation_class=UTF8Type; 737c7a71-dc56-11df-8240-e700f669bcfc defaultKS1 set Usersjsmithfirst = 'John' Va
15、lue inserted. defaultKS1 set Usersjsmithlast = 'Smith' Value inserted. defaultKS1 set Usersjsmithage = long(42); Value inserted. defaultKS1 get Usersjsmith; => (column=last, value=Smith, timestamp=1287604215498000) => (column=first, value=John, timestamp=1287604214111000) => (column
16、=age, value=42, timestamp=1287604216661000) Returned 3 results.If your session looks similar to what's above, congrats, your single nodecluster is operational! But what exactly was all of that? Let's break itdown into pieces and see. set Usersjsmithfirst = 'John' _ key _ value _ colu
17、mn _ column familyData stored in Cassandra is associated with a column family (Users),which in turn is associated with a keyspace (Keyspace1). In the exampleabove, we set the value 'John' in the 'first' column for key 'jsmith'.For more information on the Cassandra data model be sure to checkout /cassandra/Da
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024年綠色能源開(kāi)發(fā)與利用合同
- 2024酒店管理星級(jí)酒店物業(yè)管理合同
- 2024石材石材勞務(wù)派遣與職業(yè)培訓(xùn)合同2篇
- 2024年租賃物業(yè)延期協(xié)議3篇
- 2024年購(gòu)銷協(xié)議與購(gòu)貨合同的異同
- 2024年食材配送外包協(xié)議2篇
- 2024幼兒園教師藝術(shù)教育項(xiàng)目合作協(xié)議3篇
- 2024年度科技型企業(yè)核心團(tuán)隊(duì)股權(quán)限制性授予協(xié)議書(shū)3篇
- 2024年道路照明設(shè)備安裝及維護(hù)承包協(xié)議版B版
- 2024年網(wǎng)絡(luò)安全保障與合規(guī)檢查合同
- 2025湖北襄陽(yáng)市12345政府熱線話務(wù)員招聘5人高頻重點(diǎn)提升(共500題)附帶答案詳解
- 血細(xì)胞分析報(bào)告規(guī)范化指南2020
- ISO 56001-2024《創(chuàng)新管理體系-要求》專業(yè)解讀與應(yīng)用實(shí)踐指導(dǎo)材料之7:“5領(lǐng)導(dǎo)作用-5.1領(lǐng)導(dǎo)作用和承諾”(雷澤佳編制-2025B0)
- 2024年快速消費(fèi)品物流配送合同6篇
- 廣東省茂名市2024屆高三上學(xué)期第一次綜合測(cè)試(一模)歷史 含解析
- 神經(jīng)重癥氣管切開(kāi)患者氣道功能康復(fù)與管理學(xué)習(xí)與臨床應(yīng)用
- 第5章 一元一次方程大單元整體設(shè)計(jì) 北師大版(2024)數(shù)學(xué)七年級(jí)上冊(cè)教學(xué)課件
- 人教版高一地理必修一期末試卷
- 遼寧省錦州市(2024年-2025年小學(xué)六年級(jí)語(yǔ)文)部編版期末考試(上學(xué)期)試卷及答案
- 2024年下半年鄂州市城市發(fā)展投資控股集團(tuán)限公司社會(huì)招聘【27人】易考易錯(cuò)模擬試題(共500題)試卷后附參考答案
- GB/T 29498-2024木門窗通用技術(shù)要求
評(píng)論
0/150
提交評(píng)論