Closed Romic77 closed 3 years ago
Hello @rom1c77 , you can use module shenyu-examples-springcloud
and try it again.
Hello @rom1c77 , you can use module
shenyu-examples-springcloud
and try it again.
emm,shenyu-examples-springcloud
use eureka. our project want use nacos...
hello, do you add dependency to shenyu-admin? you can refer to Application Client Access Config
Hello @rom1c77 , you can use module
shenyu-examples-springcloud
and try it again.emm,
shenyu-examples-springcloud
use eureka. our project want use nacos...
That's fine, you can update module's dependency.
shenyu-admin application.yml
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
server:
port: 9095
address: 0.0.0.0
spring:
profiles:
active: mysql
thymeleaf:
cache: true
encoding: utf-8
enabled: true
prefix: classpath:/static/
suffix: .html
datasource:
url: jdbc:mysql://localhost:3306/shenyu?useUnicode=true&characterEncoding=utf-8&useSSL=false
username: root
password: root
driver-class-name: com.mysql.jdbc.Driver
mybatis:
config-location: classpath:/mybatis/mybatis-config.xml
mapper-locations: classpath:/mappers/*.xml
shenyu:
register:
registerType: nacos #http #zookeeper #etcd #nacos #consul
serverLists: localhost:8848 #localhost:2181 #http://localhost:2379 #localhost:8848
props:
sessionTimeout: 5000
connectionTimeout: 2000
checked: true
zombieCheckTimes: 5
scheduledTime: 10
nacosNameSpace: ShenyuRegisterCenter
database:
dialect: mysql
init_script: "META-INF/schema.sql"
init_enable: true
sync:
# websocket:
# enabled: true
# zookeeper:
# url: localhost:2181
# sessionTimeout: 5000
# connectionTimeout: 2000
# http:
# enabled: true
nacos:
url: localhost:8848
namespace: 1c10d748-af86-43b9-8265-75f487d20c6c
username:
password:
acm:
enabled: false
endpoint: acm.aliyun.com
namespace:
accessKey:
secretKey:
# etcd:
# url: http://localhost:2379
# consul:
# url: http://localhost:8500
aes:
secret:
key: 2095132720951327
iv: 6075877187097700
ldap:
enabled: false
url: ldap://xxxx:xxx
bind-dn: cn=xxx,dc=xxx,dc=xxx
password: xxxx
base-dn: ou=xxx,dc=xxx,dc=xxx
object-class: person
login-field: cn
jwt:
expired-seconds: 86400000
shiro:
white-list:
- /
- /favicon.*
- /static/**
- /index**
- /plugin
- /platform/**
- /websocket
- /configs/**
- /shenyu-client/**
- /error
- /actuator/health
- /swagger-ui.html
- /webjars/**
- /swagger-resources/**
- /v2/api-docs
- /csrf
swagger:
enable: true
logging:
level:
root: info
org.springframework.boot: info
org.apache.ibatis: info
org.apache.shenyu.bonuspoint: info
org.apache.shenyu.lottery: info
org.apache.shenyu: info
shenyu-bootstrap application-local.yml
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
server:
port: 9195
address: 0.0.0.0
spring:
main:
allow-bean-definition-overriding: true
application:
name: shenyu-bootstrap
cloud:
nacos:
discovery:
server-addr: localhost:8848
# security:
# oauth2:
# client:
# registration:
# <your client-registration-id>:
# client-id: <your client-id>
# client-secret: <your client-secret>
# provider:
# <your client-registration-id>:
# authorization-uri: <your authorization-uri>
# token-uri: <your access-token-uri>
# user-info-uri: <your user-info-uri>
# jwk-set-uri: <your jwk-set-uri>
management:
health:
defaults:
enabled: false
shenyu:
file:
enabled: true
cross:
enabled: true
dubbo:
parameter: multi
sync:
# websocket:
# urls: ws://localhost:9095/websocket
# zookeeper:
# url: localhost:2181
# sessionTimeout: 5000
# connectionTimeout: 2000
# http:
# url: http://localhost:9095
nacos:
url: localhost:8848
namespace: 1c10d748-af86-43b9-8265-75f487d20c6c
username:
password:
acm:
enabled: false
endpoint: acm.aliyun.com
namespace:
accessKey:
secretKey:
# etcd:
# url: http://localhost:2379
# consul:
# url: http://localhost:8500
# waitTime: 1000
# watchDelay: 1000
exclude:
enabled: false
paths:
- /favicon.ico
#eureka:
# client:
# serviceUrl:
# defaultZone: http://localhost:8761/eureka/
# instance:
# prefer-ip-address: true
logging:
level:
root: info
org.springframework.boot: info
org.apache.ibatis: info
org.apache.shenyu.bonuspoint: info
org.apache.shenyu.lottery: info
org.apache.shenyu: info
@midnight2104
git clone git@github.com:rom1c77/incubator-shenyu.git
& git clone git@github.com:rom1c77/study-shenyu.git
ashenyu-admin application.yml
ShenyuAdminBootstrap
& ShenyuAdminBootstrap
& StudyShenyuApplication
question:
SelectorList and RulesList hava data,but curl http://localhost:9195/springcloud/test/hello
unsuccessful.
help me resolve this problem,plz.
thanks for you very much
Hello @rom1c77 , you can use module
shenyu-examples-springcloud
and try it again.emm,
shenyu-examples-springcloud
use eureka. our project want use nacos...That's fine, you can update module's dependency.
It's the same problem. Please, I was desperate .
Hello @rom1c77 , I try it successfully with shenyu-examples-springcloud
module.
Maybe you forgot to open the plugin springCloud
in Plugin
.
Hello @rom1c77 , I try it successfully with
shenyu-examples-springcloud
module. Maybe you forgot to open the pluginspringCloud
inPlugin
.
i'm sure open this
Hello @rom1c77 , I try it successfully with
shenyu-examples-springcloud
module. Maybe you forgot to open the pluginspringCloud
inPlugin
.
pls use websocket for data sync, it's recommend Data Synchronization Config
springCloud plugin
.org.apache.shenyu.plugin.springcloud.SpringCloudPlugin
.
hello, I use nacso as register cneter that it is successfull. here is my config:
jdk : 14 shenyu: 2.4.0 nacos: 2.0.3
shneyu-admin:
<dependency>
<groupId>org.apache.shenyu</groupId>
<artifactId>shenyu-register-server-nacos</artifactId>
<version>${project.version}</version>
</dependency>
server:
port: 9095
address: 0.0.0.0
spring:
profiles:
# active: h2
thymeleaf:
cache: true
encoding: utf-8
enabled: true
prefix: classpath:/static/
suffix: .html
datasource:
url: jdbc:mysql://localhost:3306/shenyu?useUnicode=true&characterEncoding=utf-8&useSSL=false
username: root
password:
driver-class-name: com.mysql.jdbc.Driver
mybatis:
config-location: classpath:/mybatis/mybatis-config.xml
mapper-locations: classpath:/mappers/*.xml
shenyu:
register:
registerType: nacos #http #http #zookeeper #etcd #nacos #consul
serverLists: localhost:8848 #localhost:2181 #http://localhost:2379 #localhost:8848
props:
sessionTimeout: 5000
connectionTimeout: 2000
checked: true
zombieCheckTimes: 5
scheduledTime: 10
nacosNameSpace: ShenyuRegisterCenter
database:
dialect: mysql
init_script: "META-INF/schema.sql"
init_enable: true
sync:
websocket:
enabled: true
# zookeeper:
# url: localhost:2181
# sessionTimeout: 5000
# connectionTimeout: 2000
# http:
# enabled: true
# nacos:
# url: localhost:8848
# namespace: 1c10d748-af86-43b9-8265-75f487d20c6c
# username:
# password:
# acm:
# enabled: false
# endpoint: acm.aliyun.com
# namespace:
# accessKey:
# secretKey:
# etcd:
# url: http://localhost:2379
# consul:
# url: http://localhost:8500
aes:
secret:
key: 2095132720951327
iv: 6075877187097700
ldap:
enabled: false
url: ldap://xxxx:xxx
bind-dn: cn=xxx,dc=xxx,dc=xxx
password: xxxx
base-dn: ou=xxx,dc=xxx,dc=xxx
object-class: person
login-field: cn
jwt:
key: 2095132720951327
shiro:
white-list:
- /
- /favicon.*
- /static/**
- /index**
- /plugin
- /platform/**
- /websocket
- /configs/**
- /shenyu-client/**
- /error
- /actuator/health
- /swagger-ui.html
- /webjars/**
- /swagger-resources/**
- /v2/api-docs
- /csrf
swagger:
enable: true
logging:
level:
root: info
org.springframework.boot: info
org.apache.ibatis: info
org.apache.shenyu.bonuspoint: info
org.apache.shenyu.lottery: info
org.apache.shenyu: info
shenyu-bootstrap:
server:
port: 9195
address: 0.0.0.0
spring:
main:
allow-bean-definition-overriding: true
application:
name: shenyu-bootstrap
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8848
# security:
# oauth2:
# client:
# registration:
# <your client-registration-id>:
# client-id: <your client-id>
# client-secret: <your client-secret>
# provider:
# <your client-registration-id>:
# authorization-uri: <your authorization-uri>
# token-uri: <your access-token-uri>
# user-info-uri: <your user-info-uri>
# jwk-set-uri: <your jwk-set-uri>
management:
health:
defaults:
enabled: false
shenyu:
file:
enabled: true
cross:
enabled: true
dubbo :
parameter: multi
sync:
websocket :
urls: ws://localhost:9095/websocket
# zookeeper:
# url: localhost:2181
# sessionTimeout: 5000
# connectionTimeout: 2000
# http:
# url : http://localhost:9095
# nacos:
# url: localhost:8848
# namespace: 1c10d748-af86-43b9-8265-75f487d20c6c
# username:
# password:
# acm:
# enabled: false
# endpoint: acm.aliyun.com
# namespace:
# accessKey:
# secretKey:
# etcd:
# url: http://localhost:2379
# consul:
# url: http://localhost:8500
# waitTime: 1000
# watchDelay: 1000
exclude:
enabled: false
paths:
- /favicon.ico
#eureka:
# client:
# serviceUrl:
# defaultZone: http://localhost:8761/eureka/
# instance:
# prefer-ip-address: true
logging:
level:
root: info
org.springframework.boot: info
org.apache.ibatis: info
org.apache.shenyu.bonuspoint: info
org.apache.shenyu.lottery: info
org.apache.shenyu: info
<!--shenyu springCloud plugin start-->
<dependency>
<groupId>org.apache.shenyu</groupId>
<artifactId>shenyu-spring-boot-starter-plugin-springcloud</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shenyu</groupId>
<artifactId>shenyu-spring-boot-starter-plugin-httpclient</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-commons</artifactId>
<version>2.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
<version>2.2.0.RELEASE</version>
</dependency>
<!-- springCloud if you config register center is nacos please dependency this-->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
<version>2.1.0.RELEASE</version>
</dependency>
shenyu-example-springcloud
server:
port: 8884
address: 0.0.0.0
spring:
application:
name: springCloud-test
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8848
springCloud-test:
ribbon.NFLoadBalancerRuleClassName: com.netflix.loadbalancer.RandomRule
#eureka:
# client:
# serviceUrl:
# defaultZone: http://localhost:8761/eureka/
# instance:
# prefer-ip-address: true
shenyu:
client:
registerType: nacos #zookeeper #etcd #nacos #consul
serverLists: localhost:8848 #localhost:2181 #http://localhost:2379 #localhost:8848
props:
contextPath: /springcloud
port: 8884
nacosNameSpace: ShenyuRegisterCenter
logging:
level:
root: info
org.apache.shenyu: debug
<dependency>
<groupId>org.apache.shenyu</groupId>
<artifactId>shenyu-spring-boot-starter-client-springcloud</artifactId>
<version>${shenyu.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
<version>2.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.shenyu</groupId>
<artifactId>shenyu-register-client-nacos</artifactId>
<version>${shenyu.version}</version>
</dependency>
The above configuration can be successfully started and registered. Then you need to open springcloud plugin in shenyu background sysytem, you can access.
http://localhost:9195/springcloud/order/findById?id=100 { "id": "100", "name": "hello world spring cloud findById" }
@midnight2104 @KevinClair thanks
mysql dirty data cause serviceId = null.
debug find this and drop shenyu schema.
successfully
It's my fault
question: git clone study-shenyu
applicaiton.yml
pom.yml
controller
postman
What's the problem?