Wednesday, 3 December 2014

MultiNode Cassandra on Single Server (Data and Spark nodes)


Borrowed from this old post: One Man Clapping

A normal Cassandra installation requires root access as it writes to OS root perm'd directories.

I'm trying to fire up some Cassandra demos in a dev environment. Ideally this setup will give me a standalone dev environment to tinker about in.

As such we don't want to do a full install where it writes to the standard OS system locations. Instead we need to write to the nodes install directory to /install/cassandra-data

I need the ability to run the following nodes:
  • Data node type (storage)
  • Analytics node type (spark)
I'm going to create multiple directories to run each install without root permissions Node1, Node2 etc.

Do this:
  1. Configure a set of localIp aliases: 
    sudo ifconfig lo0 alias 127.0.0.2 up
    sudo ifconfig lo0 alias 127.0.0.3 up
    
    
  2. Edit /etc/hosts to create entries: 
    127.0.0.1       localhost alteredcarbon alteredcarbon.local
    127.0.0.2       localhost2 alteredcarbon2 alteredcarbon2.local
  3. Extract dse4.5.3.tar => node1
  4. CD into node1
  5. Change the JMX port of the cassandra env. vi resources/cassandra/conf/cassandra-env.sh
  6. JMX PORT: JMX_PORT="17199"
  7. Configure local output (we don't want to write logs to /etc on the dev machine)  (source)
$ mkdir cassandra-data; cd cassandra-data$ mkdir data saved_caches commit log

Then edit $ vi resources/cassandra/conf/cassandra.yaml


cluster_name: 'Dev Cluster' initial_token: 0 data_file_directories: - path_to_install/cassandra-data/data commitlog_directory: path_to_install/cassandra-data/commitlog saved_caches_directory: path_to_install/cassandra-data/saved_caches


You don't need to change the default data ports: 7000, 7001; they are running on the aliased IPs, 127.0.0.1, 127.0.0.2 etc

7. Configure the log output: 


$ vi ./resources/cassandra/conf/log4j-server.properties
log4j.appender.R.File= path_to_install/cassandra-data/system.log
log4j.appender.V.File= path_to_install/cassandra- data/solrvalidation.log 
8. Now fire up a realtime data node (link
$ ./dse cassandra -f
9. Or a data node: or something else (link)
CommandOptionDescriptionExample
dse-cEnable the Cassandra File System (CFS) but not the integrated DSE jobtrackers and tasktrackers. Use to start nodes for running an external Hadoop system.
dse-vSend the DSE version number to standard output.none
dse cassandraStart up a real-time Cassandra node in the background.link to example
dse cassandra-fStart up a real-time Cassandra node in the foreground. Can be used with -k, -t, or -s options.none
dse cassandra-kStart up an analytics node in Spark mode in the background.example
dse cassandra-k -tStart up an analytics node in Spark and DSE Hadoop mode.example
dse cassandra-sStart up a DSE Search/Solr node in the background.link to example
dse cassandra-s -Ddse.solr.data.dir=pathUse path to store Solr data.link to example
dse cassandra-tStart up an analytics node in the background.link to example
dse cassandra-t -jStart up an analytics node as the job tracker.link to example
dse cassandra-stop-p pidStop the DataStax Enterprise process number (pid). If -p and the pid are omitted, the command stops the local node.link to example
10. Fire up OpsCenter and we should see the node:
alteredcarbon:OPSCENTER neil$ opscenter-5.0.1/bin/opscenter
OpsCenter is at : http://localhost:8080
Note: The first time I tried this it didn't work, after a reboot it was successful. 
Want to do this without DSE  then try: CCM




No comments:

Post a Comment