Browse Source

kvdb

tags/1.2.0^2
刘元木 4 years ago
parent
commit
bed110deea
16 changed files with 267 additions and 3 deletions
  1. +1
    -1
      core
  2. +0
    -1
      database
  3. +99
    -0
      deploy/deploy-kvdb/pom.xml
  4. +54
    -0
      deploy/deploy-kvdb/src/main/resources/assembly.xml
  5. +11
    -0
      deploy/deploy-kvdb/src/main/resources/config/cluster.conf
  6. +15
    -0
      deploy/deploy-kvdb/src/main/resources/config/kvdb.conf
  7. +12
    -0
      deploy/deploy-kvdb/src/main/resources/script/kvdb-benchmark.sh
  8. +12
    -0
      deploy/deploy-kvdb/src/main/resources/script/kvdb-cli.sh
  9. +23
    -0
      deploy/deploy-kvdb/src/main/resources/script/start.sh
  10. +27
    -0
      deploy/deploy-kvdb/src/main/resources/script/stop.sh
  11. +3
    -0
      deploy/deploy-kvdb/src/main/resources/system/dblist
  12. +5
    -0
      deploy/deploy-peer/pom.xml
  13. +2
    -0
      deploy/deploy-peer/src/main/resources/assembly.xml
  14. +1
    -0
      deploy/deploy-peer/src/main/resources/config/init/local.conf
  15. +1
    -0
      deploy/pom.xml
  16. +1
    -1
      test

+ 1
- 1
core

@@ -1 +1 @@
Subproject commit 4da71b241528e0455bf91bb0d08bf29fcdf8e8b4
Subproject commit 29b18fe218ceb1db51f8926d38d7bd31644a511e

+ 0
- 1
database

@@ -1 +0,0 @@
Subproject commit 3f785b7e98df44cc7cfd02f83816e64e9acac631

+ 99
- 0
deploy/deploy-kvdb/pom.xml View File

@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>deploy-root</artifactId>
<groupId>com.jd.blockchain</groupId>
<version>1.2.0.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>deploy-kvdb</artifactId>
<version>1.0.0.RELEASE</version>

<dependencies>

<dependency>
<groupId>com.jd.blockchain</groupId>
<artifactId>kvdb-protocol</artifactId>
<version>${version}</version>
</dependency>

<dependency>
<groupId>com.jd.blockchain</groupId>
<artifactId>kvdb-engine</artifactId>
<version>${version}</version>
</dependency>

<dependency>
<groupId>com.jd.blockchain</groupId>
<artifactId>kvdb-server</artifactId>
<version>${version}</version>
</dependency>

<dependency>
<groupId>com.jd.blockchain</groupId>
<artifactId>kvdb-cli</artifactId>
<version>${version}</version>
</dependency>

<dependency>
<groupId>com.jd.blockchain</groupId>
<artifactId>kvdb-benchmark</artifactId>
<version>${version}</version>
</dependency>

<dependency>
<groupId>com.jd.blockchain</groupId>
<artifactId>kvdb-client</artifactId>
<version>${version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>kvdb</finalName>
<descriptors>
<descriptor>src/main/resources/assembly.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>

<!-- 生成SHA-256校验文件 -->
<plugin>
<groupId>net.nicoulaj.maven.plugins</groupId>
<artifactId>checksum-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<goals>
<goal>artifacts</goal>
</goals>
</execution>
</executions>
<configuration>
<algorithms>
<algorithm>SHA-256</algorithm> <!--采用SHA-256算法,还支持其他算法-->
</algorithms>
<file>${project.basedir}/target/deployment-kvdb-${project.version}.zip</file><!--给zip文件进行加密-->
<xmlSummary>true</xmlSummary><!--生成XML格式的md5文件-->
<xmlSummaryFile>${project.basedir}/target/SHA-256.xml</xmlSummaryFile>
</configuration>
</plugin>
</plugins>
</build>
</project>

+ 54
- 0
deploy/deploy-kvdb/src/main/resources/assembly.xml View File

@@ -0,0 +1,54 @@
<?xml version='1.0' encoding='UTF-8'?>
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0
http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>${project.version}</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>src/main/resources/script</directory>
<outputDirectory>bin</outputDirectory>
<lineEnding>unix</lineEnding>
</fileSet>
<fileSet>
<directory>src/main/resources/config</directory>
<outputDirectory>config</outputDirectory>
<lineEnding>unix</lineEnding>
</fileSet>
<fileSet>
<directory>src/main/resources/system</directory>
<outputDirectory>system</outputDirectory>
<lineEnding>unix</lineEnding>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<unpack>false</unpack>
<useProjectArtifact>true</useProjectArtifact>
<outputDirectory>libs</outputDirectory>
</dependencySet>

</dependencySets>
<moduleSets>
<moduleSet>
<useAllReactorProjects>true</useAllReactorProjects>
<includes>
<include>com.jd.blockchain:kvdb-engine</include>
<include>com.jd.blockchain:kvdb-benchmark</include>
<include>com.jd.blockchain:kvdb-client</include>
<include>com.jd.blockchain:kvdb-protocol</include>
<include>com.jd.blockchain:kvdb-cli</include>
<include>com.jd.blockchain:kvdb-server</include>
</includes>
<binaries>
<outputDirectory>libs</outputDirectory>
<unpack>false</unpack>
</binaries>
</moduleSet>
</moduleSets>

</assembly>

+ 11
- 0
deploy/deploy-kvdb/src/main/resources/config/cluster.conf View File

@@ -0,0 +1,11 @@
# 数据库集群的分片数,每一个分片都赋予唯一的编号,分片编号最小为 0,所有分片的编号必须连续递增
#cluster.test1.partitions=2
# 数据库集群 ‘<name>’ 的第 1 个分片的数据库实例地址(URL格式);
#cluster.test1.0=kvdb://localhost:7078/test1
# 数据库集群 ‘<name>’ 的第 2 个分片的数据库实例地址(URL格式);
#cluster.test1.1=kvdb://localhost:7079/test1

# 指定多个不同的集群
#cluster.test2.partitions=2
#cluster.test2.0=kvdb://localhost:7078/test2
#cluster.test2.1=kvdb://localhost:7079/test2

+ 15
- 0
deploy/deploy-kvdb/src/main/resources/config/kvdb.conf View File

@@ -0,0 +1,15 @@
# 数据库服务的本机监听地址;
server.host=0.0.0.0

# 数据库服务的本机监听端口;
server.port=7078

# 管理控制台的端口;
# 注:管理控制台总是绑定到环回地址 127.0.0.1,只允许本机访问;
manager.port=7060

# 数据库实例默认的根目录
dbs.rootdir=../dbs

# 数据库实例默认的本地分区数
dbs.partitions=4

+ 12
- 0
deploy/deploy-kvdb/src/main/resources/script/kvdb-benchmark.sh View File

@@ -0,0 +1,12 @@
#!/bin/bash

HOME=$(cd `dirname $0`;cd ../; pwd)
KVDB=$(ls $HOME/libs | grep kvdb-benchmark)
JVM_SET="-Xmx2g -Xms2g"
LOG_SET="-Dlogging.path="$HOME/logs" -Dlogging.level=error"
PROC_INFO=$HOME/libs/$KVDB
if [ ! -n "$KVDB" ]; then
echo "Can not find kvdb-benchmark !!!"
else
java -jar $LOG_SET $JVM_SET $PROC_INFO $*
fi

+ 12
- 0
deploy/deploy-kvdb/src/main/resources/script/kvdb-cli.sh View File

@@ -0,0 +1,12 @@
#!/bin/bash

HOME=$(cd `dirname $0`;cd ../; pwd)
KVDB=$(ls $HOME/libs | grep kvdb-cli)
JVM_SET="-Xmx2g -Xms2g"
LOG_SET="-Dlogging.path="$HOME/logs" -Dlogging.level.root=error"
PROC_INFO=$HOME/libs/$KVDB
if [ ! -n "$KVDB" ]; then
echo "Can not find kvdb-cli !!!"
else
java -jar $LOG_SET $JVM_SET $PROC_INFO $*
fi

+ 23
- 0
deploy/deploy-kvdb/src/main/resources/script/start.sh View File

@@ -0,0 +1,23 @@
#!/bin/bash

HOME=$(cd `dirname $0`;cd ../; pwd)
KVDB=$(ls $HOME/libs | grep kvdb-server)
JVM_SET="-Xmx2g -Xms2g"
PROC_INFO=$HOME/libs/$KVDB" -home "$HOME
LOG_SET="-Dlogging.path="$HOME/logs" -Dlogging.level=error"
#echo $PROC_INFO
#get PID
PID=`ps -ef | grep "$PROC_INFO" | grep -v grep | awk '{print $2}'`
#echo $PID
if [[ ! -z $PID ]]
then
echo "process already exists,please check... If necessary, you should kill the process first."
exit
fi
if [ ! -n "$KVDB" ]; then
echo "Can not find kvdb-server !!!"
else
nohup java -jar $LOG_SET $JVM_SET $PROC_INFO $* >/dev/null 2>&1 &

echo $! > $HOME/system/pid
fi

+ 27
- 0
deploy/deploy-kvdb/src/main/resources/script/stop.sh View File

@@ -0,0 +1,27 @@
#!/bin/bash

#启动Home路径
HOME=$(cd `dirname $0`;cd ../; pwd)

#进程启动后PID.log所在路径
PID_LOG=$HOME/system/pid

#从启动文件中读取PID
if [ -f "$PID_LOG" ]; then
# File exist
echo "Read PID From File:[$PID_LOG] ..."
PID=`sed -n '$p' $PID_LOG`
#启动文件不存在则直接通过PS进行过滤
else
PID=`ps -ef | grep $HOME/libs/kvdb-server | grep -v grep | awk '{print $2}'`
fi

#通过Kill命令将进程杀死
if [ -z "$PID" ]; then
echo "Unable to find kvdb PID. stop aborted."
else
echo "Start to kill PID = $PID ..."
kill -9 $PID
echo "kvdb has been stopped ..."
echo "" > $PID_LOG
fi

+ 3
- 0
deploy/deploy-kvdb/src/main/resources/system/dblist View File

@@ -0,0 +1,3 @@
db.test1.enable=true
db.test2.enable=true
db.test3.enable=true

+ 5
- 0
deploy/deploy-peer/pom.xml View File

@@ -50,6 +50,11 @@
<artifactId>storage-rocksdb</artifactId>
<version>${core.version}</version>
</dependency>
<dependency>
<groupId>com.jd.blockchain</groupId>
<artifactId>storage-kvdb</artifactId>
<version>${core.version}</version>
</dependency>

<!-- <dependency> <groupId>com.jd.blockchain</groupId> <artifactId>gateway</artifactId>
<version>${project.version}</version> </dependency> -->


+ 2
- 0
deploy/deploy-peer/src/main/resources/assembly.xml View File

@@ -35,6 +35,7 @@
<include>com.jd.blockchain:storage-service</include>
<include>com.jd.blockchain:storage-rocksdb</include>
<include>com.jd.blockchain:storage-redis</include>
<include>com.jd.blockchain:storage-kvdb</include>
<include>com.jd.blockchain:storage-composite</include>
<include>com.jd.blockchain:runtime-modular</include>
<include>com.jd.blockchain:runtime-modular-booter</include>
@@ -63,6 +64,7 @@
<exclude>com.jd.blockchain:storage-service</exclude>
<exclude>com.jd.blockchain:storage-rocksdb</exclude>
<exclude>com.jd.blockchain:storage-redis</exclude>
<exclude>com.jd.blockchain:storage-kvdb</exclude>
<exclude>com.jd.blockchain:storage-composite</exclude>
<exclude>com.jd.blockchain:runtime-modular</exclude>
<exclude>com.jd.blockchain:runtime-modular-booter</exclude>


+ 1
- 0
deploy/deploy-peer/src/main/resources/config/init/local.conf View File

@@ -17,6 +17,7 @@ ledger.binding.out=../
#账本数据库的连接字符
#rocksdb数据库连接格式:rocksdb://{path},例如:rocksdb:///export/App08/peer/rocks.db/rocksdb0.db
#redis数据库连接格式:redis://{ip}:{prot}/{db},例如:redis://127.0.0.1:6379/0
#kvdb数据库连接格式:kvdb://{ip}:{prot}/{db},例如:kvdb://127.0.0.1:7080/test
ledger.db.uri=

#账本数据库的连接口令

+ 1
- 0
deploy/pom.xml View File

@@ -20,6 +20,7 @@
<module>../core</module>
<module>deploy-gateway</module>
<module>deploy-peer</module>
<module>deploy-kvdb</module>
</modules>

</project>

+ 1
- 1
test

@@ -1 +1 @@
Subproject commit 7c348ac2e813bdd77a9b2e00ddc340da26f7ccb6
Subproject commit 7f9a7107f8c916a688d9b49749ade0334302ca26

Loading…
Cancel
Save