This is a creation in Article, where the information may have evolved or changed.
Accidentally online to see this kingshard, their interest in Golang to play a bit, can run successfully.
What is database middleware? A simple say and database is similar, unlike when a program sends SQL to it, it parses the SQL based on the configuration, and then sends SQL to the specified node, followed by several database run instances.
As the application develops, as the pressure on the database becomes larger, it is common to separate the libraries, tables, and slaves, which can be implemented in the application, but will cause the application to be too complex and difficult to maintain later. Using middleware, the separation of sub-libraries, sub-tables, master and slave separation logic on the middleware to better separate code.
The overall architecture of the Kingshard is as follows:
Kingshard Frame composition
which
- Client is the one that needs to connect to the database;
- Kingshard is the database middleware;
- Node1 and Node2 are different MySQL database nodes, where master represents the main library, slave represents from the library;
The overall installation process was smooth. Encounter several problems:
1, initially want to install Golang 1.5 found Golang 1.5 need to bootstrap, need an earlier version, and then re-installed 1.4.
2, after loading Golang, execute Hello World program, prompt:
Warning:gopath set to Goroot (/ROOT/SOFTWARE/GO) have no effect
Add Gopath to the bash path:
$ VI ~/.bash_profile Export GOROOT=/ROOT/SOFTWARE/GO #go安装目录 export Gopath=/root/go
$ source ~/.bash_profile
Tips: On the test machine, I installed the Golang in the/root/software/go directory is a more casual way, better recommended is installed in the/usr/local/go directory.
3, when installing Kingshard, make command can not execute, prompt the following error:
Go build-o bin/kingshard./cmd/kingshard make:go:Command not found make: * * * [Kingshard] Error 127
Look at the error analysis, add the GO command to the system executable path, the following directly create a symbolic link.
$ ln-s Go install directory/bin/go/usr/local/bin/go
4, MySQL remote unreachable, notice whether it is a firewall problem
Reference Address:
Kingshard:https://github.com/flike/kingshard,kingshard Project homepage
English description Address: https://github.com/flike/kingshard/blob/master/README_ZH.md, some of the good articles can be consulted