Cassandra 1.0.8 Cluster configuration

Source: Internet
Author: User
Tags cassandra system log log4j
Objective:

Read a lot of Cassandra cluster configuration data, a lot of information will always make people foggy feeling ah, had to write an article about the basic implementation of Cassandra cluster configuration.

Download Cassandra

Here: http://cassandra.apache.org/download/Select a suitable version, more than 0.8 version is more reliable, the current maximum version of 1.0.8, recommended.

Installation Jdk,window installation is not explained, if installed under Linux reference:

http://blog.csdn.net/jemlee2002/article/details/7007320

Set Java_hone, here do not do, no matter what platform you are, Internet search how to set environment variables.

Environment:

3 Win2003 Servers

ip1:192.168.18.129

ip2:192.168.18.130

ip3:192.168.18.131

Extract apache-cassandra-1.0.8 to the specified directory, the directory location itself.

Open the Cassandra.yaml file under Apache-cassandra-1.0.8/conf, and modify the following several places

Cluster_Name: ' Test cluster '

Change into

Cluster_Name: ' Your cluster name, in 中文版 '


Data_file_directories:

-/var/lib/cassandra/data

Change into

Data_file_directories:

-You are ready to put the path of the data, can be multiple, directly before the line to add a "-" can

Commitlog_directory:/var/lib/cassandra/commitlog

Change into

Commitlog_directory: You are ready to put the path of the submit log

Saved_caches_directory:/var/lib/cassandra/saved_caches

Change into

Saved_caches_directory: You are ready to slow down the path of saving

About Seeds:seeds is the meaning of the seed, that is, in the whole cluster can be the other node of the meaning of the seeds, other nodes once the seeds IP point to a machine, then the other nodes at the start, the a machine as a seed, from a node copy data, until synchronization, So choose seeds carefully.

This demo setting

-Seeds: "192.168.18.129"

Listen_address:localhost

Change into

Listen_address: The IP of the specific machine, such as the IP of the Cassandra Machine is: 192.168.18.131, then localhost is replaced by 192.168.18.131.

Rpc_address:localhost

Change into

rpc_address:0.0.0.0

Save Cassandra.yaml

Open the Log4j-server.properties file under apache-cassandra-1.0.8/conf and modify the following

Log4j.appender.r.file=/var/log/cassandra/system.log

Change into

Log4j.appender.r.file= you are ready to put the System log path/system.log

Save Log4j-server.properties

Three servers, the same changes, there will be some place to keep in mind with the machine, especially seeds,listen_address

The Cassandra.bat of 3 machines were started:

Appears in console: Listening for thrift clients ...

The server starts and waits for the client to connect.

Perform nodetool execution on one of these: Cassandra-cli.bat


Executive: Connect 192.168.18.129/9160;


Execution: CREATE keyspace demokeyspace

with placement_strategy = ' org.apache.cassandra.locator.SimpleStrategy '

and strategy_options = [{replication_factor:2}];

 

note the Red section, if you want your data to replicate on different servers, then these parameters are best studied.

Execution: Use Demokeyspace;


Create Column family,

Execution: Create column family Users with Comparator=utf8type

and Default_validation_class=utf8type Andkey_validation_class=utf8type;

Note These options, and you can go to the Cassandra document to see what the specific representative is.

Deposit Data:

Execute: Set Users[jsmith][first] = ' John ';


Get Data:

Execute: Get Users[jsmith];

Is there any content that you previously deposited in the data, plus a time stamp.

For the time stamp, please check the data carefully.

Next, stop the 192.168.18.129 Cassandra Service.

On the Cassandra console on the 192.168.18.130/131 two machines, you can see:

This time execution: Nodetool



You should see a down.

At this point, connect 130 or 131 through the Cassandra-cli.bat, and perform the process of getting the data to see if the results have the data you want, and if the last


Prove that your cluster system is not afraid of a single point of failure,

And stop the 130 Cassandra service.

At this time through the Cassandra-cli.bat connection 131, the process of obtaining data to see if the results are the data you want, if the last

The cluster is strong, down to 2 servers, and can continue to work.

Finished, the text of a lot of details did not introduce, you carefully read the understanding, do not know to send mail to me.

Leekexi@gmail.com

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.