idea debugging opentsdb source code

Keywords: HBase network xml Makefile

Reference resources: https://blog.51cto.com/1196740/2394289?source=dra

Catalog

Download source code:

Compile and pack

Modify file directory

Modify opnetsdb.conf

Running TSDMain

Download source code:

    git clone https://github.com/OpenTSDB/opentsdb.git

Compile and pack

To build the pom.xml configuration file:

[root@Machine1 opentsdb]#cd opentsdb

[root@Machine1 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
confgure.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
auoreconf: 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
conig.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/@ASYNCHBASE_VERSION@/1.8.2/' \
-e 's/@ASYNCBIGTABLE_VERSION@/0.0/' \
-e 's/@ASYNCCASSANDRA_VERSION@/0.0/' \
-e 's/@GUAVA_VERSION@/18.0/' \
-e 's/@GWT_VERSION@/2.6.0/' \
-e 's/@GWT_THEME_VERSION@/1.0.0/' \
-e 's/@HAMCREST_VERSION@/1.3/' \
-e 's/@JACKSON_VERSION@/2.9.5/' \
-e 's/@JAVASSIST_VERSION@/3.21.0-GA/' \
-e 's/@JUNIT_VERSION@/4.11/' \
-e 's/@LOG4J_OVER_SLF4J_VERSION@/1.7.7/' \
-e 's/@LOGBACK_CLASSIC_VERSION@/1.0.13/' \
-e 's/@LOGBACK_CORE_VERSION@/1.0.13/' \
-e 's/@MOCKITO_VERSION@/1.9.5/' \
-e 's/@NETTY_VERSION@/3.10.6.Final/' \
-e 's/@OBJENESIS_VERSION@/1.3/' \
-e 's/@POWERMOCK_MOCKITO_VERSION@/1.5.4/' \
-e 's/@SLF4J_API_VERSION@/1.7.7/' \
-e 's/@SUASYNC_VERSION@/1.4.0/' \
-e 's/@ZOOKEEPER_VERSION@/3.4.6/' \
-e 's/@APACHE_MATH_VERSION@/3.4.1/' \
-e 's/@JEXL_VERSION@/2.1.1/' \
-e 's/@JGRAPHT_VERSION@/0.9.1/' \
-e 's/@spec_title@/OpenTSDB/' \
-e 's/@spec_vendor@/The OpenTSDB Authors/' \
-e 's/@spec_version@/2.4.0/' \
-e 's/@maven_profile_hbase@/true/' \
-e 's/@maven_profile_bigtable@/false/' \
-e 's/@maven_profile_cassandrae@/false/' \
; \
} >pom.xml-t
mv pom.xml-t ../pom.xml

Pack:

mvn clean package -P hbase

Executing mvn clean package -P hbase during packaging will trigger profile configuration of hbase environment

<profile>
      <!-- Build for Apache HBase backend -->
      <id>hbase</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>

      <dependencies>
        <dependency>
          <groupId>org.hbase</groupId>
          <artifactId>asynchbase</artifactId>
          <version>1.8.2</version>
        </dependency>

        <dependency>
          <groupId>org.apache.zookeeper</groupId>
          <artifactId>zookeeper</artifactId>
          <version>3.4.6</version>
          <exclusions>
            <exclusion>
              <groupId>log4j</groupId>
              <artifactId>log4j</artifactId>
            </exclusion>
            <exclusion>
              <groupId>org.slf4j</groupId>
              <artifactId>slf4j-log4j12</artifactId>
            </exclusion>
            <exclusion>
              <groupId>jline</groupId>
              <artifactId>jline</artifactId>
            </exclusion>
            <exclusion>
              <groupId>junit</groupId>
              <artifactId>junit</artifactId>
            </exclusion>
          </exclusions>
        </dependency>
      </dependencies>
    </profile>

 

Modify file directory

After compiling successfully

Cut some files under the src directory to src main / net / opentsdb, and some to src main / TSD

The success was as follows:

Reason:

net/opnetsdb is a soft connection of.. / src

Client - >

Copy project to window

Modify opnetsdb.conf

# --------- NETWORK ----------
# The TCP port TSD should use for communications
# *** REQUIRED ***
tsd.network.port = 4242

# The IPv4 network address to bind to, defaults to all addresses
# tsd.network.bind = 0.0.0.0

# Disable Nagel's algorithm, default is True
#tsd.network.tcp_no_delay = true

# Determines whether or not to send keepalive packets to peers, default
# is True
#tsd.network.keep_alive = true

# Determines if the same socket should be used for new connections, default
# is True
#tsd.network.reuse_address = true

# Number of worker threads dedicated to Netty, defaults to # of CPUs * 2
#tsd.network.worker_threads = 8

# Whether or not to use NIO or tradditional blocking IO, defaults to True
#tsd.network.async_io = true

# ----------- HTTP -----------
# The location of static files for the HTTP GUI interface.
# *** REQUIRED ***
tsd.http.staticroot = /opentsdb/build/staticroot

# Where TSD should write it's cache files to
# *** REQUIRED ***
tsd.http.cachedir = /opentsdb/build/cachedir

# --------- CORE ----------
# Whether or not to automatically create UIDs for new metric types, default
# is False
tsd.core.auto_create_metrics = true

# Whether or not to enable the built-in UI Rpc Plugins, default
# is True
#tsd.core.enable_ui = true

# Whether or not to enable the built-in API Rpc Plugins, default
# is True
#tsd.core.enable_api = true

# --------- STORAGE ----------
# Whether or not to enable data compaction in HBase, default is True
#tsd.storage.enable_compaction = true

# How often, in milliseconds, to flush the data point queue to storage,
# default is 1,000
tsd.storage.flush_interval = 1000

# Max number of rows to be returned per Scanner round trip
# tsd.storage.hbase.scanner.maxNumRows = 128

# Name of the HBase table where data points are stored, default is "tsdb"
#tsd.storage.hbase.data_table = tsdb

# Name of the HBase table where UID information is stored, default is "tsdb-uid"
#tsd.storage.hbase.uid_table = tsdb-uid

# Path under which the znode for the -ROOT- region is located, default is "/hbase"
#tsd.storage.hbase.zk_basedir = /hbase

# A comma separated list of Zookeeper hosts to connect to, with or without
# port specifiers, default is "localhost"
#tsd.storage.hbase.zk_quorum = localhost
tsd.storage.hbase.zk_quorum = Machine1

# --------- COMPACTIONS ---------------------------------
# Frequency at which compaction thread wakes up to flush stuff in seconds, default 10
# tsd.storage.compaction.flush_interval = 10
tsd.storage.compaction.flush_interval = 1000

# Minimum rows attempted to compact at once, default 100
# tsd.storage.compaction.min_flush_threshold = 100

# Maximum number of rows, compacted concirrently, default 10000
# tsd.storage.compaction.max_concurrent_flushes = 10000

# Compaction flush speed multiplier, default 2
# tsd.storage.compaction.flush_speed = 2
tsd.http.request.enable_chunked = true
tsd.http.request.max_chunk = 163840
tsd.storage.fix_duplicates=true

Directory location:

 

Running TSDMain

Run the SRC main / net / opentsdb / tools / tsdmain program without adding any running parameters.

The successful operation is as follows:

 

 

Posted by makoy on Sat, 09 Nov 2019 07:11:06 -0800