update docker configs

This commit is contained in:
CaiHQ 2022-05-05 13:28:26 +08:00
parent 310b0f2913
commit 1a79df1478
5 changed files with 101 additions and 19 deletions

View File

@ -58,6 +58,7 @@ task copyScript(type: Copy) {
include 'ncstop.sh'
include 'ncconfig.json.template'
include 'updateCluster.sh'
include 'log4j2.properties'
}
into "./build/output"
println("copyScript done !")
@ -101,7 +102,7 @@ task copyWebContent(type: Copy) {
task buildBDServerClusterZip(type: Zip, dependsOn: ["copyWebContent", "copyScript", "copyJar"]) {
from './build/output/'
duplicatesStrategy = DuplicatesStrategy.INCLUDE
archiveFileName = 'bdserver-cluster.zip'
archiveFileName = 'bdcluster-all.zip'
destinationDirectory = file('build/')
}

40
script/log4j2.properties Normal file
View File

@ -0,0 +1,40 @@
filter.threshold.type=ThresholdFilter
filter.threshold.level=debug
appender.console.type=Console
appender.console.name=STDOUT
appender.console.layout.type=PatternLayout
appender.console.layout.pattern=%highlight{[%-5p] %d{HH:mm:ss.SSS} %m (%F:%L)[%M]%n}{FATAL=Bright Red,ERROR=Red,WARN=Yellow,INFO=Green,DEBUG=Blue,TRACE=White}
appender.logrolling.type=RollingFile
appender.logrolling.name=infoLogFile
appender.logrolling.append=true
appender.logrolling.fileName=./log/cm.log
appender.logrolling.filePattern=./log/cm-%i.log
appender.logrolling.layout.type=PatternLayout
appender.logrolling.layout.pattern=[%-5p] %d{HH:mm:ss.SSS} %m (%F:%L)[%M]%n
appender.logrolling.policies.type = Policies
appender.logrolling.policies.size.type = SizeBasedTriggeringPolicy
appender.logrolling.policies.size.size = 100MB
appender.logrolling.strategy.type = DefaultRolloverStrategy
appender.logrolling.strategy.max = 5
appender.errrolling.type=RollingFile
appender.errrolling.name=errorLogFile
appender.errrolling.append=true
appender.errrolling.fileName=./log/cm.err
appender.errrolling.filePattern=./log/cm-%i.err
appender.errrolling.layout.type=PatternLayout
appender.errrolling.layout.pattern=[%-5p] %d{HH:mm:ss.SSS} %m (%F:%L)[%M]%n
appender.errrolling.policies.type = Policies
appender.errrolling.policies.size.type = SizeBasedTriggeringPolicy
appender.errrolling.policies.size.size = 100MB
appender.errrolling.strategy.type = DefaultRolloverStrategy
appender.errrolling.strategy.max = 5
rootLogger.level=info
rootLogger.appenderRef.stdout.ref=STDOUT
rootLogger.appenderRef.errorFile.ref=errorLogFile
rootLogger.appenderRef.errorFile.level=error
rootLogger.appenderRef.infoFile.ref=infoLogFile
rootLogger.appenderRef.infoFile.level=info
rootLogger.appenderRef.log.ref=log

View File

@ -20,7 +20,7 @@ fi
# ps -ef | grep java | grep bdcluster | grep NodeCenterServer | awk '{print $2}' |xargs kill -9
#-Dlog4j.configuration=file:
java -Dfile.encoding=UTF-8 -Dlog4j.configuration=file:./log4j.properties -cp "./libs/*:bdcluster.jar" org.bdware.server.NodeCenterServer 1 >./log/nc.log 2>./log/nc.err &
java -Dfile.encoding=UTF-8 -Dlog4j.configurationFile=./log4j2.properties -cp "./libs/*:bdcluster.jar" org.bdware.server.NodeCenterServer 1 >./log/nc.log 2>./log/nc.err &
#以下可启用https/wss其中./ssl/xxx.pfx为ssl证书的路径:后面的123456是密码。
#java -Dfile.encoding=UTF-8 -cp "./libs/*:bdcluster.jar" org.bdware.server.NodeCenterServer -service-port=18002 -enable-ssl=./ssl/xxx.pfx:123456 -do-repo-ip=127.0.0.1 -do-repo-port=18098 1 > ./log/cm.log 2> ./log/cm.err &

View File

@ -29,10 +29,14 @@ import org.bdware.server.irp.LocalLHSProxy;
import org.bdware.server.nodecenter.*;
import org.bdware.server.ws.DelimiterCodec;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Date;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
@ -125,18 +129,30 @@ public class NodeCenterServer {
CMDConf cmf = CMDConf.parseFile(CONFIG_PATH).parseArgs(args);
configServer(cmf);
if (LocalLHSProxy.enabled) {
threadPool = Executors.newSingleThreadExecutor();
threadPool.execute(() -> {
try {
LocalLHSProxy.start();
} catch (Exception e) {
LOGGER.error("local LHS proxy failed: " + e.getMessage());
File keyFile = new File("manager.key");
if (keyFile.exists()) {
try {
BufferedReader br = new BufferedReader(new FileReader(keyFile));
String pubKey = br.readLine();
String nowManager =
KeyValueDBUtil.instance.getValue(
NCTables.ConfigDB.toString(), NCManagerAction.centerManger);
// manager.key is used when node manager isn' set
if (null == nowManager || nowManager.isEmpty()) {
KeyValueDBUtil.instance.setValue(
NCTables.ConfigDB.toString(), NCManagerAction.centerManger, pubKey);
KeyValueDBUtil.instance.setValue(
NCTables.ConfigDB.toString(), NCManagerAction.clusterName, "clusterName_" + pubKey.substring(0, 5));
KeyValueDBUtil.instance.setValue(NCTables.NodeUser.toString(), pubKey, "NodeManager");
KeyValueDBUtil.instance.setValue(
NCTables.NodeTime.toString(), pubKey, Long.toString(new Date().getTime()));
LOGGER.info("set node manager from manager.key");
}
});
} catch (IOException ignored) {
}
}
listenSocket(cmf.servicePort + 1);
OtherNCProxy.instance.init();

View File

@ -4,12 +4,37 @@ appender.console.type=Console
appender.console.name=STDOUT
appender.console.layout.type=PatternLayout
appender.console.layout.pattern=%highlight{[%-5p] %d{HH:mm:ss.SSS} %m (%F:%L)[%M]%n}{FATAL=Bright Red,ERROR=Red,WARN=Yellow,INFO=Green,DEBUG=Blue,TRACE=White}
appender.rolling.type=File
appender.rolling.name=log
appender.rolling.append=true
appender.rolling.fileName=./log/nc.log
appender.rolling.layout.type=PatternLayout
appender.rolling.layout.pattern=%d-%m%n
rootLogger.level=debug
appender.logrolling.type=RollingFile
appender.logrolling.name=infoLogFile
appender.logrolling.append=true
appender.logrolling.fileName=./log/cm.log
appender.logrolling.filePattern=./log/cm-%i.log
appender.logrolling.layout.type=PatternLayout
appender.logrolling.layout.pattern=[%-5p] %d{HH:mm:ss.SSS} %m (%F:%L)[%M]%n
appender.logrolling.policies.type = Policies
appender.logrolling.policies.size.type = SizeBasedTriggeringPolicy
appender.logrolling.policies.size.size = 100MB
appender.logrolling.strategy.type = DefaultRolloverStrategy
appender.logrolling.strategy.max = 5
appender.errrolling.type=RollingFile
appender.errrolling.name=errorLogFile
appender.errrolling.append=true
appender.errrolling.fileName=./log/cm.err
appender.errrolling.filePattern=./log/cm-%i.err
appender.errrolling.layout.type=PatternLayout
appender.errrolling.layout.pattern=[%-5p] %d{HH:mm:ss.SSS} %m (%F:%L)[%M]%n
appender.errrolling.policies.type = Policies
appender.errrolling.policies.size.type = SizeBasedTriggeringPolicy
appender.errrolling.policies.size.size = 100MB
appender.errrolling.strategy.type = DefaultRolloverStrategy
appender.errrolling.strategy.max = 5
rootLogger.level=info
rootLogger.appenderRef.stdout.ref=STDOUT
rootLogger.appenderRef.log.ref=log
rootLogger.appenderRef.errorFile.ref=errorLogFile
rootLogger.appenderRef.errorFile.level=error
rootLogger.appenderRef.infoFile.ref=infoLogFile
rootLogger.appenderRef.infoFile.level=info
rootLogger.appenderRef.log.ref=log