Install Cassandra on windows

  • 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.

     

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值