从apache官网下载最新的cassandra,目前最新的版本是2.1.2
解压,放到一个固定目录下。
修改conf/cassandra.yaml
替换其中的var/lib/cassandra/ 为安装目录
修改conf/logback.xml
替换其中的${cassandra.logdir} 为安装目录
配置环境变量
添加环境变量CASSANDRA_HOME,值为安装目录,然后添加path环境变量为%CASSANDRA_HOME%\bin
启动
进入命令行工具,输入cassandra然后回车,显示如下说明启动成功。
INFO 02:49:53 Enqueuing flush of local: 49395 (0%) on-heap, 0 (0%) off-heap INFO 02:49:53 Writing Memtable-local@26225981(8561 serialized bytes, 259 ops, 0%/0% of on/off-heap limit) INFO 02:49:53 Completed flushing D:\Program Files\apache-cassandra-2.1.2\data\data\system\local-7ad54392bcdd35a684174e047860b377\syste sition(segmentId=1419389392265, position=98921) INFO 02:49:53 Node localhost/127.0.0.1 state jump to normal INFO 02:49:53 Compacted 4 sstables to [D:\Program Files\apache-cassandra-2.1.2\data\data\system\local-7ad54392bcdd35a684174e047860b377 n 218ms = 0.024979MB/s. 4 total partitions merged to 1. Partition merge counts were {4:1, } INFO 02:49:53 Netty using Java NIO event loop INFO 02:49:53 Using Netty Version: [netty-buffer=netty-buffer-4.0.23.Final.208198c, netty-codec=netty-codec-4.0.23.Final.208198c, nett ocks=netty-codec-socks-4.0.23.Final.208198c, netty-common=netty-common-4.0.23.Final.208198c, netty-handler=netty-handler-4.0.23.Final.2 ty-transport-rxtx=netty-transport-rxtx-4.0.23.Final.208198c, netty-transport-sctp=netty-transport-sctp-4.0.23.Final.208198c, netty-tran INFO 02:49:53 Starting listening for CQL clients on localhost/127.0.0.1:9042... INFO 02:49:53 Binding thrift service to localhost/127.0.0.1:9160 INFO 02:49:53 Listening for thrift clients...
启动客户端工具
重新启动一个命令行,输入cassandra-cli,然后回车,显示如下:
Microsoft Windows [版本 6.1.7601] 版权所有 (c) 2009 Microsoft Corporation。保留所有权利。 C:\Users\Administrator>cassandra-cli Starting Cassandra Client Connected to: "Test Cluster" on 127.0.0.1/9160 Welcome to Cassandra CLI version 2.1.2 The CLI is deprecated and will be removed in Cassandra 3.0. Consider migrating to cqlsh. CQL is fully backwards compatible with Thrift data; see http://www.datastax.com/dev/blog/thrift-to-cql3 Type 'help;' or '?' for help. Type 'quit;' or 'exit;' to quit. [default@unknown]
启动过程中遇到的错误
1: Windows PowerShell 内部错误。加载托管的 Windows PowerShell 失败,返回错误 80070002。 WARNING! Powershell script execution unavailable. Please use 'powershell Set-ExecutionPolicy Unrestricted' on this user-account to run cassandra with fully featured functionality on this platform. Starting with legacy startup options Starting Cassandra Server Error occurred during initialization of VM Could not reserve enough space for 2097152KB object heap 解决办法: 安装补丁Windows Management Framework 4.0 (KB2819745)可解决. 地址:http://www.microsoft.com/en-us/download/details.aspx?id=40855 2: Could not reserve enough space for 2097152KB object heap 解决办法: 修改 cassandra.bat 中的JVM参数 set JAVA_OPTS=-ea^ -javaagent:"%CASSANDRA_HOME%\lib\jamm-0.2.8.jar"^ -Xms512m^ -Xmx512m^
之前也写过一个关于cassandra的安装篇的博客,可以翻出来看一下http://blog.csdn.net/maosijunzi/article/details/8695762