Installation and use of Cassandra Database under Mac OS

Source: Internet
Author: User
Tags cassandra

About the installation of Cassandra database, in fact, the Apache official website has a detailed introduction: http://wiki.apache.org/cassandra/GettingStarted. Of course, for the convenience of students who do not want to see English, the following is probably introduced:

Pre-work: Make sure your Mac has a JDK installed (the latest Mac system should have JDK, so the problem should be small, java-version can verify if the system has a JDK installed)

1, first to the Apache official website download Cassandra The latest version, of course, the latest stable version of Apache Cassandra2.1.10 (released on 2015-10-05)

: http://cassandra.apache.org/download/

2, after downloading the decompression, enter into the bin directory, enter the command:./cassandra-f The Cassandra database is turned on.

For the-f command, this is not required, as described in the documentation about the-F option: If you start Cassandra without the "-f" option, it will run in the background. You can stop the process by killing it, using ' pkill-f Cassandradaemon ', for example.

3. After opening Cassandra, we also need an interactive command-line interface to help us create keyspace in Cassandra using the CQL statement.

Also in the Bin directory, enter the command:./cqlsh, into the interactive command line, where the syntax is actually not much different from the general SQL.

The main difference is conceptually, in Cassandra, there are four main concepts, namely: keyspace, column family, supper column, column.

The specific meaning of the difference is not detailed, for still not too familiar with Cassandra classmate can think keyspace corresponds to our database, and column family corresponds to table, of course supper Column and column actually correspond to the fields of two concepts.

The advantage of CQL is that it uses SQL-like syntax to make it less aware of column family or something.

4. Create a keyspace:

Cqlsh> Create Keyspace Devjavasource with replication={' class ': ' Simplestrategy ', ' Replication_factor ': 1};

Where Replication_factor is set to copy several, Devjavasource is the keyspace I want to create

5. Use the Keyspace:

cqlsh> use Devjavasource;

6. Create a table

Cqlsh> CREATE TABLE User (

ID int PRIMARY KEY,

Address text,

Name text);

In this case, a table is created, and the rest is the same as SQL, not detailed.

7, if there is no command, directly enter help can be viewed

Installation and use of Cassandra Database under Mac OS

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.