If you want to debug or view Cassandra's code through eclipse, it's a good choice to import its project into eclipse. The procedure to import the version 2.0.8 into Elcipse is described below.
The official documents for the main reference in this article are: Http://wiki.apache.org/cassandra/RunningCassandraInEclipse
For quick access, reprint here: http://www.cnblogs.com/chang290/p/3837102.html
First, the preparatory work
1, to the official website download Cassandra Source package: apache-cassandra-2.0.8-src.tar.gz.
2. The extract will have a apache-cassandra-2.0.8-src directory that modifies the directory to the project name you want (note that the name of this directory must be the same as the project name, so the absolute directory name will be used when the Elipse file is generated), such as What I call Cassandra-208-trunk.
3. Go to the Cassandra-208-trunk directory and execute the following two commands:
ant buildant Generate-eclipse-files
4. Some files will need to be downloaded in the ant build, so this step will take some time.
Second, create Java project
1. Open Eclipse to create a Java project,project name called Cassandra-208-trunk (note that the name must be the same as the directory name)
2, click on the newly created cassandra-208-trunk, right mouse button, enter the Properties page
Select Java Build Path in the left column, select the Source tab on the right, and set the source folders with output folder:
Click OK after the modification is complete and save.
3. Operation Configuration
Click on the newly created cassandra-208-trunk, right mouse button, select Run as---run configurations
1) Configure main class, select Cassandra-208-trunk in the Project box, and select Org.apache.cassandra.service.CassandraDaemon in the main class box
2) Configure startup parameters
In the Program arguments box, enter:
-dcassandra.config=file:xxxxxx/cassandra-208-trunk/conf/cassandra.yaml----Where the xxxxx is the path to the project
-dcassandra-foreground
-EA-XMX2G----Configuration heap memory, depending on the actual configuration
-dlog4j.configuration=file:xxxxxx/cassandra-208-trunk/conf/log4j-server.properties----Where the xxxxx is the path to the project
Enter the following in VM arguments:
-djava.rmi.server.hostname=127.0.0.1----used for running Nodetool
-dcom.sun.management.jmxremote.port=7199----The default port to use for running Nodetool
-dcom.sun.management.jmxremote.ssl=false
-dcom.sun.management.jmxremote.authenticate=false
Third, run the test
Once you have completed the above configuration, you can start the project with the following output:
-/ -/ One the: -:xxINFO db. memtable:completed Flushing build/test/cassandra/data/system/local/system-local-jb-9-data.db ( thebytes forCommitlog Position Replayposition (segmentid=1405043940005, position=174117) -/ -/ One the: -:xxINFO service. Storageservice:node/127.0.0.1State jump to normal -/ -/ One the: -:xxINFO compaction.CompactionTask:Compacted4Sstables to [build/test/cassandra/data/system/local/system-local-jb-Ten,].1,079Bytes to531(~ the% of original)inch16ms =0.031650mb/s.4Total partitions merged to1. Partition Merge counts were {4:1, }
Then go to the project directory Cassandra-208-trunk/bin run. The/nodetool status output is as follows:
status=up/down |/state=normal/leaving/joining/moving- Address Load owns ( Effective) Host ID Token rackun 127.0. 0.1 98.02 KB 100.0% 53e17e1a-5785-43dc-b724-dd3188f1b822 43e797990015319dfe8cd742dbbe788d Rack1