make local version code same as kubernetes version code

pull/2828/head
黄sir 2 years ago
parent 9b1f31215b
commit 7ed0413726

@ -1,3 +1,3 @@
spring:
datasource:
url: jdbc:mysql://localhost:3306/integrated_account?useSSL=false&characterEncoding=utf8
url: jdbc:mysql://integrated-mysql:3306/integrated_account?useSSL=false&characterEncoding=utf8

@ -1,6 +1,6 @@
spring:
datasource:
url: jdbc:mysql://localhost:3306/integrated_praise?useSSL=false&characterEncoding=utf8
url: jdbc:mysql://integrated-mysql:3306/integrated_praise?useSSL=false&characterEncoding=utf8
cloud:
stream:
bindings:
@ -10,7 +10,7 @@ spring:
group: praise-consumer-group-PRAISE-TOPIC-01
rocketmq:
binder:
name-server: localhost:9876
name-server: rocketmq:9876
bindings:
praise-input:
consumer:

@ -1,3 +1,3 @@
spring:
datasource:
url: jdbc:mysql://localhost:3306/integrated_order?useSSL=false&characterEncoding=utf8
url: jdbc:mysql://integrated-mysql:3306/integrated_order?useSSL=false&characterEncoding=utf8

@ -7,7 +7,7 @@ spring:
content-type: application/json
rocketmq:
binder:
name-server: localhost:9876
name-server: rocketmq:9876
bindings:
praise-output:
producer:

@ -1,3 +1,3 @@
spring:
datasource:
url: jdbc:mysql://localhost:3306/integrated_storage?useSSL=false&characterEncoding=utf8
url: jdbc:mysql://integrated-mysql:3306/integrated_storage?useSSL=false&characterEncoding=utf8

@ -7,9 +7,9 @@ metadata:
spec:
type: NodePort
ports:
- port: 8010
- port: 30010
name: server
targetPort: 8010
targetPort: 30010
nodePort: 30010
selector:
app: integrated-gateway
@ -35,7 +35,7 @@ spec:
imagePullPolicy: Always
ports:
- name: http-port
containerPort: 8010
containerPort: 30010
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:

@ -43,7 +43,7 @@ spec:
spec:
containers:
- name: integrated-mysql
image: {{ .Values.image.repository }}integrated-mysql
image: "{{ .Values.image.repository }}integrated-mysql"
imagePullPolicy: Always
env:
- name: MYSQL_ROOT_PASSWORD

@ -15,7 +15,7 @@ spec:
spec:
containers:
- name: mysql
image: {{ .Values.image.repository }}nacos-mysql
image: trevorlink/nacos-mysql
ports:
- containerPort: 3306
env:

@ -7,12 +7,12 @@ spring:
cloud:
nacos:
discovery:
server-addr: localhost:8848
server-addr: nacos-server:8848
config:
server-addr: localhost:8848
server-addr: nacos-server:8848
file-extension: yaml
group: integrated-example
shared-dataids: datasorce-config.yaml
shared-dataids: datasource-config.yaml
seata:
application-id: ${spring.application.name}
@ -21,4 +21,4 @@ seata:
vgroup-mapping:
integrated-account-group: default
grouplist:
default: localhost:8091
default: seata-server:8091

@ -34,57 +34,66 @@
var userId = $("#userId").val();
var commodityCode = $("#commodityCode").val();
$.ajax({
url: "http://localhost:8010/storage/",
url: "http://gateway-service:30010/storage/",
type: "get",
dataType: "json",
data: "commodityCode=" + commodityCode,
async:false,
success: function (res) {
$('#orderResultSection').append(`<p> 执行分布式业务前商品库存: ${res.data} </p>`);
$('#orderResultSection').append(`<p> [${getDateTime()}] 执行分布式业务前商品库存: ${res.data} </p>`);
}
});
$.ajax({
url: "http://localhost:8010/account/",
url: "http://gateway-service:30010/account/",
type: "get",
dataType: "json",
data: "userId=" + userId,
async:false,
success: function (res) {
$('#orderResultSection').append(`<p> 执行分布式业务前账户余额: ${res.data}</p>`);
$('#orderResultSection').append(`<p> [${getDateTime()}] 执行分布式业务前账户余额: ${res.data}</p>`);
}
});
$.ajax({
type: "POST",
url: "http://localhost:8010/order/create",
url: "http://gateway-service:30010/order/create",
data: $('#orderForm').serialize(),
dataType: 'json',
async:false,
success: function (res) {
$('#orderResultSection').append(`<p> ${res.message} </p>`);
$('#orderResultSection').append(`<p> [${getDateTime()}] ${res.message} </p>`);
$.ajax({
url: "http://localhost:8010/storage/",
url: "http://gateway-service:30010/storage/",
type: "get",
dataType: "json",
data: "commodityCode=" + commodityCode,
async:false,
success: function (res) {
$('#orderResultSection').append(`<p> 执行分布式业务后商品库存: ${res.data}</p>`);
$('#orderResultSection').append(`<p> [${getDateTime()}] 执行分布式业务后商品库存: ${res.data}</p>`);
}
});
$.ajax({
url: "http://localhost:8010/account/",
url: "http://gateway-service:30010/account/",
type: "get",
dataType: "json",
data: "userId=" + userId,
async:false,
success: function (res) {
$('#orderResultSection').append(`<p> 执行分布式业务后账户余额: ${res.data}</p>`);
$('#orderResultSection').append(`<p> [${getDateTime()}] 执行分布式业务后账户余额: ${res.data}</p>`);
}
});
}
});
});
const getDateTime = () => {
const myDate = new Date;
const year = myDate.getFullYear();
const month = myDate.getMonth() + 1;
const date = myDate.getDate();
const hours = myDate.getHours();
const minutes = myDate.getMinutes();
const seconds = myDate.getSeconds();
return `${year}-${month}-${date} ${hours}:${minutes}:${seconds}`;
};
</script>
</body>

@ -31,13 +31,13 @@
function queryRes() {
$.ajax({
url: "http://localhost:8010/praise/query",
url: "http://gateway-service:30010/praise/query",
type: "get",
dataType: "json",
data: "itemId=" + $('#itemId').val(),
success: function (res) {
console.log("准备查询此时count=" + count)
$('#rocketmqResultSection').append(`<p> 点赞数: ${res} </p>`);
$('#rocketmqResultSection').append(`<p> [${getDateTime()}] 点赞数: ${res} </p>`);
}
})
}
@ -48,7 +48,7 @@
for (let i = 0; i < 1000; i++) {
$.ajax({
url: "http://localhost:8010/praise/rocketmq",
url: "http://gateway-service:30010/praise/rocketmq",
type: "get",
dataType: "json",
data: "itemId=" + itemId,

@ -23,40 +23,40 @@
$('#sentinelResultSection').empty();
var itemId = $('#itemId').val();
$.ajax({
url: "http://localhost:8010/praise/query",
url: "http://gateway-service:30010/praise/query",
type: "get",
dataType: "json",
data: "itemId=" + itemId,
async: false,
success: function (res) {
$('#sentinelResultSection').append(`<p> 点赞前的点赞数: ${res} </p>`);
$('#sentinelResultSection').append(`<p> [${getDateTime()}] 点赞前的点赞数: ${res} </p>`);
}
});
for (let i = 0; i < 10; i++) {
$.ajax({
url: "http://localhost:8010/praise/sentinel",
url: "http://gateway-service:30010/praise/sentinel",
type: "get",
dataType: "json",
data: "itemId=" + itemId,
success: function (res) {
console.log(res)
$('#sentinelResultSection').append(`<p> ${getDateTime()}: ${res}</p>`);
$('#sentinelResultSection').append(`<p> [${getDateTime()}] ${getDateTime()}: ${res}</p>`);
},
error: function (res) {
console.log(res)
$('#sentinelResultSection').append(`<p> ${getDateTime()}: 请求失败,接口被限流 </p>`);
$('#sentinelResultSection').append(`<p> [${getDateTime()}]: 请求失败,接口被限流 </p>`);
}
});
}
timeoutid = setTimeout(queryRes, 1000);
function queryRes() {
$.ajax({
url: "http://localhost:8010/praise/query",
url: "http://gateway-service:30010/praise/query",
type: "get",
dataType: "json",
data: "itemId=" + $('#itemId').val(),
success: function (res) {
$('#sentinelResultSection').append(`<p> 点赞后的点赞数: ${res} </p>`);
$('#sentinelResultSection').append(`<p> [${getDateTime()}] 点赞后的点赞数: ${res} </p>`);
}
})
}

@ -1,13 +1,13 @@
server:
port: 8010
port: 30010
spring:
application:
name: integrated-gateway
cloud:
nacos:
discovery:
server-addr: localhost:8848
server-addr: nacos-server:8848
config:
server-addr: localhost:8848
server-addr: nacos-server:8848
file-extension: yaml
group: integrated-example

@ -7,12 +7,12 @@ spring:
cloud:
nacos:
discovery:
server-addr: localhost:8848
server-addr: nacos-server:8848
config:
server-addr: localhost:8848
server-addr: nacos-server:8848
file-extension: yaml
group: integrated-example
shared-dataids: datasorce-config.yaml
shared-dataids: datasource-config.yaml
seata:
application-id: ${spring.application.name}
@ -21,4 +21,4 @@ seata:
vgroup-mapping:
integrated-order-group: default
grouplist:
default: localhost:8091
default: seata-server:8091

@ -5,11 +5,11 @@ spring:
nacos:
config:
file-extension: yaml
server-addr: localhost:8848
server-addr: nacos-server:8848
shared-configs[0]:
dataId: datasorce-config.yaml
dataId: datasource-config.yaml
group: integrated-example
discovery:
server-addr: localhost:8848
server-addr: nacos-server:8848
server:
port: 8014

@ -5,7 +5,9 @@ spring:
nacos:
config:
file-extension: yaml
server-addr: localhost:8848
server-addr: nacos-server:8848
group: integrated-example
discovery:
server-addr: nacos-server:8848
server:
port: 8015

@ -7,12 +7,12 @@ spring:
cloud:
nacos:
discovery:
server-addr: localhost:8848
server-addr: nacos-server:8848
config:
server-addr: localhost:8848
server-addr: nacos-server:8848
file-extension: yaml
group: integrated-example
shared-dataids: datasorce-config.yaml
shared-dataids: datasource-config.yaml
seata:
application-id: ${spring.application.name}
@ -21,4 +21,4 @@ seata:
vgroup-mapping:
integrated-storage-group: default
grouplist:
default: localhost:8091
default: seata-server:8091

@ -1,5 +1,4 @@
#!/bin/sh
groupId="integrated-example"
echo "Nacos auto config started"
datasourceConfig=$(cat ../config/datasource-config.yaml)
storageConfig=$(cat ../config/integrated-storage.yaml)
@ -8,11 +7,12 @@ orderConfig=$(cat ../config/integrated-order.yaml)
gatewayConfig=$(cat ../config/integrated-gateway.yaml)
providerConfig=$(cat ../config/integrated-provider.yaml)
consumerConfig=$(cat ../config/integrated-consumer.yaml)
curl -X POST "127.0.0.1:8848/nacos/v1/cs/configs" -d "dataId=datasource-config.yaml&group=${groupId}&content=${datasourceConfig}"
curl -X POST "127.0.0.1:8848/nacos/v1/cs/configs" -d "dataId=integrated-storage.yaml&group=${groupId}&content=${storageConfig}"
curl -X POST "127.0.0.1:8848/nacos/v1/cs/configs" -d "dataId=integrated-account.yaml&group=${groupId}&content=${accountConfig}"
curl -X POST "127.0.0.1:8848/nacos/v1/cs/configs" -d "dataId=integrated-order.yaml&group=${groupId}&content=${orderConfig}"
curl -X POST "127.0.0.1:8848/nacos/v1/cs/configs" -d "dataId=integrated-gateway.yaml&group=${groupId}&content=${gatewayConfig}"
curl -X POST "127.0.0.1:8848/nacos/v1/cs/configs" -d "dataId=integrated-provider.yaml&group=${groupId}&content=${providerConfig}"
curl -X POST "127.0.0.1:8848/nacos/v1/cs/configs" -d "dataId=integrated-consumer.yaml&group=${groupId}&content=${consumerConfig}"
groupId="integrated-example"
curl -X POST "nacos-server:8848/nacos/v1/cs/configs" -d "dataId=datasource-config.yaml&group=DEFAULT_GROUP&content=${datasourceConfig}"
curl -X POST "nacos-server:8848/nacos/v1/cs/configs" -d "dataId=integrated-storage.yaml&group=${groupId}&content=${storageConfig}"
curl -X POST "nacos-server:8848/nacos/v1/cs/configs" -d "dataId=integrated-account.yaml&group=${groupId}&content=${accountConfig}"
curl -X POST "nacos-server:8848/nacos/v1/cs/configs" -d "dataId=integrated-order.yaml&group=${groupId}&content=${orderConfig}"
curl -X POST "nacos-server:8848/nacos/v1/cs/configs" -d "dataId=integrated-gateway.yaml&group=${groupId}&content=${gatewayConfig}"
curl -X POST "nacos-server:8848/nacos/v1/cs/configs" -d "dataId=integrated-provider.yaml&group=${groupId}&content=${providerConfig}"
curl -X POST "nacos-server:8848/nacos/v1/cs/configs" -d "dataId=integrated-consumer.yaml&group=${groupId}&content=${consumerConfig}"
echo "Nacos config pushed successfully finished"
Loading…
Cancel
Save