launce amazon micro-instances€¦  · web view**note: this document does not use datastax ami...

14
Contents Set up Cassandra Cluster using Datastax Community Edition on Amazon EC2.................................................................. 2 Launce Amazon micro-instances.......................................2 Install JDK 7.......................................................7 Install Cassandra...................................................8 Configure cassandra.yaml file.......................................8 Start Cassandra.....................................................9 Stop Cassandra......................................................9 Clear Data..........................................................9 Check Cluster.......................................................9 Installing OpsCenter on Amazon AMI..................................10 Download OpsCenter and other relevant files........................10 Configuring opscenterd.conf file...................................10 Explore ops-center in browser (use firefox, chrome or safari)......11 References.......................................................... 13 Contact............................................................. 13

Upload: others

Post on 29-Sep-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Launce Amazon micro-instances€¦  · Web view**Note: This document does not use Datastax AMI which uses Amazon large instances that does not fall under free tier. This document

ContentsSet up Cassandra Cluster using Datastax Community Edition on Amazon EC2............................................................................................................................................................2

Launce Amazon micro-instances.................................................................................................2

Install JDK 7.........................................................................................................................................7

Install Cassandra...............................................................................................................................8

Configure cassandra.yaml file......................................................................................................8

Start Cassandra.................................................................................................................................9

Stop Cassandra..................................................................................................................................9

Clear Data............................................................................................................................................9

Check Cluster.....................................................................................................................................9

Installing OpsCenter on Amazon AMI.................................................................................10

Download OpsCenter and other relevant files......................................................................10

Configuring opscenterd.conf file................................................................................................10

Explore ops-center in browser (use firefox, chrome or safari)........................................11

References..........................................................................................................................................13

Contact.................................................................................................................................................13

**Note: This document does not use Datastax AMI which uses Amazon large instances that does not fall under free tier. This document is for those developers who wish to set up Datastax Cassandra using free Amazon EC2 instances.

Page 2: Launce Amazon micro-instances€¦  · Web view**Note: This document does not use Datastax AMI which uses Amazon large instances that does not fall under free tier. This document

Set up Cassandra Cluster using Datastax Community Edition on Amazon EC2

Launce Amazon micro-instances

1. This example describes installing a 2 node cluster in a single data center.

2. Open Amazon console. Edit the security groups in Network & Security section.

a. Click Create Security Group. Fill out the name and description and then click Yes, Create.

b. Click Inbound and add rules (using the Create a new rule drop-down list) for the following ports:

3. Port Rule Type Description

Page 3: Launce Amazon micro-instances€¦  · Web view**Note: This document does not use Datastax AMI which uses Amazon large instances that does not fall under free tier. This document

4. After you are done adding the above port rules, click Apply Rule Changes. Your completed port rules should look similar to this:

WarningThis security configuration shown in the above example opens up all externally accessible ports to incoming traffic from any IP address (0.0.0.0/0). The risk of data loss is high. If you desire a more secure configuration, see the Amazon EC2 help on Security Groups.

Page 4: Launce Amazon micro-instances€¦  · Web view**Note: This document does not use Datastax AMI which uses Amazon large instances that does not fall under free tier. This document

5. Create two t1.micro-instances of AMI (Amazon Machine Image) in AWS having 64 bit Linux operating system.

Page 5: Launce Amazon micro-instances€¦  · Web view**Note: This document does not use Datastax AMI which uses Amazon large instances that does not fall under free tier. This document
Page 6: Launce Amazon micro-instances€¦  · Web view**Note: This document does not use Datastax AMI which uses Amazon large instances that does not fall under free tier. This document
Page 7: Launce Amazon micro-instances€¦  · Web view**Note: This document does not use Datastax AMI which uses Amazon large instances that does not fall under free tier. This document

Install JDK 7

1. Install jdk7 64 bits for Linux OS on both nodes. Set JAVA_HOME in .bash_profile file at location /home/user/ in both the nodes

2. Check whether the java is properly installed.a. Java –version //should give you the version you have installed.

Page 8: Launce Amazon micro-instances€¦  · Web view**Note: This document does not use Datastax AMI which uses Amazon large instances that does not fall under free tier. This document

Install Cassandra

1. Next install the DataStax Community tarball in both the nodes:a. $ curl -OL http://downloads.datastax.com/community/dsc.tar.gz

2. Unpack the distribution: a. $ tar -xvzf dsc.tar.gz

3. By default, Cassandra installs files into the /var/lib/cassandra and /var/log/cassandra directories. If you do not have root access to the default directories, ensure you have write access: a. Sudo mkdir /var/lib/cassandrab. Sudo mkdir /var/log/cassandrac. Sudo chown -R $USER: $GROUP /var/lib/cassandrad. Sudo chown -R $USER: $GROUP /var/log/Cassandra

Configure cassandra.yaml file1. Modify the following property settings in the cassandra.yaml file located at dsc-

cassandra-2.x.x/conf for each node.Prerequisites

a. Each node must be correctly configured before starting the cluster. You must determine or perform the following before starting the cluster:

b. Choose a name for the cluster.c. Get the IP address of each node.d. Determine which nodes will be seed nodes. (Cassandra nodes use the seed node list

for finding each other and learning the topology of the ring.)e. Determine the snitch. Cassandra uses this information to route inter-node requests

as efficiently as possible.f. Determine the Partitioner. It determines how data is distributed across the nodes in

the cluster. g. Calculate the token assignments using the Token Generating Tool.

Tokens assign a range of data to a particular node within a data center. Each node in the cluster must be assigned a token before it is started for the first time.

Token Generating Tool

DataStax provides a Python program for generating tokens using the maximum possible range (0 to 2 127 -1). Do the following:

a. Using a vi editor, create a new file named tokengentool for your token generator program.

b. Go to https://raw.github.com/riptano/ComboAMI/2.2/tokentoolv2.py.c. Copy and paste the program into the tokengentool file.d. Save and close the file.e. Make it executable:

chmod +x tokengentoolf. Run the program

tokengentool 2g. Enter the corresponding value for each node in the initial_token property of the

node's cassandra.yaml file

Page 9: Launce Amazon micro-instances€¦  · Web view**Note: This document does not use Datastax AMI which uses Amazon large instances that does not fall under free tier. This document

For node0

a. cluster_name: 'MyDemoCluster'b. initial_token: 0c. seed_provider:

-class_name: org.apache.cassandra.locator.SimpleSeedProviderd. seeds: "<private IP addressess of each seed node separated by comma>"e. listen_address: <localhost private IP address>f. rpc_address: 0.0.0.0g. endpoint_snitch: RackInferringSnitch/Ec2Snitchh. Partioner: org.apache.cassandra.dht.RandomPartitioneri. auto_bootstrap: false (Add this setting only when initializing a fresh cluster with no

data.)For node1

The configuration for this node is same as node0 except for the listen_address and initial_token.a. listen_address: <localhost private IP address>b. initial_token: 85070591730234615865843651857942052864.

Start CassandraAfter you have installed and configured Cassandra on all nodes, start Cassandra in all nodes.

a. $ cd <install_location>b. $ bin/cassandra

Stop CassandraIf the nodes have restarted because of automatic restart, you must stop Cassandra on all nodes and clear the data directories, as described below.

a. $ ps auwx | grep cassandrab. $ sudo kill <pid>

Clear Dataa. $ cd <install_location>b. $ sudo rm -rf /var/lib/cassandra/*

Check Cluster

To check that the ring is up and running, run the nodetool status command. You will see both the nodes are up and running../nodetool status

Page 10: Launce Amazon micro-instances€¦  · Web view**Note: This document does not use Datastax AMI which uses Amazon large instances that does not fall under free tier. This document

Installing OpsCenter on Amazon AMI

Download OpsCenter and other relevant files

1. Download the tarball distribution of OpsCenter. You can either download the binary from Planet Cassandra or use the curl command: $ curl -OL http://downloads.datastax.com/community/opscenter.tar.gz

2. Unpack the distribution. $ tar -xzvf opscenter.tar.gz$ rm *.tar.gz

Files for OpsCenter and a single OpsCenter agent are now in place.3. Install openssl098 for 64 bit

sudo yum install openssl098e.x86_644. Install python openssl for 64 bit

sudo yum install pyOpenSSL.x86_64

Configuring opscenterd.conf file

Note: The OpsCenter console is the most convenient way to configure basic OpsCenter settings.

opscenterd.conf: configures the properties for the OpsCenter daemon.

<cluster_specific>.conf: configures properties for each cluster monitored by OpsCenter. This file is created when you add a cluster to the Opscenter.

These properties are configured in the opscenterd.conf file. The location of the opscenterd.conf file depends on the type of installation:

Packaged installs: /etc/opscenter/opscenterd.conf

Binary installs: <install_location>/conf/opscenterd.conf

Note: After changing properties in this file, you must restart OpsCenter for the changes to take effect.[agents] ssh_port

Page 11: Launce Amazon micro-instances€¦  · Web view**Note: This document does not use Datastax AMI which uses Amazon large instances that does not fall under free tier. This document

The Secure Shell (SSH) port that listens for agent-OpsCenter communications. Add an [agents] section, if one doesn't already exist, to the opscenterd.conf. In this section, add the ssh_port option and a value for the port number:

[agents]

ssh_port = 2222

[webserver] port

The HTTP port used for client connections to the OpsCenter web server. Default is 8888.

Optional HTTPS support. To enable, remove the comment markers (#) in front of properties prefixed with ssl in the opscenterd.conf file.

[webserver] interface

The interface that the web server uses to listen for client connections. The interface must be an externally accessible IP address or host name.

[logging] level

The logging level for OpsCenter. Available levels are (from most to least verbose): TRACE, DEBUG, INFO, WARN, or ERROR.

The OpsCenter log file is located in /var/log/opscenter/opscenterd.log.

Explore ops-center in browser (use firefox, chrome or safari)

1. Open site <public dns name of amazon instance>:8888

2. Click “Use Existing Cluster”

Page 12: Launce Amazon micro-instances€¦  · Web view**Note: This document does not use Datastax AMI which uses Amazon large instances that does not fall under free tier. This document

3. You can also see ring view

Page 13: Launce Amazon micro-instances€¦  · Web view**Note: This document does not use Datastax AMI which uses Amazon large instances that does not fall under free tier. This document

References

Online documentation:

http://www.datastax.com/documentation

Contact

[email protected]