Closed wangxiaoerYah closed 1 year ago
/good-first-issue /kind feature
@ruibaby: This request has been marked as suitable for new contributors.
Please ensure the request meets the requirements listed here.
If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-good-first-issue
command.
非常棒的建议。不过可以提供更多的文档链接,让大家更容易去完成这个改进。
非常棒的建议。不过可以提供更多的文档链接,让大家更容易去完成这个改进。
stackoverflow 提到mysql的jdbc驱动好像不支持unix。 但是mariadb的jdbc驱动同时兼容mysql/mariadb 支持unix连接 _
The JDBC Driver from the MariaDB project supports Unix domain sockets while remaining compatible with the MySQL Connector/J JDBC driver. Example jdbc url for the MariaDB driver is: jdbc:mariadb://localhost:3306/revmgt?localSocket=/var/run/mysqld/mysqld.sock
Worth noting that this requires including the JNA library as the MariaDB driver uses domain sockets via JNA internally. I saw speed improvements for CPU bound java processes when using the unix domain sockets. I believe this was largely from the offload of work from the java process to native code freeing up CPU cycles for the already CPU bottle necked java process.
_
使用unix sock需要服务器和数据库在一起,貌似这种情况直接使用H2好一点? 我查了下有个junixsocket包,实现了用以jdbc连接unixsock的socketfactory及其他一些支持。不过目前好像没有springboot默认连接池hikaricp有关支持unixsocket的相关资料。如果简单的配置个使用unixsocket的数据源倒是可以正常使用,但是就失去了使用连接池的优势了。不知道还有没有用以实现这个能够参考的相关资料。
你当前使用的版本
1.5.2
描述一下此特性
数据库直接通过unix sock连接, 减少回环连接, 数据库也可以only listen sock, 增加安全性
附加信息
No response