Mysql分布式中间件,比Mycat强悍的DBLE
安装
dble基于mycat,mycat又基于java,所以centos7下需要安装java
yum install java [root@wtCentos7 src]# java -version openjdk version "1.8.0_312" OpenJDK Runtime Environment (build 1.8.0_312-b07) OpenJDK 64-Bit Server VM (build 25.312-b07, mixed mode)
dble运行依赖环境变量,还需要配置java环境变量
[root@wtCentos7 src]# cd /usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.312.b07-1.el7_9.x86_64/ [root@wtCentos7 jre-1.8.0-openjdk-1.8.0.312.b07-1.el7_9.x86_64]# vim ~/.bashrc
# .bashrc # User specific aliases and functions alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi #加以下两行 export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.312.b07-1.el7_9.x86_64 export PATH=$PATH:$JAVA_HOME/bin
dble的运行环境已经备好,接下来去下载DBLE
//官方文档 https://actiontech.github.io/dble-docs-cn/0.overview/0.1_dble_overview.html //github https://github.com/actiontech/dble/releases,找打下图,右击复制下载链接
//假如出现”无法建立SSL连接“,把https改为http
https://github.com/actiontech/dble/releases/download/3.21.06.0%2Ftag/dble-3.21.06.0-20210812073019-linux.tar.gz
[root@wtCentos7 src]# tar -zxvf dble-3.21.06.0-20210812073019-linux.tar.gz
配置
解压完之后进入dble目录下的conf目录
[root@wtCentos7 conf]# ll 总用量 76 -rw-rw-r-- 1 2000 2000 0 8月 12 15:16 bootstrap.dynamic.cnf -rw-rw-r-- 1 2000 2000 5403 8月 12 15:16 bootstrap_template.cnf -rw-rw-r-- 1 2000 2000 304 8月 12 15:16 cacheservice.properties -rw-rw-r-- 1 2000 2000 720 8月 12 15:16 cluster_template.cnf -rw-rw-r-- 1 2000 2000 1203 8月 12 15:16 dbseq.sql -rw-rw-r-- 1 2000 2000 1553 8月 12 15:16 db_template.xml -rw-rw-r-- 1 2000 2000 631 8月 12 15:16 ehcache.xml -rw-rw-r-- 1 2000 2000 4648 8月 12 15:16 log4j2.xml -rw-rw-r-- 1 2000 2000 15 8月 12 15:16 partition-enum.txt -rw-rw-r-- 1 2000 2000 88 8月 12 15:16 partition-number-range.txt -rw-rw-r-- 1 2000 2000 108 8月 12 15:16 partition-pattern.txt -rw-rw-r-- 1 2000 2000 607 8月 12 15:16 sequence_conf.properties -rw-rw-r-- 1 2000 2000 267 8月 12 15:16 sequence_db_conf.properties -rw-rw-r-- 1 2000 2000 6810 8月 12 15:16 sharding_template.xml -rw-rw-r-- 1 2000 2000 6411 8月 12 15:16 template_table.sql -rw-rw-r-- 1 2000 2000 1809 8月 12 15:16 user_template.xml
需要把当前目录下的配置文件复制或者重新命名,因为dble不认带_template的文件,这只是一个备份。但这里是需要改两个文件
cp bootstrap_template.cnf bootstrap.cnf
cp cluster_template.cnf cluster.cnf
cp db_template.xml db.xml
cp user_template.xml user.xml
原配置内容图:
新配置内容图:
vim user.xml
managerUser和shardingUser
managerUser是管理的用户名密码,比如创建数据库
shardingUser是管理数据的用户名,比如插入数据
使用
//启动 [root@wtCentos7 dble]# pwd /usr/local/src/dble [root@wtCentos7 dble]# ./bin/dble start Starting dble-server...
如果启动不了,进入logs目录下,看 wrapper.log文件的报错;启动成功之后,用mysql客户端连接dble
[root@wtCentos7 logs]# mysql -P8088 -h127.0.0.1 -uman1 -p654321 Warning: Using a password on the command line interface can be insecure. ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)
NND,暂时卡住了,连接不上dble,暂时到这了,回头再研究
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
2020-11-02 Golang协程调度原理( G、M、P)
2018-11-02 PHP调试封装类
2018-11-02 Yii笔记:打印sql、Form表单、时间插件、Mysql的 FIND_IN_SET函数使用、是否是post/ajax请求