Deploy two-node cassandra Cluster

Source: Internet
Author: User
Tags cassandra
Deploy the two-node cassandra cluster to ensure that jdk is installed in the system, but not to configure the JAVA environment variable cassandra version: apache-cassandra-1.1.5jdk version: jdk1.6.0 _ 381, cassandra Log Path # vimlog4j-s

Deploy the two-node cassandra cluster to ensure that jdk is installed in the system, but not to configure the JAVA environment variable cassandra version: apache-cassandra-1.1.5jdk version: jdk1.6.0 _ 381, cassandra Log Path # vimlog4j-s

Deploy two-node cassandra Cluster


Make sure that jdk and virtual host are installed in the system. do not configure JAVA environment variables.


Cassandra version: apache-cassandra-1.1.5

Jdk version: jdk1.6.0 _ 38


1. cassandra Log Path

# Vim log4j-server.properties.

Log4j. appender. R. File =/trs6/cassandra/logs/system. log


2. cassandra memory usage (HEAP_NEWSIZE) = 1/4 (MAX_HEAP_SIZE)

# Vim cassandra-env.sh.

MAX_HEAP_SIZE = "4G"

HEAP_NEWSIZE = "800 M"


3. cassandra cluster configuration

# Vim cassandra. yaml

Cluster_name: 'pis '// cluster name

Initial_token: 0 // generated by initial_token.py


#! /Usr/bin/env python

Import sys

If (len (sys. argv)> 1 ):

Num = int (sys. argv [1])

Else:

Num = int (raw_input ("How many nodes are in your cluster? "))

For I in range (0, num ):

Print 'node % d: % d' % (I, (I * (2*127)/num ))


Data_file_directories:

-/Trs6/cassandra/data // data storage directory

Commitlog_directory:/trs6/cassandra/commitlog // commit log directory

Saved_caches_directory:/trs6/cassandra/saved_cache // cache storage directory

-Seeds: "192.168.183.71, 192.168.183.72" // IP address of the seed Node

Listen_address: 192.168.183.71 // listener address-> local IP Address

Rpc_address: 192.168.183.71

Endpoint_snitch: SimpleSnitch


4. Start the Cluster

# Bin/cassandra


5. view the cluster status

# Bin/nodetool-h 192.168.183.71 ring


Address DC Rack Status State Load valid tive-Ownership Token

85070591730234615865843651857942052864

192.168.183.71 datacenter1 rack1 Up Normal 23.61 KB 50.00% 0

192.168.183.72 datacenter1 rack1 Up Normal 23.61 KB 50.00% 85070591730234615865843651857942052864


6. Interactive command line (ended with a semicolon)

[Root @ cas1 ~] # Bin/cassandra-cli-h 192.168.183.71

Connected to: "pis" on 192.168.183.71/9160

Welcome to Cassandra CLI version 1.1.5


Type 'help; 'or '? 'For help.

Type 'Quit; 'or 'exit;' to quit.


(1) create a keyspace

[Default @ unknown] create keyspace DEMO;

5210d4ac-24e2-37e1-8d38-13a3cab24f33

Waiting for schema agreement...

... Schemas agree authentication ss the cluster

(2) Use keyspace for authentication

[Default @ unknown] use DEMO;

Authenticated to keyspace: DEMO

(3) create a column family

[Default @ DEMO] create column family Users

... With key_validation_class = 'utf8type'

... And comparator = 'utf8type'

... And default_validation_class = 'utf8type ';

8618bf72-4e3d-3b7c-84f6-031e69e7d161

Waiting for schema agreement...

... Schemas agree authentication ss the cluster

(4) store data to column family

[Default @ DEMO] set Users [1234] [name] = tianxin;

Value inserted.

Elapsed time: 87 msec (s ).

[Default @ DEMO] set Users [1234] [password] = upgirl;

Value inserted.

Elapsed time: 28 msec (s ).

(5) getting data

[Default @ DEMO] get Users [1234];

=> (Column = name, value = tianxin, timestamp = 1362521480914000)

=> (Column = password, value = upgirl, timestamp = 1362521498155000)

Returned 2 results.

Elapsed time: 131 msec (s ).



Problems:

1. When cassandra is started, Error: Exception thrown by the agent: java.net. MalformedURLException: Local host name unknown: java.net. UnknownHostException: cas1: cas1

Cause: the cluster node must configure host name resolution.



2. When The keyspace is created, The error "The schema has not settled in 10 seconds; further migrations are ill-advised until it does" is returned.

Versions are e71db6f5-eb85-3555-b851-1878497cf194: [198.216.27.72], eceb06f2-03a1-3bf8-a421-2528a053d7e6: [198.216.27.71]

Cause: the time between cluster nodes is not synchronized


This article is from the blog "Small universe with wings". Please keep this source

, Hong Kong VM

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.