一、安装单机版DBLE

1、下载并安装

通过此链接( https://github.com/actiontech/dble/releases )下载最新版本的安装包

解压并安装dble到指定⽂件夹中:
mkdir -p $working_dir
cd $working_dir
tar -xvf actiontech-dble-$version.tar.gz
cd $working_dir/dble/conf
mv cluster_template.cnf cluster.cnf
mv bootstrap_template.cnf bootstrap.cnf
mv db_template.xml db.xml
mv user_template.xml user.xml
mv sharding_template.xml sharding.xml

2、修改db.xml配置文件

$ cat db.xml
<?xml version="1.0"?>
<!--~ Copyright (C) 2016-2020 ActionTech.~ License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher.--><dble:db xmlns:dble="http://dble.cloud/" version="4.0"><dbGroup name="dbGroup1" rwSplitMode="2" delayThreshold="100"><heartbeat>show slave status</heartbeat><dbInstance name="instanceM1" url="x.x.x.x:3306" user="root" password="Abcd@1234" maxCon="1000" minCon="10"primary="true" readWeight="1" id="xx1"><property name="testOnCreate">true</property></dbInstance><!--<dbInstance name="instanceS1" url="ip3:3306" user="your_user" password="your_psw" maxCon="1000" minCon="10"  readWeight="2" disabled="true">--><!--<property name="testOnCreate">false</property>--><!--</dbInstance>--></dbGroup><dbGroup name="dbGroup2" rwSplitMode="0" delayThreshold="100" disableHA="true"><heartbeat errorRetryCount="1" timeout="10">show slave status</heartbeat><dbInstance name="instanceM2" url="x.x.x.x:3306" user="u_dtl" password="3bw#N6a9Ap" maxCon="1000" minCon="10"primary="true"><property name="testOnCreate">true</property></dbInstance><!-- can have multi read instances --><!--<dbInstance name="instanceS2" url="ip4:3306" user="your_user" password="your_psw" maxCon="1000" minCon="10" usingDecrypt="true">--><!--<property name="testOnCreate">true</property>--><!--</dbInstance>--></dbGroup>
</dble:db>

3、启动dble

cd /opt/dble/bin
./dble startSTATUS | wrapper  | 2022/10/10 11:34:01 | Launching a JVM...
INFO   | jvm 1    | 2022/10/10 11:34:01 | OpenJDK 64-Bit Server VM warning: UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release.
INFO   | jvm 1    | 2022/10/10 11:34:01 | OpenJDK 64-Bit Server VM warning: CMSFullGCsBeforeCompaction is deprecated and will likely be removed in a future release.
INFO   | jvm 1    | 2022/10/10 11:34:01 | Listening for transport dt_socket at address: 8088
INFO   | jvm 1    | 2022/10/10 11:34:02 | WrapperManager: Initializing...
INFO   | jvm 1    | 2022/10/10 11:34:10 | java.io.IOException: Can't get variables from all dbGroups
INFO   | jvm 1    | 2022/10/10 11:34:10 |       at com.actiontech.dble.DbleServer.pullVarAndMeta(DbleServer.java:491)
INFO   | jvm 1    | 2022/10/10 11:34:10 |       at com.actiontech.dble.DbleServer.startup(DbleServer.java:250)
INFO   | jvm 1    | 2022/10/10 11:34:10 |       at com.actiontech.dble.DbleStartup.initClusterAndServerStart(DbleStartup.java:62)
INFO   | jvm 1    | 2022/10/10 11:34:10 |       at com.actiontech.dble.DbleStartup.main(DbleStartup.java:41)
INFO   | jvm 1    | 2022/10/10 11:34:10 |       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO   | jvm 1    | 2022/10/10 11:34:10 |       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
INFO   | jvm 1    | 2022/10/10 11:34:10 |       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
INFO   | jvm 1    | 2022/10/10 11:34:10 |       at java.lang.reflect.Method.invoke(Method.java:498)
INFO   | jvm 1    | 2022/10/10 11:34:10 |       at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:349)
INFO   | jvm 1    | 2022/10/10 11:34:10 |       at java.lang.Thread.run(Thread.java:750)
INFO   | jvm 1    | 2022/10/10 11:34:10 | Server execute ShutdownHook.
INFO   | jvm 1    | 2022/10/10 11:34:10 | You use OuterHa or Cluster, no need to clean up ha process
STATUS | wrapper  | 2022/10/10 11:34:13 | <-- Wrapper Stopped
STATUS | wrapper  | 2022/10/10 11:42:54 | --> Wrapper Started as Daemon
STATUS | wrapper  | 2022/10/10 11:42:54 | Java Service Wrapper Community Edition 64-bit 3.5.40
STATUS | wrapper  | 2022/10/10 11:42:54 |   Copyright (C) 1999-2019 Tanuki Software, Ltd. All Rights Reserved.
STATUS | wrapper  | 2022/10/10 11:42:54 |     http://wrapper.tanukisoftware.com
STATUS | wrapper  | 2022/10/10 11:42:54 |
STATUS | wrapper  | 2022/10/10 11:42:55 | Launching a JVM...
INFO   | jvm 1    | 2022/10/10 11:42:55 | OpenJDK 64-Bit Server VM warning: UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release.
INFO   | jvm 1    | 2022/10/10 11:42:55 | OpenJDK 64-Bit Server VM warning: CMSFullGCsBeforeCompaction is deprecated and will likely be removed in a future release.
INFO   | jvm 1    | 2022/10/10 11:42:55 | Listening for transport dt_socket at address: 8088
INFO   | jvm 1    | 2022/10/10 11:42:55 | WrapperManager: Initializing...
INFO   | jvm 1    | 2022/10/10 11:43:13 | Server startup successfully. dble version is [5.7.11-dble-3.21.06.5-fcef02999ace23187e7230d48012e8bf515883fa-20220824033617]. Please see logs in logs/dble.log

4、测试dble分库,使用man1账户

-P 端口号需要大写# mysql -uman1 -P9066 -hx.x.x.x -p654321
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.7.11-dble-3.21.06.5-fcef02999ace23187e7230d48012e8bf515883fa-20220824033617 dble Server (ActionTech)Copyright (c) 2000, 2022, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases;
+------------------+
| DATABASE         |
+------------------+
| dble_information |
+------------------+
1 row in set (0.02 sec)
mysql> create database @@shardingnode='dn$1-6';
Query OK, 1 row affected (0.22 sec)

  

5、测试分表,使用root账户

# mysql -uroot -P8066 -hx.x.x.x -p123456
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.7.11-dble-3.21.06.5-fcef02999ace23187e7230d48012e8bf515883fa-20220824033617 dble Server (ActionTech)Copyright (c) 2000, 2022, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> source /opt/template_table.sql
Database changed
Query OK, 0 rows affected, 1 warning (0.23 sec)Query OK, 0 rows affected, 1 warning (0.78 sec)Query OK, 4 rows affected (0.36 sec)Query OK, 0 rows affected, 1 warning (0.11 sec)Query OK, 0 rows affected, 1 warning (0.62 sec)Query OK, 3 rows affected (0.10 sec)。。。。。。
mysql> show databases-> ;
+----------+
| DATABASE |
+----------+
| testdb   |
+----------+
1 row in set (0.00 sec)mysql> use testdb;
Database changedmysql> show tables;
+----------------------+
| Tables_in_testdb     |
+----------------------+
| tb_child1            |
| tb_child2            |
| tb_child3            |
| tb_date              |
| tb_enum_sharding     |
| tb_global1           |
| tb_global2           |
| tb_grandson1         |
| tb_grandson2         |
| tb_hash_sharding     |
| tb_hash_sharding_er1 |
| tb_hash_sharding_er2 |
| tb_hash_sharding_er3 |
| tb_hash_string       |
| tb_jump_hash         |
| tb_mod               |
| tb_parent            |
| tb_pattern           |
| tb_range_sharding    |
| tb_single            |
| tb_uneven_hash       |
+----------------------+
21 rows in set (0.00 sec)

结果:

二、安装集群版本DBLE

1、拷贝安装包到其他机器

# 1、拷贝压缩包
$ scp dble-3.21.06.5-20220824033617-linux.tar.gz xiaxinyu@xxxxxxrabbitmq39:/opt/dble-3.21.06.5-20220824033617-linux.tar.gz$ scp dble-3.21.06.5-20220824033617-linux.tar.gz xiaxinyu@xxxxxxredis38:/opt/dble-3.21.06.5-20220824033617-linux.tar.gz$ tar -xvf dble-3.21.06.5-20220824033617-linux.tar.gz# 2、初始化配置文件
cd $working_dir/dble/conf
mv cluster_template.cnf cluster.cnf
mv bootstrap_template.cnf bootstrap.cnf
mv db_template.xml db.xml
mv user_template.xml user.xml
mv sharding_template.xml sharding.xml# 3、拷贝相同的配置文件到其他实例
scp db.xml xiaxinyu@xxxxxxredis38:/opt/dble/conf/db.xml
scp db.xml xiaxinyu@xxxxxxrabbitmq39:/opt/dble/conf/db.xmlscp cluster.cnf xiaxinyu@xxxxxxredis38:/opt/dble/conf/cluster.cnf
scp cluster.cnf xiaxinyu@xxxxxxrabbitmq39:/opt/dble/conf/cluster.cnf

2、cluster.cnf配置文件内容

#
# Copyright (C) 2016-2020 ActionTech.
# License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher.
#clusterEnable=true
# cluster ucore/zk
clusterMode=zk
# zk:  clusterIP=10.186.19.aa:2281,10.186.60.bb:2281
clusterIP=x.x.x.x:2181,x.x.x.x:2181,x.x.x.x:2181
# zk not need cluster.port
# clusterPort=5700
rootPath=/dble
#cluster namespace, please use the same one in one cluster
clusterId=cluster-1
# if HA need sync by cluster, only useful when useOuterHa=true
# needSyncHa=false
# unit is millisecond
# showBinlogStatusTimeout=60000
sequenceHandlerType=2
# valid for sequenceHandlerType=2 or 3
#sequenceStartTime=2010-11-04 09:42:54
# valid for sequenceHandlerType=3 and clusterMode is zk, default true
#sequenceInstanceByZk=true

3、修改bootstrap.cnf文件中instance

# 修改3个实例的配置文件#  base config
-DhomePath=.
-DinstanceName=1
-DinstanceId=1
-DserverId=xxx1#  base config
-DhomePath=.
-DinstanceName=2
-DinstanceId=2
-DserverId=xxx2#  base config
-DhomePath=.
-DinstanceName=3
-DinstanceId=3
-DserverId=xxx3

不修改会引起如下错误:

java.io.IOException: Online path with other IP or serverPort exist,make sure different instance has different instanceName
INFO   | jvm 1    | 2022/10/11 10:37:42 |       at com.actiontech.dble.singleton.OnlineStatus.clusterOnlineInit(OnlineStatus.java:99)
INFO   | jvm 1    | 2022/10/11 10:37:42 |       at com.actiontech.dble.singleton.OnlineStatus.mainThreadInitClusterOnline(OnlineStatus.java:64)
INFO   | jvm 1    | 2022/10/11 10:37:42 |       at com.actiontech.dble.DbleServer.initOnlineStatus(DbleServer.java:458)
INFO   | jvm 1    | 2022/10/11 10:37:42 |       at com.actiontech.dble.DbleServer.startup(DbleServer.java:255)
INFO   | jvm 1    | 2022/10/11 10:37:42 |       at com.actiontech.dble.DbleStartup.initClusterAndServerStart(DbleStartup.java:62)
INFO   | jvm 1    | 2022/10/11 10:37:42 |       at com.actiontech.dble.DbleStartup.main(DbleStartup.java:41)
INFO   | jvm 1    | 2022/10/11 10:37:42 |       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO   | jvm 1    | 2022/10/11 10:37:42 |       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
INFO   | jvm 1    | 2022/10/11 10:37:42 |       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
INFO   | jvm 1    | 2022/10/11 10:37:42 |       at java.lang.reflect.Method.invoke(Method.java:498)
INFO   | jvm 1    | 2022/10/11 10:37:42 |       at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:349)
INFO   | jvm 1    | 2022/10/11 10:37:42 |       at java.lang.Thread.run(Thread.java:750)
INFO   | jvm 1    | 2022/10/11 10:37:42 | Server execute ShutdownHook.
INFO   | jvm 1    | 2022/10/11 10:37:42 | You use OuterHa or Cluster, no need to clean up ha process
STATUS | wrapper  | 2022/10/11 10:37:45 | <-- Wrapper Stopped
STATUS | wrapper  | 2022/10/11 10:45:37 | --> Wrapper Started as Daemon

4、zookeeper查看dble节点信息

[zk: localhost:2181(CONNECTED) 3] get /dble/cluster-1/online/
1   2   3
[zk: localhost:2181(CONNECTED) 3] get /dble/cluster-1/online/1
{"instanceName":"1","apiVersion":1,"createdAt":1665455763646,"data":{"serverPort":8066,"hostAddr":"x.x.x.x","startTime":1665455763644}}
[zk: localhost:2181(CONNECTED) 4] get /dble/cluster-1/online/2
{"instanceName":"2","apiVersion":1,"createdAt":1665456341783,"data":{"serverPort":8066,"hostAddr":"x.x.x.x","startTime":1665456341781}}
[zk: localhost:2181(CONNECTED) 5] get /dble/cluster-1/online/3
{"instanceName":"3","apiVersion":1,"createdAt":1665456397539,"data":{"serverPort":8066,"hostAddr":"x.x.x.x","startTime":1665456397537}}

Linux安装DBLE相关推荐

  1. 实用的Linux 安装 zip unzip

    Linux 安装 zip unzip 1.apt-get 安装 apt-get install zip 2.yum 安装 yum install -y unzip zip 命令实例 1.把/home目 ...

  2. nginx linux 安装

    nginx linux 安装 进入http://nginx.org/en/download.html 下载 n  gcc 安装nginx需要先将官网下载的源码进行编译,编译依赖gcc环境,如果没有gc ...

  3. Linux安装Nodejs

    Linux安装Nodejs 阿里云镜像: https://npm.taobao.org/mirrors/node/ 选择所需版本,进行下载. 我这边下载的是:https://npm.taobao.or ...

  4. linux命令安装组件,Linux安装各种组件

    [TOC] Linux安装各种组件 ============================= ## 安装JDK 官网下载最新JDK ``` http://www.oracle.com/technet ...

  5. arch linux安装_如何从头开始安装Arch Linux

    arch linux安装 by Andrea Giammarchi 由Andrea Giammarchi In this article, you'll learn how to install Ar ...

  6. linux安装eclipse运行web,Linux安装Tomcat,运行Eclipse,web项目

    到官网下载:https://tomcat.apache.org/download-80.cgi  在这里是8.5.39版本 下载tar,gz 提取解压后,我这里是放到opt目录下 cd  切换目录 / ...

  7. linux 查看es安装目录,Linux安装Elasticsearch

    本文介绍Linux环境如何安装Elasticsearch. 本文环境是在腾讯云服务器CentOS7.2搭建的,JDK1.8,elasticsearch-5.4.2. 1 安装JDK 网上教程很多,也可 ...

  8. Linux安装CentOS7(图文详解)

    Linux安装centos7 准备 软件:VMware workstation 镜像文件:CentOS-7-x86_64-Minimal-1810.iso 一.安装centos7 1.点击创建新的虚拟 ...

  9. Linux安装CentOS6(图文详解)新手入门

    Linux安装centos6 准备 软件:VMware workstation 镜像文件:CentOS-6.8-x86_64-bin-DVD1.iso 一.安装centos6 1.点击创建新的虚拟机 ...

  10. linux安装IPython四种方法

    IPython是Python的交互式Shell,提供了代码自动补完,自动缩进,高亮显示,执行Shell命令等非常有用的特性.特别是它的代码补完功能,例如:在输入zlib.之后按下Tab键,IPytho ...

最新文章

  1. oracle server process,KI视角下的ORACLE SERVER PROCESS进程的活动
  2. 借助液态金属传感器和AI,这次机械手可能真的找到感觉了
  3. C++ Primer 5th笔记(chap 17 标准库特殊设施)子表达式subexpression
  4. 计算机二级aoa软件_国产软件WPS进入全国计算机二级考试 明年3月实施
  5. vuejs兄弟组件之间的通信
  6. asp 取数据 计算_ASP.NET Core 简介
  7. 【Linux】Linux中常用操作命令
  8. python2编码问题解决了吗_Python2编码问题
  9. 前端职业规划 - 前端技术专家们的生死书
  10. 什么视频会议系统好?
  11. 人人都该懂点儿TCP
  12. springboot项目启动参数详解
  13. Matlab学习笔记之Matlab中括号用法
  14. es6 箭头函数 模板字符串 点点点运算符
  15. Session-判断用户登陆验证码是否正确
  16. Nordic芯片怎样烧录UICR
  17. 让人工智能完美运行:我们怎么给人工智能系统赋予价值观?
  18. win7系统启动到一半停止_win7系统装一半死机的解决方法
  19. Javascript学习笔记(13_2) --js事件案例(小人快跑)
  20. 论文笔记:基于深度学习的遥感影像变化检测综述

热门文章

  1. 题解-牛客网-SQL-SQL(SQL21)查找所有员工自入职以来的薪水涨幅情况
  2. 专访雪球网技术团队:用Node.js做前端的类SOA架构
  3. android程序设计排序方法,Android编程实现对文件夹里文件排序的方法
  4. 为什么要使用Memcached
  5. 做SEO优化网站跳出率太高怎么办
  6. 伯克利校长全员邮件:上课先用 Zoom,还不行就发电报!
  7. 计算机软考答题卡填涂格式,软考填涂答题卡(纸)须知
  8. 用VS编译出不依赖VC运行库的可独立运行的程序
  9. lv官网编码查询_成都市居住证编号查询系统
  10. 数理统计-5.3 统计量及其分布