Database middleware Kingshard written by Golang

Source: Internet
Author: User
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.