In Windows explorer, go to “C:\Windows\System32\drivers\etc”
Copy the file called “hosts” to your desktop ( or any editable location)
Open the hosts file from the desktop and add the following to the end of the file:
with any host name you desire such as node1,node2, etc… it should* still work
Next, re-name the hosts file in “C:\Windows\System32\drivers\etc” to hosts.bak i.e
“C:\Windows\System32\drivers\etc\hosts.bak”. You may need admin permission to do this.
Now copy the modified hosts file from your desktop (or wherever you copied it to) to
“C:\Windows\System32\drivers\etc”. If you have a web server running you can access it by typing,
any of the nodes you entered i.e 127.0.0.2 for e.g.
Download the latest version of Cassandra from the Cassandra download page.
Now, there are several ways you could do this part but the method I use presents far fewer problems later on.
Create a folder at the root of your drive called cassandra, i.e ”C:\cassandra”, and in the cassandra folder, create
6 folders named 1 to 6(or however many nodes you want).
You should now have a folder structure looking like this:
i.e put the cassandra files/folders (bin,conf,interface,lib,javadoc, etc) in each folder (1…6)
Starting with the folder named “1″, open cassandra.yaml file for editing. i.e. Open
Give the cluster name a meaningful value :
false for these two but true for the others
# directories where Cassandra should store data on disk.
use a different location to store its data.
Finally make the following changes to the first file:
(make any other tweaks you like to the configuration) .
Edit each cassandra.yaml file as described above making sure you change the path and the host as well as the boot strap
option.
So in the end yor configuration will be similar to:
Once you have edited cassandra.bat go to each of your bin folders and double click cassandra.bat to start each node.
Copy the file called “hosts” to your desktop ( or any editable location)
Open the hosts file from the desktop and add the following to the end of the file:
#cassandra nodes 127.0.0.1 127.0.0.2 127.0.0.1 127.0.0.3 127.0.0.1 127.0.0.4 127.0.0.1 127.0.0.5 127.0.0.1 127.0.0.6Each line represents a node in your cluster to be.You can replace 127.0.0.1…6
with any host name you desire such as node1,node2, etc… it should* still work
Next, re-name the hosts file in “C:\Windows\System32\drivers\etc” to hosts.bak i.e
“C:\Windows\System32\drivers\etc\hosts.bak”. You may need admin permission to do this.
Now copy the modified hosts file from your desktop (or wherever you copied it to) to
“C:\Windows\System32\drivers\etc”. If you have a web server running you can access it by typing,
any of the nodes you entered i.e 127.0.0.2 for e.g.
Download the latest version of Cassandra from the Cassandra download page.
Now, there are several ways you could do this part but the method I use presents far fewer problems later on.
Create a folder at the root of your drive called cassandra, i.e ”C:\cassandra”, and in the cassandra folder, create
6 folders named 1 to 6(or however many nodes you want).
You should now have a folder structure looking like this:
C:\cassandra \1 \2 \3 \4 \5 \6Extract the files from the cassandra download once into each sub-directory.
i.e put the cassandra files/folders (bin,conf,interface,lib,javadoc, etc) in each folder (1…6)
Starting with the folder named “1″, open cassandra.yaml file for editing. i.e. Open
"C:\cassandra\1\conf\cassandra.yaml".
Give the cluster name a meaningful value :
cluster_name: 'Awesomeness'We want to make the first and second node seed nodes so ensure that auto_bootstrap is
false for these two but true for the others
auto_bootstrap: falseProvide the seed nodes for each cassandra.yaml file as 127.0.0.1 and 127.0.0.2
seed_provider: # Addresses of hosts that are deemed contact points. # Cassandra nodes use this list of hosts to find each other and learn # the topology of the ring. You must change this if you are running # multiple nodes! - class_name: org.apache.cassandra.locator.SimpleSeedProvider parameters: # seeds is actually a comma-delimited list of addresses. # Ex: "<ip1>,<ip2>,<ip3>" - seeds: "127.0.0.1,127.0.0.2"IMPORTANT: You need to ensure that the following values are changed for each node:
# directories where Cassandra should store data on disk.
data_file_directories: - /cassandra/1/var/lib/cassandra/data # commit log commitlog_directory: /cassandra/1/var/lib/cassandra/commitlog # saved caches saved_caches_directory: /cassandra/1/var/lib/cassandra/saved_cachesNotice the “/cassandra/1/var/lib/”, this path changes to “/cassandra/2/var/lib/”. Its important each tell each node to
use a different location to store its data.
Finally make the following changes to the first file:
listen_address: 127.0.0.1 rpc_address: 127.0.0.1Once that’s done, save the cassandra.yaml file. Copy the edited file into the conf folder of the other nodes
(make any other tweaks you like to the configuration) .
Edit each cassandra.yaml file as described above making sure you change the path and the host as well as the boot strap
option.
So in the end yor configuration will be similar to:
Node 1 = 127.0.0.1 Node 2 = 127.0.0.2 Node 3 = 127.0.0.3 Node 4 = 127.0.0.4 Node 5 = 127.0.0.5 Node 6 = 127.0.0.6IMPORTANT: Go into each node’s bin directory and edit cassandra.bat file, for each node change the line that says “-Dcom.sun.management.jmxremote.port=7199^” changing the 7199 to a unique number. This is the JMX port that allows you to connect to your cluster using nodetool or JConsole each node needs to have their own port so each bat file must be edited and have a unique port set.
Once you have edited cassandra.bat go to each of your bin folders and double click cassandra.bat to start each node.
This seems same http://zcourts.com/2011/07/09/setting-up-a-multi-node-cassandra-cluster-on-a-single-windows-machine/#sthash.82lE63nv.dpbs
ReplyDelete