Skip to content
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

Feature/rebalance keeper #784

Merged
merged 6 commits into from
May 23, 2024
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>

<property name="baseDir" value="/opt/logs/100004374" />
<property name="appName" value="xpipe-console" />
<property name="delayLogName" value="redis-delay" />
<property name="nettyClient" value="netty-client" />

<appender name="CONSOLE" class="com.alibaba.arthas.deps.ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>[%d{HH:mm:ss:SSS}][%p][%t][%X{class}]%message%xEx%n</pattern>
</encoder>
</appender>

<appender name="ROLLING" class="com.alibaba.arthas.deps.ch.qos.logback.core.rolling.RollingFileAppender">
<file>${baseDir}/${appName}-proxy-client.log</file>

<!-- 轮转策略 -->
<rollingPolicy class="com.alibaba.arthas.deps.ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${baseDir}/${appName}-proxy-client-%d{yyyy-MM-dd}-%i.log.gz</fileNamePattern>
<MaxHistory>30</MaxHistory>
<totalSizeCap>10GB</totalSizeCap>
<maxFileSize>100MB</maxFileSize>
</rollingPolicy>
<!-- 日志输出格式 -->
<encoder charset="utf-8">
<pattern>[%d{HH:mm:ss:SSS}][%p][%t][%c]%message%xEx%n</pattern>
</encoder>
</appender>

<root level="INFO">
<appender-ref ref="ROLLING" />
</root>

</configuration>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MODE=service
PID_FOLDER=.
JAVA_OPTS="$JAVA_OPTS -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -Dlogging.config=config/log4j2.xml -Dlog4j.configurationFile=config/log4j2.xml -Dlocalpath=config -DFXXPIPE_HOME=config"
JAVA_OPTS="$JAVA_OPTS -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -Dlogging.config=config/log4j2.xml -Dlog4j.configurationFile=config/log4j2.xml -Darthas.logback.configurationFile=config/arthas-logback.xml -Dlocalpath=config -DFXXPIPE_HOME=config"
LOG_FOLDER=/opt/logs/100004374/
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ function changeAndMakeLogDir(){
makedir $logdir
#../xx.conf
sed -i 's#LOG_FOLDER=\(.*\)#LOG_FOLDER='"$logdir"'#' $current/../*.conf

# <property name="baseDir" value="/opt/logs/100004374" />
sed -i 's#name="baseDir">.*</Property>#name="baseDir">'$logdir'</Property>#' $current/../config/log4j2.xml
sed -i 's|<property name="baseDir" value="/opt/logs/[^"]*" />|<property name="baseDir" value="'$logdir'" />|' $current/../config/arthas-logback.xml
}
function changePort(){
conf=$1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>

<property name="baseDir" value="/opt/logs/100004376" />
<property name="appName" value="xpipe-keeper" />
<property name="delayLogName" value="redis-delay" />
<property name="nettyClient" value="netty-client" />

<appender name="CONSOLE" class="com.alibaba.arthas.deps.ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>[%d{HH:mm:ss:SSS}][%p][%t][%X{class}]%message%xEx%n</pattern>
</encoder>
</appender>

<appender name="ROLLING" class="com.alibaba.arthas.deps.ch.qos.logback.core.rolling.RollingFileAppender">
<file>${baseDir}/${appName}-proxy-client.log</file>

<!-- 轮转策略 -->
<rollingPolicy class="com.alibaba.arthas.deps.ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${baseDir}/${appName}-proxy-client-%d{yyyy-MM-dd}-%i.log.gz</fileNamePattern>
<MaxHistory>30</MaxHistory>
<totalSizeCap>10GB</totalSizeCap>
<maxFileSize>100MB</maxFileSize>
</rollingPolicy>
<!-- 日志输出格式 -->
<encoder charset="utf-8">
<pattern>[%d{HH:mm:ss:SSS}][%p][%t][%c]%message%xEx%n</pattern>
</encoder>
</appender>

<root level="INFO">
<appender-ref ref="ROLLING" />
</root>

</configuration>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MODE=service
PID_FOLDER=.
JAVA_OPTS="$JAVA_OPTS -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -Dlogging.config=config/log4j2.xml -Dlog4j.configurationFile=config/log4j2.xml -Dlocalpath=config"
JAVA_OPTS="$JAVA_OPTS -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -Dlogging.config=config/log4j2.xml -Dlog4j.configurationFile=config/log4j2.xml -Darthas.logback.configurationFile=config/arthas-logback.xml -Dlocalpath=config"
LOG_FOLDER=/opt/logs/100004376/
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ function changeAndMakeLogDir(){
#../xx.conf
sed -i 's#LOG_FOLDER=\(.*\)#LOG_FOLDER='"$logdir"'#' $current/../*.conf
sed -i 's#name="baseDir">.*</Property>#name="baseDir">'$logdir'</Property>#' $current/../config/log4j2.xml
sed -i 's|<property name="baseDir" value="/opt/logs/[^"]*" />|<property name="baseDir" value="'$logdir'" />|' $current/../config/arthas-logback.xml
}
function changeConfigLogFile() {
current=$1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ private long getUsedMemory(InfoResultExtractor extractor) {
Long usedMemory = extractor.getUsedMemory();
Long dbSize = extractor.getSwapUsedDbSize();

if (dbSize == null) return usedMemory;
if (dbSize == null || usedMemory < maxMemory) return usedMemory;

String keysSpaceDb0 = extractor.extract("db0");
if (StringUtil.isEmpty(keysSpaceDb0)) return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void onAction(KeeperInfoStatsActionContext context) {
long keeperFlow = extractor.getKeeperInstantaneousInputKbps().longValue();
deleteKeeper(info);
Map<DcClusterShardKeeper, Long> keeperContainerResult = MapUtils.getOrCreate(hostPort2InputFlow, info.getHostPort().getHost(), ConcurrentHashMap::new);
keeperContainerResult.put(new DcClusterShardKeeper(info.getDcId(), info.getClusterId(), info.getShardId(), extractor.getKeeperActive(), info.getHostPort().getPort()), keeperFlow);
keeperContainerResult.put(new DcClusterShardKeeper(info.getDcId(), info.getClusterId(), info.getShardId(), extractor.isKeeperActive(), info.getHostPort().getPort()), keeperFlow);
} catch (Throwable throwable) {
logger.error("get instantaneous input kbps of keeper:{} error: ", context.instance().getCheckInfo().getHostPort(), throwable);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public void go() throws Exception {
chain.add(new AnalyseHellos(context, checkerConfig));
chain.add(new AcquireLeakyBucket(context, leakyBucket));
chain.add(new DeleteSentinels(context, sentinelManager));
chain.add(new ResetSentinels(context, metaCache, alertManager, keyedObjectPool, scheduled, resetExecutor, sentinelManager));
chain.add(new ResetSentinels(context, metaCache, keyedObjectPool, scheduled, resetExecutor, sentinelManager));
chain.add(new AddSentinels(context, sentinelManager, checkerConfig));
chain.add(new SetSentinels(context, sentinelManager));
chain.execute().addListener(commandFuture -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected void doExecute() throws Throwable {

ParallelCommandChain addChain = new ParallelCommandChain(MoreExecutors.directExecutor(), false);
context.getToAdd().forEach((hello) -> {
CatEventMonitor.DEFAULT.logEvent("Sentinel.Hello.Collector.Add", hello.toString());
CatEventMonitor.DEFAULT.logEvent("Sentinel.Hello.Collector.Add", hello.getMonitorName());
HostPort sentinelAddr = hello.getSentinelAddr();
Sentinel sentinel = new Sentinel(sentinelAddr.toString(), sentinelAddr.getHost(), sentinelAddr.getPort());
addChain.add(sentinelManager.monitorMaster(sentinel, hello.getMonitorName(), hello.getMasterAddr(), checkerConfig.getDefaultSentinelQuorumConfig().getQuorum()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected void doExecute() throws Throwable {
ParallelCommandChain deleteChain = new ParallelCommandChain(MoreExecutors.directExecutor(), false);

context.getToDelete().forEach((hello -> {
CatEventMonitor.DEFAULT.logEvent("Sentinel.Hello.Collector.Remove", hello.toString());
CatEventMonitor.DEFAULT.logEvent("Sentinel.Hello.Collector.Remove", hello.getMonitorName());
HostPort sentinelAddr = hello.getSentinelAddr();
deleteChain.add(sentinelManager.removeSentinelMonitor(new Sentinel(sentinelAddr.toString(), sentinelAddr.getHost(), sentinelAddr.getPort()), hello.getMonitorName()));
}));
Expand Down
Loading
Loading