Closed HeiXXwowoTou closed 1 year ago
这些是我相关模块的配置文件 `shenyu-admin模块: 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 mvc: pathmatch: matching-strategy: ant_path_matcher jackson: time-zone: GMT+8 # GMT , Asia/Shanghai
management: endpoints: web: exposure: include:
mybatis: config-location: classpath:/mybatis/mybatis-config.xml mapper-locations: classpath:/mappers/*.xml
shenyu: register: registerType: nacos #http #zookeeper #etcd #nacos #consul serverLists: 127.0.0.1:8848 #localhost:2181 #http://localhost:2379 #localhost:8848 props: sessionTimeout: 5000 connectionTimeout: 2000 checked: true zombieCheckThreads: 10 zombieCheckTimes: 5 scheduledTime: 10 nacosNameSpace: test sync: nacos: url: 127.0.0.1:8848 namespace: test 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:
shenyu-bootstrap模块:
server: port: 9195 address: 0.0.0.0
spring: main: allow-bean-definition-overriding: true application: name: shenyu-bootstrap codec: max-in-memory-size: 2MB cloud: discovery: enabled: true nacos: discovery: server-addr: 127.0.0.1:8848 # Spring Cloud Alibaba Dubbo use this. enabled: true namespace: test instance: enabled: true registerType: nacos serverLists: 127.0.0.1:8848 #配置成你的 zookeeper 地址,集群环境请使用(,)分隔 props: sessionTimeout: 3000 #可选,默认3000 connectionTimeout: 3000 #可选,默认3000
management: health: redis: enabled: false endpoint: health: enabled: true show-details: always endpoints: web: exposure: include: "*" # or health,info
shenyu: selectorMatchCache: cache: enabled: true initialCapacity: 10000 # initial capacity in cache maximumSize: 10000 # max size in cache trie: enabled: false cacheSize: 128 # the number of plug-ins matchMode: antPathMatch ruleMatchCache: cache: enabled: true initialCapacity: 10000 # initial capacity in cache maximumSize: 65536 # max size in cache trie: enabled: false cacheSize: 1024 # the number of selectors matchMode: antPathMatch netty: http:
webServerFactoryEnabled: true
selectCount: 1
workerCount: 8
accessLog: false
serverSocketChannel:
soRcvBuf: 87380
soBackLog: 128
soReuseAddr: false
connectTimeoutMillis: 10000
writeBufferHighWaterMark: 65536
writeBufferLowWaterMark: 32768
writeSpinCount: 16
autoRead: false
allocType: "pooled"
messageSizeEstimator: 8
singleEventExecutorPerGroup: true
socketChannel:
soKeepAlive: false
soReuseAddr: false
soLinger: -1
tcpNoDelay: true
soRcvBuf: 87380
soSndBuf: 16384
ipTos: 0
allowHalfClosure: false
connectTimeoutMillis: 10000
writeBufferHighWaterMark: 65536
writeBufferLowWaterMark: 32768
writeSpinCount: 16
autoRead: false
allocType: "pooled"
messageSizeEstimator: 8
singleEventExecutorPerGroup: true
sni:
enabled: false
mod: k8s #manul
defaultK8sSecretNamespace: shenyu-ingress
defaultK8sSecretName: default-cert
register: enabled: false registerType: zookeeper #etcd #consul serverLists: localhost:2181 #http://localhost:2379 #localhost:8848 props: cross: enabled: true allowedHeaders: allowedMethods: "" allowedAnyOrigin: true # the same of Access-Control-Allow-Origin: "" allowedExpose: "" maxAge: "18000" allowCredentials: true
switchConfig: local: true collapseSlashes: false file: enabled: true maxSize : 10 sync: nacos: url: 127.0.0.1:8848 namespace: test exclude: enabled: false paths:
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-examples-apache-dubbo-service-annotation模块:
server: port: 8011 address: 0.0.0.0 servlet: context-path: / spring: main: allow-bean-definition-overriding: true
shenyu: register: registerType: nacos #zookeeper #etcd #nacos #consul serverLists: 127.0.0.1:8848 #http://localhost:9095 #localhost:2181 #http://localhost:2379 #localhost:8848 props: username: nacos password: 4PBZ8fjEnZDhQY nacosNameSpace: test client: dubbo: props: contextPath: /dubbo appName: dubbo
dubbo: application: name: test-dubbo-service registry: address: nacos://127.0.0.1:8848?namespace=test protocol: name: dubbo port: 20888 scan: base-packages: org.apache.shenyu.examples.apache.dubbo.service.annotation.impl`
make sure dubbo plugin enabled and dubbo plugin selector and rule must match /dubbo/demo/findAll
我确认我已经启用dubbo插件以及启用了dubbo选择器和/dubbo/demo/findAll
的规则,昨天我也不太清楚为什么会出现 divide:Can not find selector
,今天我在调试时出现了 {"code": -102,"message": "dubbo:Rule not found!"}
提示,我经过debug调试后发现可能是,我在admin模块在运行时,重新运行了数据库初始化的脚本,或许是admin模块没有重启,导致获取的选择器在库中没有找到,我重启了admin模块之后这个问题也解决了。
目前我也不太清楚出现divide:Can not find selector
的原因 以及如何复现
firstly, start shenyu admin, and start shenyu-bootstrap and service.
Question
你好,我使用的是目前master分支的代码进行编译测试运行,我按照一篇博客的方法ShenYu快速开始,进行的快速配置,但是在最后一步验证网关是否成功时出现了问题: 请求接口:http://localhost:9195/dubbo/demo/findAll
相应内容:{"code":-107,"message":"divide:Can not find selector, please check your configuration!"}
同时在bootstrap模块的日志中显示错误:2023-05-23 22:57:12 [shenyu-netty-nio-2] ERROR org.apache.shenyu.plugin.api.utils.WebFluxResultUtils - can not match selector data: divide
我查看了Issue中相关的提问,没有找到合适的解决方法,可以解答一下吗