Install Cassandra on windows
2016-05-25 16:28
232 查看
1. Prerequisites: install latest
JRE and an unzip utility that supports tar files.
Make sure that you've lasted 64bit JRE installed JRE in your machine. JRE version as following:
2. Download Cassandra from: http://www.apache.org/dyn/closer.lua/cassandra/3.5/apache-cassandra-3.5-bin.tar.gz (or latest version)
The alternate download site is http://cassandra.apache.org/download/
3. Use the unzip tool to extract tar.gz to local disk, such as c:\Cassandra,
Once it is extracted as apache-cassandra-3.5-bin.tar, extract it again.
Once the extraction is completed, you will see the following folders.
4. Change the 2 environment variables in either the
Cassandra.bat file or in windows (add system environment):
SET JAVA_HOME=C:\Program Files\Java\jre1.8.0_74\
SET CASSANDRA_HOME=C:\Cassandra\apache-cassandra-3.5
Or
5. Change optionally the output directories by editing files in conf directory:
(Note: need create data, commitlog folder in root folder, otherwise Cassandra can't start. )
a. Cassandra.yaml:
data_file_directories:
- c:/cassandra/apache-cassandra-2.0.9/data
commitlog_directory: c:/cassandra/apache-cassandra-2.0.9/commitlog
6. Start Cassandra Service.
Go to the bin directory and execute the "cassandra.bat" file using a command prompt. Always run the command window with "Run as administrator",
\bin>cassandra
You'll get the following screen if everything worked fine.
(If you don't see any error or fatal log messages or Java stack traces, then chances are you've succeeded.) Before running "cassandra.bat", make sure you're "JAVA_HOME" and "CASSANDRA_HOME" variable is created.
You can check as below:
Close the current cmd window to stop Cassandra service;
7. Using the nodetool to check whether Cassandra is started:
bin>nodetool -h localhost status
8. Start Cassandra Client: bin>cqlsh, if can't start, need install python first
9. Download python for windows: https://www.python.org/downloads/windows/ .
10. Install Python and set path in system environment.
11. Execute the step 7), if still can't start, set the path of python in
cqlsh.bat
12. Run cqlsh:
13. Operate Cassandra using CQL:
Refer to CQL help document: http://cassandra.apache.org/doc/cql3/
14. Using Cassandra in VS: Install package in VS: Install-Package CassandraCSharpDriver (note need open a solution)
usingglobal::Cassandra;
…
string keyspaceName =
"analytics";
Cluster cluster =
Cluster.Builder().AddContactPoint("127.0.0.1").Build();
ISession session = cluster.Connect(keyspaceName);
var result = session.Execute("select count(*) from users").First();
Console.WriteLine(string.Format("{0}
records in table", result[0]));
Q & A:If Cassandra cannot be started because JVM cannot reserve enough space, install the latest 64-bit JRE on your machine.
JRE and an unzip utility that supports tar files.
Make sure that you've lasted 64bit JRE installed JRE in your machine. JRE version as following:
2. Download Cassandra from: http://www.apache.org/dyn/closer.lua/cassandra/3.5/apache-cassandra-3.5-bin.tar.gz (or latest version)
The alternate download site is http://cassandra.apache.org/download/
3. Use the unzip tool to extract tar.gz to local disk, such as c:\Cassandra,
Once it is extracted as apache-cassandra-3.5-bin.tar, extract it again.
Once the extraction is completed, you will see the following folders.
4. Change the 2 environment variables in either the
Cassandra.bat file or in windows (add system environment):
SET JAVA_HOME=C:\Program Files\Java\jre1.8.0_74\
SET CASSANDRA_HOME=C:\Cassandra\apache-cassandra-3.5
Or
5. Change optionally the output directories by editing files in conf directory:
(Note: need create data, commitlog folder in root folder, otherwise Cassandra can't start. )
a. Cassandra.yaml:
data_file_directories:
- c:/cassandra/apache-cassandra-2.0.9/data
commitlog_directory: c:/cassandra/apache-cassandra-2.0.9/commitlog
6. Start Cassandra Service.
Go to the bin directory and execute the "cassandra.bat" file using a command prompt. Always run the command window with "Run as administrator",
\bin>cassandra
You'll get the following screen if everything worked fine.
(If you don't see any error or fatal log messages or Java stack traces, then chances are you've succeeded.) Before running "cassandra.bat", make sure you're "JAVA_HOME" and "CASSANDRA_HOME" variable is created.
You can check as below:
Close the current cmd window to stop Cassandra service;
7. Using the nodetool to check whether Cassandra is started:
bin>nodetool -h localhost status
8. Start Cassandra Client: bin>cqlsh, if can't start, need install python first
9. Download python for windows: https://www.python.org/downloads/windows/ .
10. Install Python and set path in system environment.
11. Execute the step 7), if still can't start, set the path of python in
cqlsh.bat
12. Run cqlsh:
13. Operate Cassandra using CQL:
Refer to CQL help document: http://cassandra.apache.org/doc/cql3/
14. Using Cassandra in VS: Install package in VS: Install-Package CassandraCSharpDriver (note need open a solution)
usingglobal::Cassandra;
…
string keyspaceName =
"analytics";
Cluster cluster =
Cluster.Builder().AddContactPoint("127.0.0.1").Build();
ISession session = cluster.Connect(keyspaceName);
var result = session.Execute("select count(*) from users").First();
Console.WriteLine(string.Format("{0}
records in table", result[0]));
Q & A:If Cassandra cannot be started because JVM cannot reserve enough space, install the latest 64-bit JRE on your machine.
相关文章推荐
- android 处理程序全局异常和错误,UncaughtExceptionHandler
- STM32 SPI难点浅析
- 启动Print Spooler服务提示:"错误1068,依存服务或无法启动"
- 并发调用get请求
- Android Studio自动检查代码规范并提示如何优化的一些插件
- 韩顺平Spring框架学习,学习笔记(九)
- 获取View坐标
- List单链表实现
- 切空间距离
- Android中修改默认字体的大小----fontScale
- SQL Server和Oracle数据库索引介绍
- android listview判断上滑还是下滑
- 第12周项目2-Time类中的运算符重载
- mysql远程链接失败
- 怎么将pdf转换成excel格式
- Hadoop开发环境搭建
- UILabel大小问题
- Hadoop开发环境搭建
- 打造浪漫的Android表白程序
- Hadoop开发环境搭建