Get package from https://github.com/actiontech/dble/releases
Make sure there is at least one MySQL Instance with url $url(e.g., localhost:3306) ,$user(e.g., test) and $password(e.g., testPsw) in your machine.
You also need to make sure that the url(localhost/127.0.0.1/other IP) can connect to MySQL, otherwise,you will get an error "NO ROUTE TO HOST" later. So Check your configurations of “/etc/hosts” ,“/etc/hosts.allow” ,“/etc/hosts.deny”
Add 4 database ,the SQL as below:
create database db1;
create database db2;
create database db3;
create database db4;
Make sure JAVA version is 1.8 and JAVA_HOME has been set.The older version may occurs Exception.
mkdir -p $working_dir
cd $working_dir
tar -xvf actiontech-dble-$version.tar.gz
cd $working_dir/dble/conf
cp rule_template.xml rule.xml
cp schema_template.xml schema.xml
cp server_template.xml server.xml
Edit the file schema.xml.
Find the dataHost element, delete all the writeHost/readHost element below.
Create a new writeHost element like
<writeHost host="hostM1" url="$url" user="$user" password="$password"/>
(replace to your own MySQL information)
Save the schema.xml
start cmd:
$working_dir/dble/bin/dble start
check log in $working_dir/logs
tail -f logs/wrapper.log
You should see "Server startup successfully. see logs in logs/dble.log".
As a distributed-database imitate mysql,you can use all Mysql classic connection.
In this case you can connect to the dble using command:
mysql -p -P8066 -h 127.0.0.1 -u root
Enter the password 123456 to login in
use testdb;
create table travelrecord(
id int,
name char(255) ,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
show full tables;
cd $working_dir/dble
./bin/dble stop