Giter Site home page Giter Site logo

nacos-group / nacos-plugin Goto Github PK

View Code? Open in Web Editor NEW
69.0 12.0 48.0 110 KB

A collection of Nacos plug-ins, providing Nacos with pluggable plug-in capabilities, support for user customization and high scalability

License: Apache License 2.0

Java 81.74% PLpgSQL 15.77% TSQL 2.49%
nacos plugin

nacos-plugin's Introduction

nacos-plugin

A collection of Nacos plug-ins that provide pluggable plug-in capabilities for Nacos and support user customization and high scalability

nacos-plugin's People

Contributors

godhth avatar komachision avatar kricyi avatar li-xiao-shuang avatar lyf712 avatar onewe avatar uselessbaozi avatar wuchubuzai2018 avatar xiaoyonghaoe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nacos-plugin's Issues

请问编写完插件后,如何打到nacos-server中

我这边支持了一下Sqlserver数据源,完成了plugin的编写,是需要将实现复制到nacos/plugin项目中,还是有其他方式?官网说明中是先编译nacos本体,然后install插件就没了。请大佬们赐教~

对于兼容mysql语法的数据库不需要这些插件

大部分兼容mysql语法的信创数据库不需要这些插件,只要吧驱动包放到plugins目录,然后正确配置驱动类就好了很简单。
例如nacos-dm-datasource-plugin-ext的实现,既然全都是空实现继承 Base*的,那么说明完全没有必要存在这个插件,除非是有不兼容的语法才需要定制插件。

我们只需要把驱动包放入plugins目录,然后配置如下

spring.datasource.platform=mysql
db.pool.config.driverClassName=dm.jdbc.driver.DmDriver
db.url.0=jdbc:dm://[ip]:[port]

Nacos-2.3.2新增角色资源关联时报错bad SQL grammar [INSERT INTO permissions (role, resource, action) VALUES (?, ?, ?)]; nested exception is java.sql.SQLSyntaxErrorException: ORA-01747: user.table.column, table.column 或列说明无效

caused: PreparedStatementCallback; bad SQL grammar [INSERT INTO permissions (role, resource, action) VALUES (?, ?, ?)]; nested exception is java.sql.SQLSyntaxErrorException: ORA-01747: user.table.column, table.column 或列说明无效 ;caused: ORA-01747: user.table.column, table.column 或列说明无效 ;caused: ORA-01747: user.table.column, table.column 或列说明无效 ;

使用的oracle作为数据源,新增角色资源关联时报错,看了一下代码,貌似Nacos官网还没开放这个Mapper的重写适配,关于permissions表的查询和新增的sql都是在ExternalPermissionPersistServiceImpl类里整的硬编码,刚好permissions表中的resource字段,是oracle数据库里的关键字了,使用的oracle版本为19c

nacos-encryption-plugin

nacos-encryption-plugin模块是不是在2.0.4的版本中还未发布,目前依赖不到

nacos 2.3.0 用自定义数据库插件扩展,登录时提示找不到用户

使用如下配置,在登录时提示找不到用户,org.springframework.security.core.userdetails.UsernameNotFoundException: User nacos not found:
spring.sql.init.platform=dm
db.num=1
db.url.0=jdbc:dm://127.0.0.1:5236/NACOS?schema=NACOS&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8
db.user.0=SYSDBA
db.password.0=123456
db.pool.config.driverClassName=dm.jdbc.driver.DmDriver

调式发现 nacos-default-auth-plugin 模块下出现出错,没有对应分页实现,如果把spring.sql.init.platform=mysql就是好的,请问这块如何扩展
/**
* Get handler adapter.
*
* @param dataSourceType data source type.
* @return
*/
protected PageHandlerAdapter getHandlerAdapter(String dataSourceType) {
List handlerAdapters = PageHandlerAdapterFactory.getInstance().getHandlerAdapters();
for (PageHandlerAdapter adapter : handlerAdapters) {
if (adapter.supports(dataSourceType)) {
return adapter;
}

    }
    
    return PageHandlerAdapterFactory.getInstance().getHandlerAdapterMap()
            .get(DefaultPageHandlerAdapter.class.getName());
}

[PG数据库适配插件]不打包数据库驱动,支持更多兼容PG的国产数据库

目前很多国产数据库都可以兼容PG的SQL,PG数据库适配插件理论上是都可以支持的,但是在运行时需要使用厂商自己的jdbc包(典型问题就是数据库认证方式不兼容)。

所以目前的插件最好不要打包JDBC驱动,因为有些国产数据库的JDBC驱动和PG的驱动同名,包里面的类名也有同名。从外部加载JDBC驱动是一个比较好的选择,实际是使用也不会太麻烦,因为我们本身就要修改nacos配置,使用loader机制加载插件,再多放一个JDBC驱动包完全不是问题。

在创建jar包时的注意事项

当我准备把刚刚完成的SQL Server支持准备打包时,发生了找不到jar包的错误。经过排查后,总结一下方法

  1. 根据Nacos的仓库https://github.com/alibaba/nacos项目的版本更新父项目alibaba-nacos.version的值。如目前的值为2.4.0-SNAPSHOT
  2. 可能发生无法找到jar包com.dameng:DmJdbcDriver18:jar:8.1.2.114,这可能是因为你的电脑上没有该jar包。这时可以根据注释的提示修改版本为8.1.2.79,并将达梦依赖的systemPathscope的标签删除,以便从在线仓库中下载。

Postgres 插件方式运行 Failed to bind properties under 'db.pool.config' to com.zaxxer.hikari.HikariDataSource

版本: nacos-server v2.2.1

参考 https://github.com/wuchubuzai2018/nacos-datasource-extend-plugins
测试windows/linux 基于官方的pg配置都可以使用, 但是制作成的nacos镜像始终在报错,配置如下

nacos.core.auth.system.type=nacos
nacos.core.auth.enabled=true 
nacos.core.auth.plugin.nacos.token.secret.key=SecretKey012345678901234567890123456789012345678901234567890123456789
nacos.core.auth.server.identity.key=test
nacos.core.auth.server.identity.value=test

spring.datasource.platform=postgresql
db.url.0=jdbc:postgresql://xxx:xxx/xxx?tcpKeepAlive=true&reWriteBatchedInserts=true&ApplicationName=nacos_java
db.num=1
db.user=postgres
db.password=123456
db.pool.config.driverClassName=org.postgresql.Driver
2023-09-14 03:24:22,306 ERROR

***************************
APPLICATION FAILED TO START
***************************

Description:


Failed to bind properties under 'db.pool.config' to com.zaxxer.hikari.HikariDataSource:

    Property: db.pool.config.driver-class-name
    Value: "org.postgresql.Driver"
    Origin: InputStream resource [resource loaded through InputStream] - 284:32
    Reason: java.lang.RuntimeException: Failed to load driver class org.postgresql.Driver in either of HikariConfig class loader or Thread context classloader

Action:

Update your application's configuration


2023-09-14 03:24:22,308 WARN [ThreadPoolManager] Start destroying ThreadPool

2023-09-14 03:24:22,308 WARN [ThreadPoolManager] Destruction of the end

image
image
image
image

参考 issues 做过一些排查发现没用 wuchubuzai2018/nacos-datasource-extend-plugins#2
目前是否有相关的解决方案?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.