1. 程式人生 > >OpenTSDB v2.4.0 Intellij IDEA開發環境搭建

OpenTSDB v2.4.0 Intellij IDEA開發環境搭建

vendor 創建分支 whether log4 enume trap itl conda ram

源碼準備

1.下載源代碼

[email protected]:/codes/github$ git clone https://github.com/OpenTSDB/opentsdb.git
Cloning into ‘opentsdb‘...
remote: Enumerating objects: 306, done.
remote: Counting objects: 100% (306/306), done.
remote: Compressing objects: 100% (122/122), done.
remote: Total 33302 (delta 92), reused 273 (delta 86), pack-reused 32996
Receiving objects: 100% (33302/33302), 36.25 MiB | 65.00 KiB/s, done.
Resolving deltas: 100% (18824/18824), done.

2. 創建分支v2.4.0

查看遠程Tags列表:

[email protected]:/codes/github/opentsdb$ git tag
...
v2.3.2
v2.4.0
v2.4.0RC2

檢出分支:

[email protected]:/codes/github/opentsdb$ git checkout -b v2.4.0
Switched to a new branch ‘v2.4.0‘
[email protected]:/codes/github/opentsdb$ git branch
  master
* v2.4.0

編譯打包

構建pom.xml配置文件:

[email protected]:/codes/github/opentsdb$ sh build.sh pom.xml
+ test -f configure
+ ./bootstrap
autoreconf: Entering directory `.‘
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I build-aux
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf --force
autoreconf: configure.ac: not using Autoheader
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:19: installing ‘build-aux/install-sh‘
configure.ac:19: installing ‘build-aux/missing‘
Makefile.am:921: warning: whitespace following trailing backslash
third_party/validation-api/include.mk:24: warning: variable ‘VALIDATION_API_SOURCES‘ is defined but no program or
third_party/validation-api/include.mk:24: library has ‘VALIDATION_API‘ as canonical name (possible typo)
Makefile.am:983:   ‘third_party/include.mk‘ included from here
third_party/include.mk:38:   ‘third_party/validation-api/include.mk‘ included from here
autoreconf: Leaving directory `.‘
+ test -d build
+ mkdir build
+ cd build
+ test -f Makefile
+ ../configure pom.xml
configure: WARNING: you should use --build, --host, --target
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for md5sum... /usr/bin/md5sum
checking for java... /usr/lib/jdk1.8.0_172/bin/java
checking for javac... /usr/lib/jdk1.8.0_172/bin/javac
checking for jar... /usr/lib/jdk1.8.0_172/bin/jar
checking for true... /bin/true
checking for javadoc... /usr/lib/jdk1.8.0_172/bin/javadoc
checking for wget... /usr/bin/wget
checking for curl... /opt/anaconda2/bin/curl
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating opentsdb.spec
config.status: creating build-aux/fetchdep.sh
+ MAKE=make
+ uname -s
+ [ Linux = FreeBSD ]
+ exec make pom.xml
(cd .. ; ./build-aux/create-src-dir-overlay.sh)
{   echo ‘<!-- Generated by Makefile on ‘`date`‘ -->‘;   sed <../pom.xml.in     -e ‘s/@[email protected]/1.8.2/‘     -e ‘s/@[email protected]/0.0/‘     -e ‘s/@[email protected]/0.0/‘     -e ‘s/@[email protected]/18.0/‘     -e ‘s/@[email protected]/2.6.0/‘     -e ‘s/@[email protected]/1.0.0/‘     -e ‘s/@[email protected]/1.3/‘     -e ‘s/@[email protected]/2.9.5/‘     -e ‘s/@[email protected]/3.21.0-GA/‘     -e ‘s/@[email protected]/4.11/‘     -e ‘s/@[email protected]/1.7.7/‘     -e ‘s/@[email protected]/1.0.13/‘     -e ‘s/@[email protected]/1.0.13/‘     -e ‘s/@[email protected]/1.9.5/‘     -e ‘s/@[email protected]/3.10.6.Final/‘     -e ‘s/@[email protected]/1.3/‘     -e ‘s/@[email protected]/1.5.4/‘     -e ‘s/@[email protected]/1.7.7/‘     -e ‘s/@[email protected]/1.4.0/‘     -e ‘s/@[email protected]/3.4.6/‘     -e ‘s/@[email protected]/3.4.1/‘     -e ‘s/@[email protected]/2.1.1/‘     -e ‘s/@[email protected]/0.9.1/‘     -e ‘s/@[email protected]/OpenTSDB/‘     -e ‘s/@[email protected]/The OpenTSDB Authors/‘     -e ‘s/@[email protected]/2.4.0/‘     -e ‘s/@[email protected]/true/‘     -e ‘s/@[email protected]/false/‘     -e ‘s/@[email protected]/false/‘     ; } >pom.xml-t
mv pom.xml-t ../pom.xml

編譯打包:

mvn clean package -Phbase

導入Intellij IDEA

1. 由於本地只有jdk1.8, 因此修改pom.xml文件jdk版本
pom.xml

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.5.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
          <compilerArgument>-Xlint</compilerArgument>
          <excludes>
            <exclude>**/client/*.java</exclude>
          </excludes>
          <testExcludes>
            <exclude>**/TestGraphHandler.java</exclude>
          </testExcludes>
        </configuration>
      </plugin>
  1. 代碼冗余報錯:
    Error:(36, 10) java: duplicate class: tsd.client.EventsHandler

    因此將src-main/tsd目錄置為Excluded狀態。
    3. 運行主程序:

    src-main/net/opentsdb/tools/OpenTSDBMain
  2. 將fat-jar目錄置為ResourcesRoot加入Classpath下
  3. 在HBase中創建相關表格
    lynn:lynn
    lynn:lynn-meta
    lynn:lynn-tree
    lynn:lynn-uid
  4. 增加如下運行參數:
    tsd --zkquorum manager.bigdata.com:2181 --zkbasedir /hbase-unsecure --uidtable lynn:lynn-uid --table lynn:lynn --metatable lynn:lynn-meta --treetable lynn:lynn-tree

OpenTSDB v2.4.0 Intellij IDEA開發環境搭建