Skip to content

k8s 部署 #172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docker/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM openjdk:11
COPY ../dataset ./dataset
COPY ./dataset ./dataset
WORKDIR /release
COPY ../release/config ./config
COPY ../release/bin ./bin
COPY ../release/adapter ./adapter
ADD ../release/*.sh ./
COPY ./release/config ./config
COPY ./release/bin ./bin
COPY ./release/adapter ./adapter
ADD ./release/*.sh ./
ENTRYPOINT sh -c 'chmod 777 ./owner.sh' &&\
sh -c './owner.sh start ./config/owner1.json' &&\
sh -c 'tail -f /dev/null'
5 changes: 5 additions & 0 deletions owner/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.9.3</version>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import redis.clients.jedis.Jedis;

public class OwnerService extends ServiceGrpc.ServiceImplBase {
private static final Logger LOG = LoggerFactory.getLogger(OwnerService.class);
Expand All @@ -41,6 +42,7 @@ public class OwnerService extends ServiceGrpc.ServiceImplBase {
protected final OpenHuFuRpc ownerSideRpc;
protected final OwnerSideImplementor implementor;
protected final Adapter adapter;
protected final Jedis jedis;
protected final Map<ProtocolType, ProtocolExecutor> libraries;
protected final SchemaManager schemaManager;

Expand All @@ -52,6 +54,9 @@ public OwnerService(OwnerConfig config) {
this.implementor = new OwnerSideImplementor(ownerSideRpc, adapter, threadPool);
this.schemaManager = this.adapter.getSchemaManager();
this.libraries = config.librarys;
this.jedis = config.jedis;
System.out.println(jedis.ping());
System.out.println(jedis.get("blockHeight"));
ImplementorConfig.initImplementorConfig(config.implementorConfigPath);
initPublishedTable(config.tables);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.hufudb.openhufu.owner.adapter;

public class RedisConfig {
public String host;
public int port;
public String pwd;
public int database;

public RedisConfig() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.hufudb.openhufu.rpc.grpc.OpenHuFuRpc;
import io.grpc.ChannelCredentials;
import io.grpc.ServerCredentials;
import redis.clients.jedis.Jedis;

public class OwnerConfig {
public Party party;
Expand All @@ -25,6 +26,8 @@ public class OwnerConfig {
public List<PojoPublishedTableSchema> tables;
public Map<ProtocolType, ProtocolExecutor> librarys;
public String implementorConfigPath;

public Jedis jedis;
public OwnerConfig() {}

public OwnerConfig(Party party, int port, String hostname, ExecutorService threadPool,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,15 @@
import com.hufudb.openhufu.mpc.ProtocolType;
import com.hufudb.openhufu.mpc.lib.LibraryConfig;
import com.hufudb.openhufu.mpc.lib.LibraryLoader;
import com.hufudb.openhufu.owner.adapter.Adapter;
import com.hufudb.openhufu.owner.adapter.AdapterConfig;
import com.hufudb.openhufu.owner.adapter.AdapterFactory;
import com.hufudb.openhufu.owner.adapter.AdapterLoader;
import com.hufudb.openhufu.owner.adapter.*;
import com.hufudb.openhufu.proto.OpenHuFuService.OwnerInfo;
import com.hufudb.openhufu.rpc.grpc.OpenHuFuOwnerInfo;
import com.hufudb.openhufu.rpc.grpc.OpenHuFuRpc;
import io.grpc.TlsChannelCredentials;
import io.grpc.TlsServerCredentials;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import redis.clients.jedis.Jedis;

public class OwnerConfigFile {
private static final int THREAD_NUM = 8;
Expand All @@ -41,6 +39,7 @@ public class OwnerConfigFile {
public String trustcertpath;
public List<PojoPublishedTableSchema> tables;
public AdapterConfig adapterconfig;
public RedisConfig redisconfig;
public List<LibraryConfig> libraryconfigs;
public String implementorconfigpath;
public OwnerConfigFile(int id, int port, int threadnum, String hostname, String privatekeypath,
Expand Down Expand Up @@ -148,6 +147,9 @@ public OwnerConfig generateConfig() {
throw new OpenHuFuException(ErrorCode.IMPLEMENTOR_CONFIG_FILE_PATH_NOT_SET);
}
config.implementorConfigPath = implementorconfigpath;
config.jedis = new Jedis(redisconfig.host, redisconfig.port);
config.jedis.auth(redisconfig.pwd);
config.jedis.select(redisconfig.database);
return config;
}
}
6 changes: 6 additions & 0 deletions release/config/owner1.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
"url": "../dataset/sample/tpc-h/database0",
"delimiter": "|"
},
"redisconfig": {
"host" : "192.168.40.230",
"port": 31012,
"pwd": "Wlty*Ny1b!",
"database": 0
},
"tables": [
{
"actualName": "customer",
Expand Down
3 changes: 2 additions & 1 deletion scripts/build/image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
set -ex

./scripts/build/package.sh
docker build -f ./docker/Dockerfile -t openhufu-server:1.0 .
docker pull openjdk:11
docker build -f ./Dockerfile -t docker.oa.com:5000/mpc/openhufu-server:1.0 .
2 changes: 1 addition & 1 deletion scripts/build/setup_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

#set -ex

docker run -d -t --name=openhufu-server openhufu-server:1.0
docker run -d -t --name=openhufu-server docker.oa.com:5000/mpc/openhufu-server:1.0
2 changes: 1 addition & 1 deletion scripts/build/stop_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

#set -ex

docker stop openhufu-server
docker stop docker.oa.com:5000/mpc/openhufu-server:1.0