Browse Source

打印下worerId up3

master
jianjun 3 years ago
parent
commit
ae52800029
  1. 2
      epmet-user/epmet-user-server/deploy/docker-compose-prod.yml
  2. 1
      epmet-user/epmet-user-server/src/main/java/com/epmet/UserApplication.java
  3. 15
      epmet-user/epmet-user-server/src/main/java/com/epmet/util/MySequence.java

2
epmet-user/epmet-user-server/deploy/docker-compose-prod.yml

@ -2,7 +2,7 @@ version: "3.7"
services:
epmet-user-server:
container_name: epmet-user-server-prod
image: 172.22.76.12:5000/epmet-cloud-master/epmet-user-server:0.3.225
image: 172.22.76.12:5000/epmet-cloud-master/epmet-user-server:0.3.226
ports:
- "8087:8087"
network_mode: host # 不会创建新的网络

1
epmet-user/epmet-user-server/src/main/java/com/epmet/UserApplication.java

@ -8,6 +8,7 @@
package com.epmet;
import com.epmet.util.MySequence;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;

15
epmet-user/epmet-user-server/src/main/java/com/epmet/MySequence.java → epmet-user/epmet-user-server/src/main/java/com/epmet/util/MySequence.java

@ -13,13 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.epmet;
package com.epmet.util;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.Assert;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.SystemClock;
import com.epmet.commons.tools.utils.HttpClientManager;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.logging.Log;
import org.apache.ibatis.logging.LogFactory;
@ -82,7 +83,9 @@ public class MySequence {
public MySequence() {
this.datacenterId = getDatacenterId(maxDatacenterId);
this.workerId = getMaxWorkerId(datacenterId, maxWorkerId);
log.info("MySequence datacenterId:"+this.datacenterId+";workerId:"+this.workerId);
String msg = "MySequence datacenterId:" + this.datacenterId + ";workerId:" + this.workerId;
log.info(msg);
HttpClientManager.getInstance().sendAlarmMsg(msg);
}
/**
@ -107,7 +110,9 @@ public class MySequence {
StringBuilder mpid = new StringBuilder();
mpid.append(datacenterId);
String name = ManagementFactory.getRuntimeMXBean().getName();
log.info("MySequence getMaxWorkerId name:"+name);
String msg = "MySequence getMaxWorkerId name:" + name;
log.info(msg);
HttpClientManager.getInstance().sendAlarmMsg(msg);
if (StringUtils.isNotBlank(name)) {
/*
* GET jvmPid
@ -128,7 +133,9 @@ public class MySequence {
try {
InetAddress ip = InetAddress.getLocalHost();
NetworkInterface network = NetworkInterface.getByInetAddress(ip);
log.info("MySequence ip:"+JSON.toJSONString(ip)+";network: "+JSON.toJSONString(network));
String msg = "MySequence ip:" + JSON.toJSONString(ip) + ";network: " + JSON.toJSONString(network);
log.info(msg);
HttpClientManager.getInstance().sendAlarmMsg(msg);
if (network == null) {
id = 1L;
log.info("MySequen cenetwork ==null ");
Loading…
Cancel
Save