修改&&规范 配置格式

pull/13/head
3y 2 years ago
parent c9b4bbe22b
commit 530001a0bf

@ -72,9 +72,9 @@ austin项目**核心流程**`austin-api`接收到发送消息请求,直接
**3**、执行`sql`文件夹下的`austin.sql`创建对应的表以及插入测试数据 **3**、执行`sql`文件夹下的`austin.sql`创建对应的表以及插入测试数据
**4**、如果配置`austin-mq-pipeline=kafka`,需要填写`application.properties`中`austin-kafka`对应的`ip`/`port`信息 **4**、如果配置`austin.mq.pipeline=kafka`,需要填写`application.properties`中`austin.kafka`对应的`ip`/`port`信息
**5**、填写`application.properties`中`austin-redis`对应的`ip`/`port`信息 **5**、填写`application.properties`中`austin.redis`对应的`ip`/`port`信息
**6**、检查消息队列topic`austin.business.topic.name`(我的topicName为austinBusiness) **6**、检查消息队列topic`austin.business.topic.name`(我的topicName为austinBusiness)
@ -100,9 +100,9 @@ curl -XPOST "127.0.0.1:8080/send" -H 'Content-Type: application/json' -d '{"co
**12**、正常使用**数据管理**(查看实时数据链路下发)需要将`austin-stream`的`jar`包上传至`Flink`,根据[部署文档](INSTALL.md)启动Flink。在打`jar`包前需要填写`com.java3y.austin.stream.constants.AustinFlinkConstant`中的`redis`和`kafka`的`ip/port`日志的topic在`application.properties`中的`austin.business.log.topic.name`。如果没有该topic需要提前创建并使用Kafka作为消息队列实现) **12**、正常使用**数据管理**(查看实时数据链路下发)需要将`austin-stream`的`jar`包上传至`Flink`,根据[部署文档](INSTALL.md)启动Flink。在打`jar`包前需要填写`com.java3y.austin.stream.constants.AustinFlinkConstant`中的`redis`和`kafka`的`ip/port`日志的topic在`application.properties`中的`austin.business.log.topic.name`。如果没有该topic需要提前创建并使用Kafka作为消息队列实现)
**13**、正常使用**定时任务**需要部署`xxl-job`,根据[部署文档](INSTALL.md)启动xxl的调度中心并在`application.properteis`中填写 `austin-xxl-job-ip`和`austin-xxl-job-port` **13**、正常使用**定时任务**需要部署`xxl-job`,根据[部署文档](INSTALL.md)启动xxl的调度中心并在`application.properteis`中填写 `austin.xxl.job.ip`和`austin.xxl.job.port`
**14**、正常使用**分布式日志采集**需要部署`graylog`,根据[部署文档](INSTALL.md)启动`graylog`,并在`application.properteis`中填写 `austin-grayLog-ip` **14**、正常使用**分布式日志采集**需要部署`graylog`,根据[部署文档](INSTALL.md)启动`graylog`,并在`application.properteis`中填写 `austin.grayLog.ip`
**14**、正常使用**系统监控**需要部署`promethus`和`grafana`,根据[部署文档](INSTALL.md)配置`grafana`图表 **14**、正常使用**系统监控**需要部署`promethus`和`grafana`,根据[部署文档](INSTALL.md)配置`grafana`图表

@ -13,7 +13,7 @@ import org.springframework.context.annotation.Configuration;
*/ */
@Slf4j @Slf4j
@Configuration @Configuration
@ConditionalOnProperty(name = "xxl-job.enabled",havingValue = "true") @ConditionalOnProperty(name = "austin.xxl.job.enabled",havingValue = "true")
public class XxlJobConfig { public class XxlJobConfig {
@Value("${xxl.job.admin.addresses}") @Value("${xxl.job.admin.addresses}")

@ -16,7 +16,7 @@ import java.util.List;
* @author 3y * @author 3y
*/ */
@Component @Component
@ConditionalOnProperty(name = "austin-mq-pipeline", havingValue = MessageQueuePipeline.EVENT_BUS) @ConditionalOnProperty(name = "austin.mq.pipeline", havingValue = MessageQueuePipeline.EVENT_BUS)
public class EventBusReceiver implements EventBusListener { public class EventBusReceiver implements EventBusListener {
@Autowired @Autowired

@ -36,7 +36,7 @@ import java.util.Optional;
@Slf4j @Slf4j
@Component @Component
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@ConditionalOnProperty(name = "austin-mq-pipeline", havingValue = MessageQueuePipeline.KAFKA) @ConditionalOnProperty(name = "austin.mq.pipeline", havingValue = MessageQueuePipeline.KAFKA)
public class Receiver { public class Receiver {
@Autowired @Autowired
private ConsumeService consumeService; private ConsumeService consumeService;

@ -31,7 +31,7 @@ import java.util.Optional;
* @date 2021/12/4 * @date 2021/12/4
*/ */
@Service @Service
@ConditionalOnProperty(name = "austin-mq-pipeline", havingValue = MessageQueuePipeline.KAFKA) @ConditionalOnProperty(name = "austin.mq.pipeline", havingValue = MessageQueuePipeline.KAFKA)
@Slf4j @Slf4j
public class ReceiverStart { public class ReceiverStart {

@ -21,9 +21,9 @@ import java.util.List;
* create date: 2022/7/16 * create date: 2022/7/16
*/ */
@Component @Component
@ConditionalOnProperty(name = "austin-mq-pipeline", havingValue = MessageQueuePipeline.ROCKET_MQ) @ConditionalOnProperty(name = "austin.mq.pipeline", havingValue = MessageQueuePipeline.ROCKET_MQ)
@RocketMQMessageListener(topic = "${austin.business.topic.name}", @RocketMQMessageListener(topic = "${austin.business.topic.name}",
consumerGroup = "${austin-rocketmq-biz-consumer-group}", consumerGroup = "${austin.rocketmq.biz.consumer.group}",
selectorType = SelectorType.TAG, selectorType = SelectorType.TAG,
selectorExpression = "${austin.business.tagId.value}" selectorExpression = "${austin.business.tagId.value}"
) )

@ -19,9 +19,9 @@ import org.springframework.stereotype.Component;
* create date: 2022/7/16 * create date: 2022/7/16
*/ */
@Component @Component
@ConditionalOnProperty(name = "austin-mq-pipeline", havingValue = MessageQueuePipeline.ROCKET_MQ) @ConditionalOnProperty(name = "austin.mq.pipeline", havingValue = MessageQueuePipeline.ROCKET_MQ)
@RocketMQMessageListener(topic = "${austin.business.recall.topic.name}", @RocketMQMessageListener(topic = "${austin.business.recall.topic.name}",
consumerGroup = "${austin-rocketmq-recall-consumer-group}", consumerGroup = "${austin.rocketmq.recall.consumer.group}",
selectorType = SelectorType.TAG, selectorType = SelectorType.TAG,
selectorExpression = "${austin.business.tagId.value}" selectorExpression = "${austin.business.tagId.value}"
) )

@ -20,7 +20,7 @@ import org.springframework.stereotype.Service;
*/ */
@Slf4j @Slf4j
@Service @Service
@ConditionalOnProperty(name = "austin-mq-pipeline", havingValue = MessageQueuePipeline.EVENT_BUS) @ConditionalOnProperty(name = "austin.mq.pipeline", havingValue = MessageQueuePipeline.EVENT_BUS)
public class EventBusSendMqServiceImpl implements SendMqService { public class EventBusSendMqServiceImpl implements SendMqService {
private EventBus eventBus = new EventBus(); private EventBus eventBus = new EventBus();

@ -24,7 +24,7 @@ import java.util.List;
*/ */
@Slf4j @Slf4j
@Service @Service
@ConditionalOnProperty(name = "austin-mq-pipeline", havingValue = MessageQueuePipeline.KAFKA) @ConditionalOnProperty(name = "austin.mq.pipeline", havingValue = MessageQueuePipeline.KAFKA)
public class KafkaSendMqServiceImpl implements SendMqService { public class KafkaSendMqServiceImpl implements SendMqService {
@Autowired @Autowired

@ -16,7 +16,7 @@ import org.springframework.stereotype.Service;
*/ */
@Slf4j @Slf4j
@Service @Service
@ConditionalOnProperty(name = "austin-mq-pipeline", havingValue = MessageQueuePipeline.RABBIT_MQ) @ConditionalOnProperty(name = "austin.mq.pipeline", havingValue = MessageQueuePipeline.RABBIT_MQ)
public class RabbitSendMqServiceImpl implements SendMqService { public class RabbitSendMqServiceImpl implements SendMqService {
@Autowired @Autowired

@ -18,7 +18,7 @@ import org.springframework.stereotype.Service;
*/ */
@Slf4j @Slf4j
@Service @Service
@ConditionalOnProperty(name = "austin-mq-pipeline", havingValue = MessageQueuePipeline.ROCKET_MQ) @ConditionalOnProperty(name = "austin.mq.pipeline", havingValue = MessageQueuePipeline.ROCKET_MQ)
public class RocketMqSendMqServiceImpl implements SendMqService { public class RocketMqSendMqServiceImpl implements SendMqService {
@Autowired @Autowired

@ -6,7 +6,7 @@ import com.alibaba.fastjson.JSON;
import com.google.common.base.Throwables; import com.google.common.base.Throwables;
import com.java3y.austin.common.domain.AnchorInfo; import com.java3y.austin.common.domain.AnchorInfo;
import com.java3y.austin.common.domain.LogParam; import com.java3y.austin.common.domain.LogParam;
import com.java3y.austin.support.constans.MessageQueuePipeline; import com.java3y.austin.support.mq.SendMqService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@ -22,11 +22,8 @@ import org.springframework.stereotype.Component;
@Component @Component
public class LogUtils extends CustomLogListener { public class LogUtils extends CustomLogListener {
@Value("${austin-mq-pipeline}")
private String mqPipeline;
@Autowired @Autowired
private KafkaTemplate kafkaTemplate; private SendMqService sendMqService;
@Value("${austin.business.log.topic.name}") @Value("${austin.business.log.topic.name}")
private String topicName; private String topicName;
@ -54,17 +51,15 @@ public class LogUtils extends CustomLogListener {
anchorInfo.setTimestamp(System.currentTimeMillis()); anchorInfo.setTimestamp(System.currentTimeMillis());
String message = JSON.toJSONString(anchorInfo); String message = JSON.toJSONString(anchorInfo);
log.info(message); log.info(message);
if (MessageQueuePipeline.KAFKA.equals(mqPipeline)) {
try { try {
kafkaTemplate.send(topicName, message); sendMqService.send(topicName, message);
} catch (Exception e) { } catch (Exception e) {
log.error("LogUtils#print kafka fail! e:{},params:{}", Throwables.getStackTraceAsString(e) log.error("LogUtils#print send mq fail! e:{},params:{}", Throwables.getStackTraceAsString(e)
, JSON.toJSONString(anchorInfo)); , JSON.toJSONString(anchorInfo));
} }
} }
}
/** /**
* *
*/ */

@ -15,7 +15,7 @@ public class AustinApplication {
* TODO optional * TODO optional
* *
* 1apollo * 1apollo
* 2application.properties apollo.enabled true * 2application.properties austin.apollo.enabled true
* 3propertyipport * 3propertyipport
*/ */
System.setProperty("apollo.config-service", "http://ip:port"); System.setProperty("apollo.config-service", "http://ip:port");

@ -3,41 +3,42 @@
# TODO please replace 【must】 config value # TODO please replace 【must】 config value
# todo [database] ip/port/username/password 【must】 # todo [database] ip/port/username/password 【must】
austin-database-ip=localhost austin.database.ip=localhost
austin-database-port=3306 austin.database.port=3306
austin-database-username=root austin.database.username=root
austin-database-password=root123_A austin.database.password=root123_A
# todo [redis] ip/port/password【must】 # todo [redis] ip/port/password【must】
austin-redis-ip=localhost austin.redis.ip=localhost
austin-redis-port=5003 austin.redis.port=5003
austin-redis-password=austin austin.redis.password=austin
# TODO choose : kafka/eventBus/rocketMq/rabbitMq # TODO choose : kafka/eventBus/rocketMq/rabbitMq, default eventBus
austin-mq-pipeline=eventBus austin.mq.pipeline=eventBus
# todo [kafka] ip/port【optional】, if austin-mq-pipeline=kafka 【must】 # todo [kafka] ip/port【optional】, if austin.mq.pipeline=kafka 【must】
austin-kafka-ip= austin.kafka.ip=
austin-kafka-port= austin.kafka.port=
# todo [rocketMq] 【optional】, if austin-mq-pipeline=rocketMq【must】 # todo [rocketMq] 【optional】, if austin.mq.pipeline=rocketMq【must】
austin-rocketmq-nameserver-ip= austin.rocketmq.nameserver.ip=
austin-rocketmq-nameserver-port= austin.rocketmq.nameserver.port=
# todo [rabbitMq] 【optional】, if austin-mq-pipeline=rabbitMq【must】 # todo [rabbitMq] 【optional】, if austin.mq.pipeline=rabbitMq【must】
austin-rabbitmq-ip= austin.rabbitmq.ip=
austin-rabbitmq-port= austin.rabbitmq.port=
# todo [xxl-job] switch/ip/port/【optional # todo [xxl-job] switch 【optional】, if austin.xxl.job.enabled=true 【must
xxl-job.enabled=false austin.xxl.job.enabled=false
austin-xxl-job-ip=127.0.0.1 austin.xxl.job.ip=127.0.0.1
austin-xxl-job-port=6767 austin.xxl.job.port=6767
# todo [apollo] switch 【optional】 # todo choose: apollo/nacos switch 【optional】 ,if apollo and nacos both false, use local.properties
apollo.enabled=false austin.apollo.enabled=false
austin.nacos.enabled=false
# todo [grayLog] ip 【optional】 # todo [grayLog] ip 【optional】
austin-grayLog-ip=127.0.0.1 austin.grayLog.ip=127.0.0.1
##################### system properties ##################### ##################### system properties #####################
server.shutdown=graceful server.shutdown=graceful
@ -45,13 +46,13 @@ server.shutdown=graceful
##################### database properties ##################### ##################### database properties #####################
# notice:mysql version 5.7x !!! # notice:mysql version 5.7x !!!
spring.datasource.url=jdbc:mysql://${austin-database-ip}:${austin-database-port}/austin?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull spring.datasource.url=jdbc:mysql://${austin.database.ip}:${austin.database.port}/austin?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull
spring.datasource.username=${austin-database-username} spring.datasource.username=${austin.database.username}
spring.datasource.password=${austin-database-password} spring.datasource.password=${austin.database.password}
spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.driver-class-name=com.mysql.jdbc.Driver
##################### kafka properties ##################### ##################### kafka properties #####################
spring.kafka.bootstrap-servers=${austin-kafka-ip}:${austin-kafka-port} spring.kafka.bootstrap-servers=${austin.kafka.ip}:${austin.kafka.port}
spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer
spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer
spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer
@ -62,18 +63,18 @@ spring.kafka.consumer.enable-auto-commit=true
##################### rocketmq properties ##################### ##################### rocketmq properties #####################
rocketmq.name-server=${austin-rocketmq-nameserver-ip}:${austin-rocketmq-nameserver-port} rocketmq.name-server=${austin.rocketmq.nameserver.ip}:${austin.rocketmq.nameserver.port}
rocketmq.producer.group=unique-producer-group rocketmq.producer.group=unique-producer-group
austin-rocketmq-biz-consumer-group=unique-biz-consumer-group austin.rocketmq.biz.consumer.group=unique-biz-consumer-group
austin-rocketmq-recall-consumer-group=unique-recall-consumer-group austin.rocketmq.recall.consumer.group=unique-recall-consumer-group
##################### Rabbit properties ##################### ##################### Rabbit properties #####################
#RabbitMq所在服务器IP #RabbitMq所在服务器IP
spring.rabbitmq.host=${austin-rabbitmq-ip} spring.rabbitmq.host=${austin.rabbitmq.ip}
#连接端口号 #连接端口号
spring.rabbitmq.port=${austin-rabbitmq-port} spring.rabbitmq.port=${austin.rabbitmq.port}
server.port=8080 server.port=8080
spring.application.name=cl spring.application.name=cl
@ -90,16 +91,16 @@ austin.rabbitmq.topic.name=austinRabbit
austin.rabbitmq.exchange.name=austin.point austin.rabbitmq.exchange.name=austin.point
##################### redis properties ##################### ##################### redis properties #####################
spring.redis.host=${austin-redis-ip} spring.redis.host=${austin.redis.ip}
spring.redis.port=${austin-redis-port} spring.redis.port=${austin.redis.port}
spring.redis.password=${austin-redis-password} spring.redis.password=${austin.redis.password}
##################### business properties ##################### ##################### business properties #####################
austin.business.topic.name=austinBusiness austin.business.topic.name=austinBusiness
austin.business.recall.topic.name=austinRecall austin.business.recall.topic.name=austinRecall
austin.business.recall.group.name=recallGroupId austin.business.recall.group.name=recallGroupId
austin.business.log.topic.name=austinTraceLog austin.business.log.topic.name=austinTraceLog
austin.business.graylog.ip=${austin-grayLog-ip} austin.business.graylog.ip=${austin.grayLog.ip}
# TODO kafka tag filter,if you need, replace tagIdValue ,eg:com.java3y.austin.yyy # TODO kafka tag filter,if you need, replace tagIdValue ,eg:com.java3y.austin.yyy
austin.business.tagId.key=kafka_tag_id austin.business.tagId.key=kafka_tag_id
@ -109,7 +110,7 @@ austin.business.tagId.value=com.java3y.austin.3y
austin.business.upload.crowd.path=/Users/3y/temp austin.business.upload.crowd.path=/Users/3y/temp
##################### xxl properties ##################### ##################### xxl properties #####################
xxl.job.admin.addresses=http://${austin-xxl-job-ip}:${austin-xxl-job-port}/xxl-job-admin xxl.job.admin.addresses=http://${austin.xxl.job.ip}:${austin.xxl.job.port}/xxl-job-admin
xxl.job.admin.username=admin xxl.job.admin.username=admin
xxl.job.admin.password=123456 xxl.job.admin.password=123456
xxl.job.executor.appname=austin xxl.job.executor.appname=austin
@ -122,15 +123,14 @@ xxl.job.accessToken=
##################### apollo ##################### ##################### apollo #####################
app.id=austin app.id=austin
apollo.bootstrap.enabled=${apollo.enabled} apollo.bootstrap.enabled=${austin.apollo.enabled}
apollo.bootstrap.namespaces=boss.austin,dynamic-tp-apollo-dtp.yml apollo.bootstrap.namespaces=boss.austin,dynamic-tp-apollo-dtp.yml
##################### nacos ##################### ##################### nacos #####################
austin.nacos.enabled=true
austin.nacos.server= austin.nacos.server=
austin.nacos.dataId= austin.nacos.dataId=austin
austin.nacos.group= austin.nacos.group=DEFAULT_GROUP
austin.nacos.namespace= austin.nacos.namespace=9537c674-f3a6-4203-b286-ef0c36bfacb2
##################### httpUtils properties ##################### ##################### httpUtils properties #####################
ok.http.connect-timeout=30 ok.http.connect-timeout=30

@ -14,4 +14,4 @@ EXPOSE 8080
ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS austin.jar $PARAMS"] ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS austin.jar $PARAMS"]
# docker run -e PARAMS="--austin-database-ip= --austin-database-port=3306 --austin-redis-ip= --austin-mq-pipeline=eventbus " -p 8080:8080 --name austin:1.0 # docker run -e PARAMS="--austin.database.ip= --austin.database.port=3306 --austin.redis.ip= --austin.mq.pipeline=eventbus " -p 8080:8080 --name austin:1.0

Loading…
Cancel
Save