Eclipse 运行Debug Cassandra
2019-10-02 本文已影响0人
Hey_Shaw
1、源码获取
git clone https://github.com/apache/cassandra.git
git checkout -b 3.11 origin/cassandra-3.11
2、可配置maven仓库和本地路径:build.xml和build.properties.default
- build.xml
<target name="generate-cql-html" depends="maven-ant-tasks-init" description="Generate HTML from textile source">
<artifact:dependencies pathId="wikitext.classpath"
settingsFile="maven库的settings配置文件路径">
...
</target>
- build.properties.default
# Maven2 Repository Locations (you can override these in "build.properties" to point to a local proxy, e.g. Nexus)
# 可将下面替换为自己的maven库
artifact.remoteRepository.central: http://repo1.maven.org/maven2
artifact.remoteRepository.apache: http://repo.maven.apache.org/maven2
- 以上配置可参考: Maven Ant Tasks插件官方文档
3、构建
- 本地下载安装 Apache Ant,配置环境变量
- 至Cassandra源码路径下,执行
ant build
。 - 构建成功后,再执行:
ant.bat generate-eclipse-files
,会生成eclipse工程文件(IDEA执行:ant generate-idea-files
) - 打开Eclipse,导入Cassandra源码:
File->Import->General->Existing Projects into Workspace - 配置主函数参数:
- Run/Debug configurations
Project:
Cassandra
Main Class:
org.apache.cassandra.service.CassandraDaemon
- Debug参数,主要是设置VM参数
-ea -javaagent:${project_loc:Cassandra}/lib/jamm-0.3.0.jar
-XX:+UseThreadPriorities
-XX:ThreadPriorityPolicy=4
-Xms150M
-Xmx1000M
-Xmn188M
-XX:+HeapDumpOnOutOfMemoryError
-Xss200k
-XX:+UseParNewGC
-XX:+UseConcMarkSweepGC
-XX:+CMSParallelRemarkEnabled
-XX:SurvivorRatio=8
-XX:MaxTenuringThreshold=1
-XX:CMSInitiatingOccupancyFraction=75
-XX:+UseCMSInitiatingOccupancyOnly
-Djava.net.preferIPv4Stack=true
-Dcom.sun.management.jmxremote.port=7199 -- 运行nodetool使用的默认端口
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
- 配置Eclipse控制台输出日志:
运行时配置主要在test/conf 下,logback.xml。具体可参考Cassandra部署下conf内的logback.xml配置。改为控制台输出即可。
至此,运行配置全部完成