main
黄海 12 months ago
parent 6e00bea616
commit f4412a02da

@ -210,7 +210,7 @@ spring:
database: 0
host: 10.10.14.210
port: 6379
password: rzyc#redis
password: ylt#redis
timeout: 0
pool:
max-active: 8

@ -66,7 +66,7 @@ spring:
database: 0
host: 10.10.14.210
port: 6379
password: rzyc#redis
password: ylt#redis
timeout: 0
pool:
max-active: 8

@ -290,9 +290,7 @@ monitorapi:
ribbon:
listOfServers: http://i100c.3322.org:30731
# 负载均衡
ribbon:
eureka:
enabled: false #禁用eureka不依赖 eureka
@ -313,15 +311,15 @@ hystrix:
thread:
timeoutInMilliseconds: 8000 #配置HystrixCommand执行的超时时间执行超过该时间会进行服务降级处理 8s
# 数据库
spring:
data:
mongodb:
host: 10.10.14.210
port: 27017
database: ycharge
username: root
password: 123456
database: yltcharge
username: yltcharge
password: yltcharge
dinger:
project-id: ${spring.application.name}-${spring.profiles.active}
dingers:

@ -0,0 +1,22 @@
{
"hints": [],
"groups": [
{
"sourceType": "com.charge.gwmgr.filter.ZuulPreFilter",
"name": "jwt.filter",
"type": "com.charge.gwmgr.filter.ZuulPreFilter"
}
],
"properties": [
{
"sourceType": "com.charge.gwmgr.filter.ZuulPreFilter",
"name": "jwt.filter.no-access-filter",
"type": "java.util.List<java.lang.String>"
},
{
"sourceType": "com.charge.gwmgr.filter.ZuulPreFilter",
"name": "jwt.filter.should-not-filter",
"type": "java.util.List<java.lang.String>"
}
]
}

@ -290,9 +290,7 @@ monitorapi:
ribbon:
listOfServers: http://i100c.3322.org:30731
# 负载均衡
ribbon:
eureka:
enabled: false #禁用eureka不依赖 eureka
@ -313,15 +311,15 @@ hystrix:
thread:
timeoutInMilliseconds: 8000 #配置HystrixCommand执行的超时时间执行超过该时间会进行服务降级处理 8s
# 数据库
spring:
data:
mongodb:
host: 10.10.14.210
port: 27017
database: ycharge
username: root
password: 123456
database: yltcharge
username: yltcharge
password: yltcharge
dinger:
project-id: ${spring.application.name}-${spring.profiles.active}
dingers:

@ -24,7 +24,7 @@ spring:
database: 0
host: 10.10.14.210
port: 6379
password: rzyc#redis
password: ylt#redis
timeout: 0
pool:
max-active: 8

@ -23,7 +23,7 @@ spring:
database: 0
host: 10.10.14.210
port: 6379
password: rzyc#redis
password: ylt#redis
timeout: 0
pool:
max-active: 8

@ -29,7 +29,7 @@ spring:
database: 0
host: 10.10.14.210
port: 6379
password: rzyc#redis
password: ylt#redis
timeout: 0
pool:
max-active: 8

@ -25,7 +25,7 @@ spring:
database: 0
host: 10.10.14.210
port: 6379
password: rzyc#redis
password: ylt#redis
timeout: 0
pool:
max-active: 8

@ -23,7 +23,7 @@ spring:
database: 0
host: 10.10.14.210
port: 6379
password: rzyc#redis
password: ylt#redis
timeout: 0
pool:
max-active: 8

@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.RestController;
@EnableFeignClients
@ComponentScan("com.charge")
@SpringBootApplication
@EnableAutoConfiguration
@EnableScheduling
@MapperScan(basePackages = "com.charge.station.dao")
@RestController

@ -1,9 +1,8 @@
spring:
datasource:
# url: jdbc:mysql://10.10.14.210:22066/ycharge?useUnicode=true&characterEncoding=UTF-8
url: jdbc:mysql://10.10.14.210:22066/yltcharge?useUnicode=true&characterEncoding=UTF-8
username: yltcharge
password: yltcharge
username: root
password: DsideaL147258369
driver-class-name: com.mysql.jdbc.Driver
druid:
stat-view-servlet:
@ -14,7 +13,7 @@ spring:
redis:
host: 10.10.14.210
port: 6381
port: 6379
password: ylt#redis
timeout: 0
pool:
@ -36,7 +35,7 @@ aliyun:
secretKey: PMXAuT3fiknhtM3YlR59SfW9BFXu62
namesrvAddr: http://MQ_INST_1003084411458690_Bcazi6ow.mq-internet-access.mq-internet.aliyuncs.com:80
# 不知道啥意思
protocolapi:
ribbon:
listOfServers: http://i100c.3322.org:7019
@ -81,7 +80,7 @@ api:
station:
queryEquipAuth: true
# 发短信用的阿里短信网关
aliSms:
product: Dysmsapi
domain: dysmsapi.aliyuncs.com

@ -1,9 +1,8 @@
spring:
datasource:
# url: jdbc:mysql://10.10.14.210:22066/ycharge?useUnicode=true&characterEncoding=UTF-8
url: jdbc:mysql://10.10.14.210:22066/yltcharge?useUnicode=true&characterEncoding=UTF-8
username: yltcharge
password: yltcharge
username: root
password: DsideaL147258369
driver-class-name: com.mysql.jdbc.Driver
druid:
stat-view-servlet:
@ -14,7 +13,7 @@ spring:
redis:
host: 10.10.14.210
port: 6381
port: 6379
password: ylt#redis
timeout: 0
pool:
@ -36,7 +35,7 @@ aliyun:
secretKey: PMXAuT3fiknhtM3YlR59SfW9BFXu62
namesrvAddr: http://MQ_INST_1003084411458690_Bcazi6ow.mq-internet-access.mq-internet.aliyuncs.com:80
# 不知道啥意思
protocolapi:
ribbon:
listOfServers: http://i100c.3322.org:7019
@ -81,7 +80,7 @@ api:
station:
queryEquipAuth: true
# 发短信用的阿里短信网关
aliSms:
product: Dysmsapi
domain: dysmsapi.aliyuncs.com

@ -22,7 +22,7 @@ spring:
redis:
host: 10.10.14.210
port: 6379
password: rzyc#redis
password: ylt#redis
timeout: 0
pool:
max-active: 8

@ -20,7 +20,7 @@ spring:
database: 0
host: 10.10.14.210
port: 6379
password: rzyc#redis
password: ylt#redis
timeout: 0
pool:
max-active: 8

@ -18,7 +18,7 @@ spring:
database: 0
host: 10.10.14.210
port: 6379
password: rzyc#redis
password: ylt#redis
timeout: 0
pool:
max-active: 8

@ -18,7 +18,7 @@ spring:
database: 0
host: 10.10.14.210
port: 6379
password: rzyc#redis
password: ylt#redis
timeout: 0
pool:
max-active: 8

@ -1,32 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.icharge.framework</groupId>
<artifactId>rough</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>ds_tools</artifactId>
<name>Archetype - ds_tools</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>4.0.3</version>
</dependency>
<!-- 数据库设计文档生成工具-->
<dependency>
<groupId>cn.smallbun.screw</groupId>
<artifactId>screw-core</artifactId>
<version>1.0.5</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.30</version>
</dependency>
</dependencies>
</project>

@ -1,81 +0,0 @@
import cn.smallbun.screw.core.Configuration;
import cn.smallbun.screw.core.engine.EngineConfig;
import cn.smallbun.screw.core.engine.EngineFileType;
import cn.smallbun.screw.core.engine.EngineTemplateType;
import cn.smallbun.screw.core.execute.DocumentationExecute;
import cn.smallbun.screw.core.process.ProcessConfig;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import javax.sql.DataSource;
import java.util.ArrayList;
public class GenerateMysqlDoc {
public static void main(String[] args) {
String fileOutputDir = "c:\\";
//数据源
HikariConfig hikariConfig = new HikariConfig();
hikariConfig.setDriverClassName("com.mysql.jdbc.Driver");
hikariConfig.setJdbcUrl("jdbc:mysql://10.10.14.210:22066/yltcharge?useUnicode=true&characterEncoding=UTF-8&useSSL=false");
hikariConfig.setUsername("root");
hikariConfig.setPassword("DsideaL147258369");
//设置可以获取tables remarks信息
hikariConfig.addDataSourceProperty("useInformationSchema", "true");
hikariConfig.setMinimumIdle(2);
hikariConfig.setMaximumPoolSize(5);
DataSource dataSource = new HikariDataSource(hikariConfig);
//生成配置
EngineConfig engineConfig = EngineConfig.builder()
//生成文件路径
.fileOutputDir(fileOutputDir)
//打开目录
.openOutputDir(true)
//文件类型
.fileType(EngineFileType.HTML)
//生成模板实现
.produceType(EngineTemplateType.freemarker)
//自定义文件名称
.fileName("驿来特数据库文档").build();
//忽略表
ArrayList<String> ignoreTableName = new ArrayList<>();
//ignoreTableName.add("test_user");
//ignoreTableName.add("test_group");
//忽略表前缀
ArrayList<String> ignorePrefix = new ArrayList<>();
//ignorePrefix.add("test_");
//忽略表后缀
ArrayList<String> ignoreSuffix = new ArrayList<>();
//ignoreSuffix.add("_test");
ProcessConfig processConfig = ProcessConfig.builder()
//指定生成逻辑、当存在指定表、指定表前缀、指定表后缀时,将生成指定表,其余表不生成、并跳过忽略表配置
//根据名称指定表生成
//.designatedTableName(new ArrayList<>())
//根据表前缀生成
.designatedTablePrefix(new ArrayList<>())
//根据表后缀生成
.designatedTableSuffix(new ArrayList<>())
//忽略表名
.ignoreTableName(ignoreTableName)
//忽略表前缀
.ignoreTablePrefix(ignorePrefix)
//忽略表后缀
.ignoreTableSuffix(ignoreSuffix).build();
//配置
Configuration config = Configuration.builder()
//版本
.version("1.0.0")
//描述
.description("驿来特数据库设计文档生成")
//数据源
.dataSource(dataSource)
//生成配置
.engineConfig(engineConfig)
//生成配置
.produceConfig(processConfig)
.build();
//执行生成
new DocumentationExecute(config).execute();
}
}

@ -1,140 +0,0 @@
import org.apache.rocketmq.client.consumer.DefaultLitePullConsumer;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.MessageQueueSelector;
import org.apache.rocketmq.client.producer.SendCallback;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.common.message.MessageQueue;
import org.apache.rocketmq.remoting.common.RemotingHelper;
import java.io.IOException;
import java.util.List;
//Java整合RocketMQ实现生产消费
//https://blog.csdn.net/qq_28314431/article/details/128452607
public class TestRocketMQ {
private final static String nameServer = "10.10.14.210:9876";
private final static String producerGroup = "my_group";
private final static String consumerGroup = "my_group";
private final static String topic = "topic-test";
//同步发送
public static void syncSend() {
try {
// 初始化一个producer并设置Producer group name
DefaultMQProducer producer = new DefaultMQProducer(producerGroup);
// 设置NameServer地址
producer.setNamesrvAddr(nameServer);
// 启动producer
producer.start();
// 创建一条消息并指定topic、tag、body等信息tag可以理解成标签对消息进行再归类RocketMQ可以在消费端对tag进行过滤
Message msg = new Message(topic, "tagA", "Hello RocketMQ".getBytes(RemotingHelper.DEFAULT_CHARSET));
// 利用producer进行发送并同步等待发送结果
SendResult sendResult = producer.send(msg, 10000);
System.out.printf("%s%n", sendResult);
// 一旦producer不再使用关闭producer
producer.shutdown();
} catch (Exception e) {
e.printStackTrace();
}
}
//异步发送
public static void asyncSend() throws IOException {
try {
// 初始化一个producer并设置Producer group name
DefaultMQProducer producer = new DefaultMQProducer(producerGroup);
// 设置NameServer地址
producer.setNamesrvAddr(nameServer);
// 启动producer
producer.start();
// 创建一条消息并指定topic、tag、body等信息tag可以理解成标签对消息进行再归类RocketMQ可以在消费端对tag进行过滤
Message msg = new Message(topic, "tagB", "Hello RocketMQ".getBytes(RemotingHelper.DEFAULT_CHARSET));
// 异步发送消息, 发送结果通过callback返回给客户端
producer.send(msg, new SendCallback() {
public void onSuccess(SendResult sendResult) {
System.out.printf("OK %s %n",
sendResult.getMsgId());
}
public void onException(Throwable e) {
System.out.printf("Exception %s %n", e);
e.printStackTrace();
}
}, 10000);
} catch (Exception e) {
e.printStackTrace();
}
System.in.read();
}
//顺序消息
public static void orderSend() {
try {
// 初始化一个producer并设置Producer group name
DefaultMQProducer producer = new DefaultMQProducer(producerGroup);
// 设置NameServer地址
producer.setNamesrvAddr(nameServer);
producer.setSendMsgTimeout(10000);
// 启动producer
producer.start();
String[] tags = new String[]{"TagA", "TagB", "TagC"};
for (int i = 0; i < 10; i++) {
int orderId = i % 10;
Message msg = new Message(topic, tags[i % tags.length], "KEY" + i, ("Hello RocketMQ " + i).getBytes(RemotingHelper.DEFAULT_CHARSET));
SendResult sendResult = producer.send(msg, new MessageQueueSelector() {
public MessageQueue select(List<MessageQueue> mqs, Message msg, Object arg) {
Integer id = (Integer) arg;
int index = id % mqs.size();
return mqs.get(index);
}
}, orderId);
System.out.printf("%s%n", sendResult);
}
} catch (Exception e) {
e.printStackTrace();
}
}
public static void consumerPull() {
try {
DefaultLitePullConsumer consumer = new DefaultLitePullConsumer(consumerGroup);
consumer.setNamesrvAddr(nameServer);
//关闭自动提交
consumer.setAutoCommit(false);
consumer.subscribe(topic, "*");
consumer.setPullBatchSize(20);
consumer.start();
while (true) {
List<MessageExt> messageExts = consumer.poll();
if (messageExts.size() > 0) {
String str = new String(messageExts.get(0).getBody());
System.out.println(str);
} else {
System.out.println("本轮没有找到需要消费的消息!");
}
consumer.commitSync();
}
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) throws IOException {
//同步发送
syncSend();
//异步发送
//asyncSend();
//顺序消息
//orderSend();
//拉消费
consumerPull();
}
}

@ -1,9 +0,0 @@
<archetype>
<id>ds_tools</id>
<sources>
<source>src/main/java/App.java</source>
</sources>
<testSources>
<source>src/test/java/AppTest.java</source>
</testSources>
</archetype>

@ -1,15 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>$com.icharge.framework</groupId>
<artifactId>$ds_tools</artifactId>
<version>$1.0.0</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

@ -1,13 +0,0 @@
package $com.icharge.framework;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}

@ -1,38 +0,0 @@
package $com.icharge.framework;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}

@ -98,10 +98,15 @@ db.createUser({ user: "admin", pwd: "DsideaL147258369", roles: [ { role: "userAd
# 重启 MongoDB 服务
mongo
db.updateUser('root',{pwd:'DsideaL147258369',roles:[{role:'root',db:'admin'}]})
db.updateUser('root',{pwd:'DsideaL147258369',roles:[{role:'root',db:'ycharge'}]})
```
# MongoDB4.28开启权限认证配置用户密码登录功能
> https://www.jb51.net/article/234416.htm
# 常用命令
```
@ -121,6 +126,31 @@ exit #退出MongoDB控制台
```
[root@hadoop-master bin]# mongo
use admin
#db.dropUser("root")
#db.dropUser("admin")
db.createUser({user:"root",pwd:"DsideaL147258369",roles:["root"]})
show users
use yltcharge
db.createUser({user:"yltcharge",pwd:"yltcharge",roles:[{role:"readWrite",db:"yltcharge"}]})
#认证模式(true代表开启认证登录false代表未开启认证登录)
auth=true
重启动
/usr/local/mongodb/bin/mongod -f /usr/local/mongodb/mongodb.conf
use admin
db.auth("root","DsideaL147258369")
use yltcharge
db.auth("yltcharge","yltcharge");
```

@ -53,7 +53,7 @@ repl-disable-tcp-nodelay no
replica-priority 100
requirepass rzyc#redis
requirepass ylt#redis
lazyfree-lazy-eviction no

Loading…
Cancel
Save